org.xcmis.search.lucene.index
Class ReducibleInMemoryIndexDataKeeper

java.lang.Object
  extended by org.xcmis.search.lucene.index.ReducibleInMemoryIndexDataKeeper
All Implemented Interfaces:
IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>, IndexDataKeeper<org.apache.lucene.document.Document>, IndexDataManager<org.apache.lucene.document.Document,org.apache.lucene.index.IndexReader,org.apache.lucene.store.Directory>, IndexTransactionResource, LuceneIndexDataManager, StartableResource, TransactionableLuceneIndexDataManager

public class ReducibleInMemoryIndexDataKeeper
extends Object
implements TransactionableLuceneIndexDataManager

Created by The eXo Platform SAS.

Version:
$Id: ReducibleInMemoryIndexDataKeeper.java 2 2010-02-04 17:21:49Z andrew00x $
Author:
Sergey Kabashnyuk

Field Summary
 org.apache.lucene.store.RAMDirectory indexDirectiry
          Index storage.
 long lastModifedTime
           
 
Constructor Summary
ReducibleInMemoryIndexDataKeeper(LoggedIndexTransaction<org.apache.lucene.document.Document> changes)
           
ReducibleInMemoryIndexDataKeeper(org.apache.lucene.store.RAMDirectory indexDirectiry, Map<String,org.apache.lucene.document.Document> documentsBuffer, Map<String,org.apache.lucene.document.Document> pendingDocumentsBuffer, TransactionLog transactionLog)
           
 
Method Summary
 org.apache.lucene.store.Directory getDirectory()
           
 long getDirectorySize(boolean includeInherited)
          
 org.apache.lucene.document.Document getDocument(String uuid)
          
 long getDocumentCount()
           
 Map<String,org.apache.lucene.document.Document> getDocumentsBuffer()
           
 org.apache.lucene.index.IndexReader getIndexReader()
          
 long getLastModifedTime()
           
 Map<String,org.apache.lucene.document.Document> getPendingDocumentsBuffer()
           
 TransactionLog getTransactionLog()
          Return transaction log
 boolean isPendingCommited()
           
 boolean isStarted()
           
 boolean isStoped()
           
 IndexTransactionModificationReport save(IndexTransaction<org.apache.lucene.document.Document> changes)
          Saves the IndexTransaction from this storage
 void start()
          Allocate resources
 void stop()
          Dispose resources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexDirectiry

public final org.apache.lucene.store.RAMDirectory indexDirectiry
Index storage.


lastModifedTime

public long lastModifedTime
Constructor Detail

ReducibleInMemoryIndexDataKeeper

public ReducibleInMemoryIndexDataKeeper(LoggedIndexTransaction<org.apache.lucene.document.Document> changes)
                                 throws IndexException
Parameters:
changes -
Throws:
IndexException

ReducibleInMemoryIndexDataKeeper

public ReducibleInMemoryIndexDataKeeper(org.apache.lucene.store.RAMDirectory indexDirectiry,
                                        Map<String,org.apache.lucene.document.Document> documentsBuffer,
                                        Map<String,org.apache.lucene.document.Document> pendingDocumentsBuffer,
                                        TransactionLog transactionLog)
Method Detail

getDirectory

public org.apache.lucene.store.Directory getDirectory()
                                               throws IndexException
Specified by:
getDirectory in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
Throws:
IndexException

getDirectorySize

public long getDirectorySize(boolean includeInherited)

Specified by:
getDirectorySize in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
size of index directory.

getDocument

public org.apache.lucene.document.Document getDocument(String uuid)
                                                throws IndexException

Specified by:
getDocument in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
document
Throws:
IndexException

getDocumentCount

public long getDocumentCount()
Specified by:
getDocumentCount in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
the documentsCount

getDocumentsBuffer

public Map<String,org.apache.lucene.document.Document> getDocumentsBuffer()
Returns:
the documentsUuids

getIndexReader

public org.apache.lucene.index.IndexReader getIndexReader()
                                                   throws IndexException

Specified by:
getIndexReader in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
index reader.
Throws:
IndexException

getLastModifedTime

public long getLastModifedTime()
Specified by:
getLastModifedTime in interface IndexDataConsumer<org.apache.lucene.index.IndexReader,org.apache.lucene.document.Document,org.apache.lucene.store.Directory>
Returns:
last modification time.

getPendingDocumentsBuffer

public Map<String,org.apache.lucene.document.Document> getPendingDocumentsBuffer()
Returns:
the pendingDocumentsBuffer

getTransactionLog

public TransactionLog getTransactionLog()
Return transaction log

Specified by:
getTransactionLog in interface IndexTransactionResource
Returns:

isPendingCommited

public boolean isPendingCommited()
Returns:
the isPendingCommited

isStarted

public boolean isStarted()
Specified by:
isStarted in interface StartableResource
Returns:
the isStarted

isStoped

public boolean isStoped()
Specified by:
isStoped in interface StartableResource
Returns:
the isStoped

save

public IndexTransactionModificationReport save(IndexTransaction<org.apache.lucene.document.Document> changes)
                                        throws IndexException,
                                               IndexTransactionException
Saves the IndexTransaction from this storage

Specified by:
save in interface IndexDataKeeper<org.apache.lucene.document.Document>
Throws:
IndexException
IndexTransactionException

start

public void start()
           throws IndexException
Allocate resources

Specified by:
start in interface StartableResource
Throws:
IndexException

stop

public void stop()
          throws IndexException
Dispose resources

Specified by:
stop in interface StartableResource
Throws:
IndexException


Copyright © 2003-2013 eXo Platform SAS. All Rights Reserved.