com.sun.labs.minion.indexer.dictionary
Class DictionaryFactory

java.lang.Object
  extended by com.sun.labs.minion.indexer.dictionary.DictionaryFactory
All Implemented Interfaces:
com.sun.labs.util.props.Component, com.sun.labs.util.props.Configurable

public class DictionaryFactory
extends java.lang.Object
implements com.sun.labs.util.props.Configurable


Field Summary
protected  int cacheSize
           
protected  java.lang.Class entryClass
           
protected  int infoBufferSize
           
protected  int infoOffsetsBufferSize
           
protected static java.lang.String logTag
           
protected  int nameBufferSize
           
protected  int offsetsBufferSize
           
protected  int postingsInput
           
static java.lang.String PROP_CACHE_SIZE
          The size of the entry cache
static java.lang.String PROP_ENTRY_CLASS_NAME
           
static java.lang.String PROP_INFO_BUFFER_SIZE
          The size of the buffer to use for entry information.
static java.lang.String PROP_INFO_OFFSETS_BUFFER_SIZE
          The size of the buffer to use for the offsets to the entry information.
static java.lang.String PROP_NAME_BUFFER_SIZE
          The size of the buffer to use for the entry names in the dictionary.
static java.lang.String PROP_OFFSETS_BUFFER_SIZE
          The size of the buffer to use for the offsets into the entry names.
static java.lang.String PROP_POSTINGS_INPUT
          The type of postings input stream to use when reading postings.
 
Constructor Summary
DictionaryFactory()
          Creates a DictionaryFactory
 
Method Summary
 DiskBiGramDictionary getBiGramDictionary(DiskDictionary mainDict, java.io.RandomAccessFile dictFile, java.io.RandomAccessFile postFile, DiskPartition part)
          Gets a bigram dictionary.
 DiskDictionary getCachedDiskDictionary(NameDecoder decoder, java.io.RandomAccessFile dictFile, java.io.RandomAccessFile[] postFiles, DiskPartition part)
          Gets a cached dictionary that's configured according to the configuration.
 DiskDictionary getDiskDictionary(java.lang.Class entryClass, NameDecoder decoder, java.io.RandomAccessFile dictFile, java.io.RandomAccessFile[] postFiles, DiskPartition part)
          Gets a disk dictionary that's configured according to the configuration, except it uses a different entry type.
 DiskDictionary getDiskDictionary(NameDecoder decoder, java.io.RandomAccessFile dictFile, java.io.RandomAccessFile[] postFiles, DiskPartition part)
          Gets a disk dictionary that's configured according to the configuration.
 java.lang.Class getEntryClass()
           
 java.lang.String getEntryClassName()
           
 MemoryDictionary getMemoryDictionary(Partition p)
           
 int getNumPostingsChannels()
           
 boolean hasCasedEntry()
          Indicates whether the entry type used for this dictionary is cased.
 void newProperties(com.sun.labs.util.props.PropertySheet ps)
           
 void setEntryClass(java.lang.Class entryClass)
           
 void setEntryClassName(java.lang.String entryClassName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logTag

protected static java.lang.String logTag

PROP_ENTRY_CLASS_NAME

@ConfigString(defaultValue="com.sun.labs.minion.indexer.entry.IDEntry")
public static final java.lang.String PROP_ENTRY_CLASS_NAME
See Also:
Constant Field Values

entryClass

protected java.lang.Class entryClass

PROP_CACHE_SIZE

@ConfigInteger(defaultValue=256)
public static java.lang.String PROP_CACHE_SIZE
The size of the entry cache


cacheSize

protected int cacheSize

PROP_INFO_BUFFER_SIZE

@ConfigInteger(defaultValue=1024)
public static java.lang.String PROP_INFO_BUFFER_SIZE
The size of the buffer to use for entry information.


infoBufferSize

protected int infoBufferSize

PROP_INFO_OFFSETS_BUFFER_SIZE

@ConfigInteger(defaultValue=1024)
public static java.lang.String PROP_INFO_OFFSETS_BUFFER_SIZE
The size of the buffer to use for the offsets to the entry information.


infoOffsetsBufferSize

protected int infoOffsetsBufferSize

PROP_NAME_BUFFER_SIZE

@ConfigInteger(defaultValue=2048)
public static java.lang.String PROP_NAME_BUFFER_SIZE
The size of the buffer to use for the entry names in the dictionary.


nameBufferSize

protected int nameBufferSize

PROP_OFFSETS_BUFFER_SIZE

@ConfigInteger(defaultValue=1024)
public static java.lang.String PROP_OFFSETS_BUFFER_SIZE
The size of the buffer to use for the offsets into the entry names.


offsetsBufferSize

protected int offsetsBufferSize

PROP_POSTINGS_INPUT

@ConfigInteger(defaultValue=3)
public static java.lang.String PROP_POSTINGS_INPUT
The type of postings input stream to use when reading postings.


postingsInput

protected int postingsInput
Constructor Detail

DictionaryFactory

public DictionaryFactory()
Creates a DictionaryFactory

Method Detail

newProperties

public void newProperties(com.sun.labs.util.props.PropertySheet ps)
                   throws com.sun.labs.util.props.PropertyException
Specified by:
newProperties in interface com.sun.labs.util.props.Configurable
Throws:
com.sun.labs.util.props.PropertyException

getEntryClassName

public java.lang.String getEntryClassName()

setEntryClassName

public void setEntryClassName(java.lang.String entryClassName)

getEntryClass

public java.lang.Class getEntryClass()

setEntryClass

public void setEntryClass(java.lang.Class entryClass)

getNumPostingsChannels

public int getNumPostingsChannels()

hasCasedEntry

public boolean hasCasedEntry()
Indicates whether the entry type used for this dictionary is cased.

Returns:
true if the entry type for this dictionary is a subclass of CasedEntry, false otherwise.

getBiGramDictionary

public DiskBiGramDictionary getBiGramDictionary(DiskDictionary mainDict,
                                                java.io.RandomAccessFile dictFile,
                                                java.io.RandomAccessFile postFile,
                                                DiskPartition part)
                                         throws java.io.IOException
Gets a bigram dictionary.

Throws:
java.io.IOException

getDiskDictionary

public DiskDictionary getDiskDictionary(java.lang.Class entryClass,
                                        NameDecoder decoder,
                                        java.io.RandomAccessFile dictFile,
                                        java.io.RandomAccessFile[] postFiles,
                                        DiskPartition part)
                                 throws java.io.IOException
Gets a disk dictionary that's configured according to the configuration, except it uses a different entry type.

Parameters:
entryClass - the class of entry that the dictionary contains, which overrides the configured value.
decoder - A decoder for the names in this dictionary.
dictFile - The file containing the dictionary.
postFiles - The files containing the postings associated with the entries in this dictionary.
part - The partition with which this dictionary is associated.
Throws:
java.io.IOException - if there is any error loading the dictionary

getDiskDictionary

public DiskDictionary getDiskDictionary(NameDecoder decoder,
                                        java.io.RandomAccessFile dictFile,
                                        java.io.RandomAccessFile[] postFiles,
                                        DiskPartition part)
                                 throws java.io.IOException
Gets a disk dictionary that's configured according to the configuration.

Parameters:
decoder - A decoder for the names in this dictionary.
dictFile - The file containing the dictionary.
postFiles - The files containing the postings associated with the entries in this dictionary.
part - The partition with which this dictionary is associated.
Throws:
java.io.IOException - if there is any error loading the dictionary

getCachedDiskDictionary

public DiskDictionary getCachedDiskDictionary(NameDecoder decoder,
                                              java.io.RandomAccessFile dictFile,
                                              java.io.RandomAccessFile[] postFiles,
                                              DiskPartition part)
                                       throws java.io.IOException
Gets a cached dictionary that's configured according to the configuration.

Throws:
java.io.IOException

getMemoryDictionary

public MemoryDictionary getMemoryDictionary(Partition p)