Esri Geoportal Server
1.0

com.esri.gpt.server.assertion.index
Class AsnBaseIndexAdapter

java.lang.Object
  extended by com.esri.gpt.server.assertion.index.AsnBaseIndexAdapter
Direct Known Subclasses:
AsnIndexAdapter

public class AsnBaseIndexAdapter
extends Object

Base class for an adapter that handles read/write operations against a Lucene index of assertions.


Constructor Summary
AsnBaseIndexAdapter()
          Default constructor
 
Method Summary
 void closeReader(IndexReader reader)
          Closes an index reader.
 void closeSearcher(IndexSearcher searcher)
          Closes an index searcher.
 void closeWriter(IndexWriter writer)
          Closes an index writer.
 void configure(AsnIndexReference indexReference)
          Configures the adapter from an index configuration reference.
protected  Directory getDirectory()
          Gets the Lucene Directory assoctated with the index.
 AsnIndexReference getIndexReference()
          Gets the configuration reference for the index.
protected  NativeFSLockFactory getNativeLockFactory()
          Gets the native lock factory if it has been configured for use.
 IndexReader makeIndexReader()
          Makes an index reader.
 IndexWriter makeIndexWriter(Analyzer analyzer)
          Makes an index writer.
 Analyzer newAnalyzer(AsnContext context)
          Instantiates a new analyzer.
 void optimize()
          Optimizes the index.
 void setIndexReference(AsnIndexReference indexReference)
          Sets the configuration reference for the index.
 void touch()
          Opens and closes a writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsnBaseIndexAdapter

public AsnBaseIndexAdapter()
Default constructor

Method Detail

getIndexReference

public AsnIndexReference getIndexReference()
Gets the configuration reference for the index.

Returns:
the index configuration reference

setIndexReference

public void setIndexReference(AsnIndexReference indexReference)
Sets the configuration reference for the index.

Parameters:
indexReference - index configuration reference

closeReader

public void closeReader(IndexReader reader)
Closes an index reader.

Parameters:
reader - the reader to close

closeSearcher

public void closeSearcher(IndexSearcher searcher)
Closes an index searcher.

Parameters:
searcher - the searcher to close

closeWriter

public void closeWriter(IndexWriter writer)
Closes an index writer.

Parameters:
writer - the writer to close

configure

public void configure(AsnIndexReference indexReference)
Configures the adapter from an index configuration reference.

Parameters:
indexReference - index configuration reference

getDirectory

protected Directory getDirectory()
                          throws IOException
Gets the Lucene Directory assoctated with the index.

Returns:
the directory
Throws:
IOException - if an I/O exception occurs

getNativeLockFactory

protected NativeFSLockFactory getNativeLockFactory()
                                            throws IOException
Gets the native lock factory if it has been configured for use.

Returns:
the native lock factory (null if not configured for use)
Throws:
IOException - if an I/O exception occurs

makeIndexReader

public IndexReader makeIndexReader()
                            throws CorruptIndexException,
                                   IOException
Makes an index reader.
The reader must be closed following use.

Returns:
the reader
Throws:
CorruptIndexException - if the index is corrupt
IOException - if an I/O exception occurs

makeIndexWriter

public IndexWriter makeIndexWriter(Analyzer analyzer)
                            throws CorruptIndexException,
                                   LockObtainFailedException,
                                   IOException
Makes an index writer.
The writer must be closed following use.

Parameters:
analyzer - the analyzer
Returns:
the writer
Throws:
CorruptIndexException - if the index is corrupt
LockObtainFailedException - if a write lock cannot be obtained
IOException - if an I/O exception occurs

newAnalyzer

public Analyzer newAnalyzer(AsnContext context)
Instantiates a new analyzer.

Parameters:
context - the assertion operation context
Returns:
the analyzer

optimize

public void optimize()
              throws CorruptIndexException,
                     LockObtainFailedException,
                     IOException
Optimizes the index.

Throws:
CorruptIndexException - if the index is corrupt
LockObtainFailedException - if a write lock cannot be obtained
IOException - if an I/O exception occurs

touch

public void touch()
           throws CorruptIndexException,
                  LockObtainFailedException,
                  IOException
Opens and closes a writer.
This ensures that a directory folder structure exists.

Throws:
CorruptIndexException - if the index is corrupt
LockObtainFailedException - if a write lock cannot be obtained
IOException - if an I/O exception occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.