Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


oracle.ide.index
Interface IndexingContext


public interface IndexingContext

Context for an indexing operation. By default, the context contains the URL of the file currently being indexed, as well as a text buffer containing the contents of the file. Indexer implementations can store additional items in the context to be shared with other indexers. For example, an indexer might run a lexer on the file contents and store the tokens in the context. Another indexer could then reuse these tokens without running another lexer. This is done by calling the get(java.lang.String) and put(java.lang.String, java.lang.Object) methods.


Method Summary
 java.lang.Object get(java.lang.String key)
          Get the context item with the given key.
 java.lang.Object getFilterKey()
          Get the key being used to filter results.
 java.lang.Object getFilterValue()
          Get the value used to filter results.
 Node getNode()
          Get the Node being indexed.
 Project getProject()
          Get the project being indexed.
 TextBuffer getTextBuffer()
          Get the text buffer containing the contents of the file being indexed.
 long getTimestamp()
          Get the time stamp of the file being indexed.
 java.net.URL getURL()
          Get the URL of the file being indexed.
 void put(java.lang.String key, java.lang.Object item)
          Add a context item with the given key.

 

Method Detail

getProject

Project getProject()
Get the project being indexed.
Returns:
the project being indexed

getNode

Node getNode()
Get the Node being indexed. This is only available during Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector). The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext) and Indexer.endIndexing(oracle.ide.index.IndexingContext).

Important Note: this method is provided only to provide contextual information to the Indexer. The Indexer implementation must not take any locks on the Node. Doing so could lead to deadlock between the indexing thread and threads waiting for an index query result while holding a lock. The Indexer must use the buffer returned by getTextBuffer() to access the contents of the Node.

The only exception to this is when the Node being indexed is not a TextNode. In that case, the Node will be read locked at the time the Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector) method is called, so the implementation can directly access the Node contents.

Returns:
the Node being indexed

getURL

java.net.URL getURL()
Get the URL of the file being indexed. This is only available during Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector). The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext) and Indexer.endIndexing(oracle.ide.index.IndexingContext).
Returns:
the URL of the file being indexed

getTextBuffer

TextBuffer getTextBuffer()
Get the text buffer containing the contents of the file being indexed. The text buffer is read locked before Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector) is called. This is only available during Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector). The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext) and Indexer.endIndexing(oracle.ide.index.IndexingContext). If the node being indexed is not a TextNode, this will return null.
Returns:
the text buffer

getTimestamp

long getTimestamp()
Get the time stamp of the file being indexed. This timestamp comes from the index file table, so calling this method does not hit the file system. This is only available during Indexer.index(oracle.ide.index.IndexingContext, oracle.ide.index.DataCollector). The return value is undefined during Indexer.startIndexing(oracle.ide.index.IndexingContext) and Indexer.endIndexing(oracle.ide.index.IndexingContext).
Returns:
the timestamp of the file

getFilterKey

java.lang.Object getFilterKey()
Get the key being used to filter results. If the return value of this method is not null, Indexer implementations should only report data matching this key.
Returns:
the data key being filtered

getFilterValue

java.lang.Object getFilterValue()
Get the value used to filter results. If the return value of this method is not null, Indexer implementations should only report data matching the key returned by getFilterKey() and the value returned by this method.
Returns:
the value being searched for

get

java.lang.Object get(java.lang.String key)
Get the context item with the given key.
Parameters:
key - the key
Returns:
the context item

put

void put(java.lang.String key,
         java.lang.Object item)
Add a context item with the given key. This will replace any existing item with the same key.
Parameters:
key - the key
item - the context item to be added

Skip navigation links

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.5.0)

E13403-06


Copyright © 1997, 2011, Oracle. All rights reserved.