|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.modeshape.graph.search.SearchableRepositorySource
public class SearchableRepositorySource

A RepositorySource implementation that can be used as a wrapper around another
non-searchable or
non-querable RepositorySource instance to provide search and query
capability.
| Nested Class Summary | |
|---|---|
protected class |
SearchableRepositorySource.AbstractConnection
|
protected class |
SearchableRepositorySource.ParallelConnection
A RepositoryConnection implementation that calls the delegate processor in a background thread, allowing the
processing of the FullTextSearchRequest and AccessQueryRequest objects to be done in this thread and in
parallel with other requests. |
protected class |
SearchableRepositorySource.SynchronousConnection
A RepositoryConnection implementation that calls the delegate processor in the calling thread. |
| Constructor Summary | |
|---|---|
SearchableRepositorySource(RepositorySource wrapped,
SearchEngine searchEngine)
Create a new searchable and queryable RepositorySource around an instance that is neither. |
|
SearchableRepositorySource(RepositorySource wrapped,
SearchEngine searchEngine,
ExecutorService executorService,
boolean executeAsynchronously,
boolean updateIndexesAsynchronously)
Create a new searchable and queryable RepositorySource around an instance that is neither. |
|
| Method Summary | |
|---|---|
void |
close()
Signal this source that it is no longer needed and should begin the process of reclaiming or closing all resources that it has acquired. |
protected RepositorySource |
delegate()
|
protected boolean |
executeRequestsAsynchronously()
|
protected ExecutorService |
executorService()
|
RepositorySourceCapabilities |
getCapabilities()
Get the capabilities for this source. |
RepositoryConnection |
getConnection()
Get a connection from this source. |
String |
getName()
Get the name for this repository source. |
Reference |
getReference()
|
int |
getRetryLimit()
Get the maximum number of retries that may be performed on a given operation when using connections created by this source. |
void |
initialize(RepositoryContext context)
Initialize this source to use the supplied RepositoryContext, from which this source can obtain the
configuration defining this source,
connections to other sources, and the
execution context. |
protected void |
process(ExecutionContext context,
Changes changes)
Do the work of processing the changes and updating the searchEngine. |
protected SearchEngine |
searchEngine()
|
void |
setRetryLimit(int limit)
Set the maximum number of retries that may be performed on a given operation when using connections created by this source. |
protected boolean |
updateIndexesAsynchronously()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SearchableRepositorySource(RepositorySource wrapped,
SearchEngine searchEngine,
ExecutorService executorService,
boolean executeAsynchronously,
boolean updateIndexesAsynchronously)
wrapped - the RepositorySource that is not searchable and queryablesearchEngine - the search engine that is to be usedexecutorService - the ExecutorService that should be used when submitting requests to the wrapped service; may be null
if all operations should be performed in the calling threadexecuteAsynchronously - true if an ExecutorService is provided and the requests to the wrapped source are to
be executed asynchronouslyupdateIndexesAsynchronously - true if an ExecutorService is provided and the indexes are to be updated in a
different thread than the thread executing the RepositoryConnection.execute(ExecutionContext, Request)
calls.
public SearchableRepositorySource(RepositorySource wrapped,
SearchEngine searchEngine)
RepositoryConnection.execute(ExecutionContext, Request) method (and obviously on the same thread). This means that
the execution of the requests will not return until the indexes have been updated with any changes made by the requests.
This is equivalent to calling new SearchableRepositorySource(wrapped,searchEngine,null,false)
wrapped - the RepositorySource that is not searchable and queryablesearchEngine - the search engine that is to be used| Method Detail |
|---|
public String getName()
getName in interface RepositorySourceRepositorySource.getName()public void close()
connections may still be in use, this method may not necessarily close all
resources immediately.
This is a required method, and must be called when this source is no longer needed if one or more connections have been obtained since the previous call to this method.
Note that calling this method also does not preclude obtaining more connections after this method
is called. If that happens, this source should simply reacquire any resources necessary to provide additional connections,
and this method needs to be called once again.
close in interface RepositorySourceRepositorySource.close()public RepositorySourceCapabilities getCapabilities()
getCapabilities in interface RepositorySourceRepositorySource.getCapabilities()
public RepositoryConnection getConnection()
throws RepositorySourceException
getConnection in interface RepositorySourceRepositorySourceException - if there is a problem obtaining a connectionRepositorySource.getConnection()public int getRetryLimit()
connections created by this source. This value does not constitute a minimum number of retries; in fact, the connection
user is not required to retry any operations.
getRetryLimit in interface RepositorySourceRepositorySource.getRetryLimit()
public void initialize(RepositoryContext context)
throws RepositorySourceException
RepositoryContext, from which this source can obtain the
configuration defining this source,
connections to other sources, and the
execution context.
This method may be called each time the configuration changes, allowing the source to update itself.
initialize in interface RepositorySourceRepositorySourceExceptionRepositorySource.initialize(org.modeshape.graph.connector.RepositoryContext)protected final SearchEngine searchEngine()
protected final boolean updateIndexesAsynchronously()
protected final boolean executeRequestsAsynchronously()
protected final ExecutorService executorService()
protected final RepositorySource delegate()
protected void process(ExecutionContext context,
Changes changes)
searchEngine. This method may be called while on one of the
threads owned by the executor service (if updateIndexesAsynchronously() returns true), or
from the thread executing the
requests on the delegate (if updateIndexesAsynchronously() returns false).
context - the execution context in which the indexes should be updatedchanges - the changes; never nullpublic void setRetryLimit(int limit)
connections created by this source. This value does not constitute a minimum number of retries; in fact, the connection
user is not required to retry any operations.
setRetryLimit in interface RepositorySourcelimit - the maximum number of allowable retries, or 0 if the source has no limitRepositorySource.setRetryLimit(int)
public Reference getReference()
throws NamingException
getReference in interface ReferenceableNamingExceptionReferenceable.getReference()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||