Esri Geoportal Server
1.0

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

java.lang.Object
  extended by com.esri.gpt.server.assertion.index.AsnBaseIndexAdapter
      extended by com.esri.gpt.server.assertion.index.AsnIndexAdapter

public class AsnIndexAdapter
extends AsnBaseIndexAdapter

Handles read/write operations against a Lucene index of assertions.


Constructor Summary
AsnIndexAdapter()
          Default constructor
 
Method Summary
 long count(AsnContext context, IndexSearcher searcher, String valueField, String subject, String predicate, String value)
          Returns a hit count for a subject, predicate and value combination.
 void delete(AsnContext context, String assertionId)
          Deletes an assertion.
 void index(AsnContext context, Assertion assertion)
          Indexes an assertion.
 Assertion loadAssertionById(AsnContext context, boolean mustExist)
          Loads an assertion based upon the subject id of the active operation.
 Assertion loadPreviousUserAssertion(AsnContext context)
          Loads the assertion previously cast for the active subject, predicate and user.
 Assertion loadPreviousUserAssertion(AsnContext context, IndexSearcher searcher)
          Loads the assertion previously cast for the active subject, predicate and user.
 
Methods inherited from class com.esri.gpt.server.assertion.index.AsnBaseIndexAdapter
closeReader, closeSearcher, closeWriter, configure, getDirectory, getIndexReference, getNativeLockFactory, makeIndexReader, makeIndexWriter, newAnalyzer, optimize, setIndexReference, touch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsnIndexAdapter

public AsnIndexAdapter()
Default constructor

Method Detail

count

public long count(AsnContext context,
                  IndexSearcher searcher,
                  String valueField,
                  String subject,
                  String predicate,
                  String value)
           throws CorruptIndexException,
                  IOException
Returns a hit count for a subject, predicate and value combination.
This will only work correctly for values that have not been analyzed prior to indexing.

Parameters:
context - the assertion operation context
searcher - the index searcher
valueField - the value field name
subject - the subject
predicate - the predicate
value - the value
Returns:
the cardinality
Throws:
CorruptIndexException - if the index is corrupt
IOException - if an I/O exception occurs

delete

public void delete(AsnContext context,
                   String assertionId)
            throws CorruptIndexException,
                   LockObtainFailedException,
                   IOException
Deletes an assertion.

Parameters:
context - the assertion operation context
assertionId - the assertion ID to delete
Throws:
CorruptIndexException - if the index is corrupt
LockObtainFailedException - if a write lock cannot be obtained
IOException - if an I/O exception occurs

index

public void index(AsnContext context,
                  Assertion assertion)
           throws CorruptIndexException,
                  LockObtainFailedException,
                  IOException
Indexes an assertion.

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

loadAssertionById

public Assertion loadAssertionById(AsnContext context,
                                   boolean mustExist)
                            throws CorruptIndexException,
                                   IOException,
                                   AsnInvalidOperationException
Loads an assertion based upon the subject id of the active operation.

Parameters:
context - the assertion operation context
mustExist - true true if the assertion must exist
Returns:
the assertion (null if not found)
Throws:
CorruptIndexException - if the index is corrupt
IOException - if an I/O exception occurs
AsnInvalidOperationException - if mustExist and the assertion was not found

loadPreviousUserAssertion

public Assertion loadPreviousUserAssertion(AsnContext context)
                                    throws Exception
Loads the assertion previously cast for the active subject, predicate and user.

Parameters:
context - the assertion operation context
Returns:
the previously cast assertion (can be null)
Throws:
Exception - if an exception occurs

loadPreviousUserAssertion

public Assertion loadPreviousUserAssertion(AsnContext context,
                                           IndexSearcher searcher)
                                    throws Exception
Loads the assertion previously cast for the active subject, predicate and user.

Parameters:
context - the assertion operation context
searcher - the index searcher
Returns:
the previously cast assertion (can be null)
Throws:
Exception - if an exception occurs

Esri Geoportal Server
1.0

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