wt.index
Class IndexAccessorConnection
java.lang.Object
wt.index.IndexAccessorConnection
- Direct Known Subclasses:
- IndexAccessorHttpConnection
- public abstract class IndexAccessorConnection
- extends Object
This class is the abstraction layer for our various
connection schemes between the method server's Indexer
and the index/search engine. The connection
factory, in this package, returns the proper derived
class of this parentage.
The usage of this class should look the same for almost all
purposes
Example:
try {
IndexAccessorConnection iaccConn = null;
IndexAccessor iacc = null;
iaccConn = IndexAccessorConnectionFactory.createAccessor( getIndex( ) );
iaccConn.setIndexKey( createIndexKey( ) );
iaccConn.setCollectionPath( getIndex( ).getCollectionPath( ) );
iaccConn.setOperation( IndexAccessorConnection.INSERT );
iaccConn.setIndexEnabled( getIndex( ).isIndexEnabled( ) );
iaccConn.setVerboseExecution( VERBOSE_EXECUTION );
iaccConn.setSaveFiles( getIndex( ).isSaveFiles( ) );
iaccConn.openConnection();
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex();
iacc.writeType( "MyCrObject" ); // this maps to a type defined in formats.cfg
MyChangeRequest cr = (MyChangeRequest)getIndexable( );
iacc.writeItem( "identity", cr.getIdentity( ) );
iacc.endIndex();
// Wait for the status to come back indicating that indexing is complete.
String accStatus = iaccConn.getStatus();
if (!( accStatus.equals(IndexConstants.SUCCESS_STATUS))) {
Object args[] = { identity };
throw new IndexingException( RESOURCE, indexResource.INDEX_FAILURE, args );
}
}
finally {
iaccConn.closeConnection( );
}
Supported API: true
Extendable: false
- See Also:
IndexDelegate
,
wt.index.IndexAccessorFactory
,
IndexAccessor
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
INSERT
public static final int INSERT
- See Also:
- Constant Field Values
DELETE
public static final int DELETE
- See Also:
- Constant Field Values
VALIDATE
public static final int VALIDATE
- See Also:
- Constant Field Values
operation
protected int operation
indexKey
protected String indexKey
indexObjectClass
protected String indexObjectClass
encoding
protected String encoding
tempFile
private static File tempFile
tempTimer
private long tempTimer
indexAccessor
IndexAccessor indexAccessor
RESOURCE
private static final String RESOURCE
- See Also:
- Constant Field Values
IndexAccessorConnection
public IndexAccessorConnection()
openConnection
public abstract void openConnection()
throws IOException
- Throws:
IOException
closeConnection
public abstract void closeConnection()
getStatus
public abstract String getStatus()
throws WTException
- Throws:
WTException
setOperation
public void setOperation(int an_operation)
getOutputStream
public OutputStream getOutputStream()
throws IOException
- Throws:
IOException
getIndexAccessor
public IndexAccessor getIndexAccessor()
throws IOException,
UnsupportedEncodingException
- Throws:
IOException
UnsupportedEncodingException