public abstract class DocumentAccess extends Object
This is the starting point of the document api. This api provides access to documents in a document repository. The document api contains four separate access types:
SyncSession
,
allows simple access where throughput is not a concern.AsyncSession
,
allows document repository writes and random access with high
throughput.VisitorSession
, allows a set of
documents to be accessed in an order decided by the document repository. This
allows much higher read throughput than random access.SubscriptionSession
, allows
changes to a defined set of documents in the repository to be
visited.This class is the factory for creating the four session types mentioned above.
There may be multiple implementations of the document api classes. If
default configuration is sufficient, use the createDefault()
method to
return a running document access. Note that there are running threads within
an access object, so you must shut it down when done.
An implementation of the Document Api may support just a subset of the access types defined in this interface. For example, some document repositories, like indexes, are write only. Others may support random access, but not visiting and subscription. Any method which is not supported by the underlying implementation will throw UnsupportedOperationException.
Access to this class is thread-safe.
Modifier and Type | Field and Description |
---|---|
private com.yahoo.config.subscription.ConfigSubscriber |
documentTypeConfigSubscriber |
private com.yahoo.document.DocumentTypeManager |
documentTypeManager |
Modifier | Constructor and Description |
---|---|
protected |
DocumentAccess(DocumentAccessParams params)
Constructs a new document access object.
|
Modifier and Type | Method and Description |
---|---|
abstract AsyncSession |
createAsyncSession(AsyncParameters parameters)
Returns a session for asynchronous document access.
|
static DocumentAccess |
createDefault()
This is a convenience method to return a document access object with
all default parameter values.
|
abstract SubscriptionSession |
createSubscription(SubscriptionParameters parameters)
Creates a subscription and returns a session for getting data from
it.
|
abstract SyncSession |
createSyncSession(SyncParameters parameters)
Returns a session for synchronous document access.
|
abstract VisitorDestinationSession |
createVisitorDestinationSession(VisitorDestinationParameters parameters)
Creates a destination session for receiving data from visiting.
|
abstract VisitorSession |
createVisitorSession(VisitorParameters parameters)
Run a visitor with the given visitor parameters, and get the result
back here.
|
com.yahoo.document.DocumentTypeManager |
getDocumentTypeManager()
Returns the
DocumentTypeManager used by this
DocumentAccess. |
abstract SubscriptionSession |
openSubscription(SubscriptionParameters parameters)
Returns a session for document subscription.
|
void |
shutdown()
Shuts down the underlying sessions used by this DocumentAccess;
subsequent use of this DocumentAccess will throw unspecified exceptions,
depending on implementation.
|
private final com.yahoo.document.DocumentTypeManager documentTypeManager
private final com.yahoo.config.subscription.ConfigSubscriber documentTypeConfigSubscriber
protected DocumentAccess(DocumentAccessParams params)
Constructs a new document access object.
params
- The parameters to use for setup.public static DocumentAccess createDefault()
This is a convenience method to return a document access object with all default parameter values. The client that calls this method is also responsible for shutting the object down when done. If an error occurred while attempting to create such an object, this method will throw an exception.
public abstract SyncSession createSyncSession(SyncParameters parameters)
Returns a session for synchronous document access. Use this for simple access.
parameters
- The parameters of this sync session.UnsupportedOperationException
- If this access implementation does
not support synchronous access.RuntimeException
- If an error prevented the session
from being created.public abstract AsyncSession createAsyncSession(AsyncParameters parameters)
Returns a session for asynchronous document access. Use this if high operation throughput is required.
parameters
- The parameters of this async session.UnsupportedOperationException
- If this access implementation does
not support asynchronous access.RuntimeException
- If an error prevented the session
from being created.public abstract VisitorSession createVisitorSession(VisitorParameters parameters) throws com.yahoo.document.select.parser.ParseException
Run a visitor with the given visitor parameters, and get the result back here.
parameters
- The parameters of this visitor session.UnsupportedOperationException
- If this access implementation does
not support visiting.RuntimeException
- If an error prevented the session
from being created.com.yahoo.document.select.parser.ParseException
- If the document selection string
could not be parsed.public abstract VisitorDestinationSession createVisitorDestinationSession(VisitorDestinationParameters parameters)
Creates a destination session for receiving data from visiting. The visitor must be started and progress tracked through a visitor session.
parameters
- The parameters of this visitor destination session.UnsupportedOperationException
- If this access implementation does
not support visiting.public abstract SubscriptionSession createSubscription(SubscriptionParameters parameters)
Creates a subscription and returns a session for getting data from it. Use this to get document operations being done by other parties.
parameters
- The parameters of this subscription session.UnsupportedOperationException
- If this access implementation does
not support subscription.RuntimeException
- If an error prevented the session
from being created.public abstract SubscriptionSession openSubscription(SubscriptionParameters parameters)
Returns a session for document subscription. Use this to get document operations being done by other parties.
parameters
- The parameters of this subscription session.UnsupportedOperationException
- If this access implementation does
not support subscription.RuntimeException
- If an error prevented the session
from being created.public void shutdown()
public com.yahoo.document.DocumentTypeManager getDocumentTypeManager()
Returns the DocumentTypeManager
used by this
DocumentAccess.
Copyright © 2018. All rights reserved.