org.compass.needle.coherence
Class DataGridCoherenceDirectory

java.lang.Object
  extended by org.apache.lucene.store.Directory
      extended by org.compass.needle.coherence.CoherenceDirectory
          extended by org.compass.needle.coherence.DataGridCoherenceDirectory
Direct Known Subclasses:
InvocableCoherenceDirectory

public class DataGridCoherenceDirectory
extends CoherenceDirectory

The default coherence directory allowing to store Lucene index within Coherence directory.

The implementation uses FileHeaderKey and FileHeaderValue as the header information for a file (such as size and timestamp), and includes one or more buckets using FileBucketKey and FileBucketValue.

Locking is done using DefaultCoherenceLockFactory.

Note, if possible with the coherence edition, it is preferable to use InvocableCoherenceDirectory.

Author:
kimchy

Field Summary
static int DEFAULT_BUCKET_SIZE
           
static int DEFAULT_FLUSH_RATE
           
 
Fields inherited from class org.apache.lucene.store.Directory
lockFactory
 
Constructor Summary
DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache, String indexName)
           
DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache, String indexName, int bucketSize)
           
DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache, String indexName, int bucketSize, int flushRate)
           
DataGridCoherenceDirectory(String cacheName)
           
DataGridCoherenceDirectory(String cacheName, String indexName)
           
DataGridCoherenceDirectory(String cacheName, String indexName, int bucketSize)
           
 
Method Summary
 void close()
           
 IndexOutput createOutput(String name)
           
 void deleteContent()
           
 void deleteFile(String name)
           
protected  void doInit()
           
 boolean fileExists(String name)
           
 long fileLength(String name)
           
 long fileModified(String name)
           
 int getBucketSize()
           
 com.tangosol.net.NamedCache getCache()
           
 com.tangosol.util.ValueExtractor getFileNameKeyExtractor()
           
 int getFlushRate()
           
 String getIndexName()
           
 com.tangosol.util.Filter getIndexNameEqualsFilter()
           
 com.tangosol.util.ValueExtractor getIndexNameKeyExtractor()
           
 Map<String,IndexOutput> getOnGoingIndexOutputs()
           
 com.tangosol.util.ValueExtractor getTypeKeyExtractor()
           
 String[] list()
           
 IndexInput openInput(String name)
           
 void renameFile(String from, String to)
           
 void touchFile(String name)
           
 
Methods inherited from class org.apache.lucene.store.Directory
clearLock, copy, getLockFactory, getLockID, makeLock, openInput, setLockFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUCKET_SIZE

public static final int DEFAULT_BUCKET_SIZE
See Also:
Constant Field Values

DEFAULT_FLUSH_RATE

public static final int DEFAULT_FLUSH_RATE
See Also:
Constant Field Values
Constructor Detail

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(String cacheName)

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(String cacheName,
                                  String indexName)

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(String cacheName,
                                  String indexName,
                                  int bucketSize)

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache,
                                  String indexName)

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache,
                                  String indexName,
                                  int bucketSize)

DataGridCoherenceDirectory

public DataGridCoherenceDirectory(com.tangosol.net.NamedCache cache,
                                  String indexName,
                                  int bucketSize,
                                  int flushRate)
Method Detail

doInit

protected void doInit()

getIndexName

public String getIndexName()
Specified by:
getIndexName in class CoherenceDirectory

getCache

public com.tangosol.net.NamedCache getCache()
Specified by:
getCache in class CoherenceDirectory

getBucketSize

public int getBucketSize()
Specified by:
getBucketSize in class CoherenceDirectory

getFlushRate

public int getFlushRate()
Specified by:
getFlushRate in class CoherenceDirectory

getOnGoingIndexOutputs

public Map<String,IndexOutput> getOnGoingIndexOutputs()
Specified by:
getOnGoingIndexOutputs in class CoherenceDirectory

getIndexNameKeyExtractor

public com.tangosol.util.ValueExtractor getIndexNameKeyExtractor()

getTypeKeyExtractor

public com.tangosol.util.ValueExtractor getTypeKeyExtractor()

getFileNameKeyExtractor

public com.tangosol.util.ValueExtractor getFileNameKeyExtractor()

getIndexNameEqualsFilter

public com.tangosol.util.Filter getIndexNameEqualsFilter()

fileExists

public boolean fileExists(String name)
                   throws IOException
Specified by:
fileExists in class Directory
Throws:
IOException

fileModified

public long fileModified(String name)
                  throws IOException
Specified by:
fileModified in class Directory
Throws:
IOException

touchFile

public void touchFile(String name)
               throws IOException
Specified by:
touchFile in class Directory
Throws:
IOException

deleteFile

public void deleteFile(String name)
                throws IOException
Specified by:
deleteFile in class Directory
Throws:
IOException

renameFile

public void renameFile(String from,
                       String to)
                throws IOException
Specified by:
renameFile in class Directory
Throws:
IOException

fileLength

public long fileLength(String name)
                throws IOException
Specified by:
fileLength in class Directory
Throws:
IOException

list

public String[] list()
              throws IOException
Specified by:
list in class Directory
Throws:
IOException

deleteContent

public void deleteContent()
Specified by:
deleteContent in class CoherenceDirectory

createOutput

public IndexOutput createOutput(String name)
                         throws IOException
Specified by:
createOutput in class Directory
Throws:
IOException

openInput

public IndexInput openInput(String name)
                     throws IOException
Specified by:
openInput in class Directory
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in class Directory
Throws:
IOException


Copyright (c) 2004-2008 The Compass Project.