diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2020-09-24 10:38:12 +0200 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2020-09-24 10:38:12 +0200 |
commit | 1ce8c46c6071e52c1367490e810c1211945499e8 (patch) | |
tree | 27394b0cd292fa8cec4ce238daaf704b1d31127b /documentapi | |
parent | 6704090650b19fff7f69fa8a997fddad9ca91c3a (diff) |
Update javadoc for DocumentAccess and add convencience for outside containers
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/main/java/com/yahoo/documentapi/DocumentAccess.java | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/documentapi/src/main/java/com/yahoo/documentapi/DocumentAccess.java b/documentapi/src/main/java/com/yahoo/documentapi/DocumentAccess.java index 7a9818ba4fd..1aa5c4c0df0 100644 --- a/documentapi/src/main/java/com/yahoo/documentapi/DocumentAccess.java +++ b/documentapi/src/main/java/com/yahoo/documentapi/DocumentAccess.java @@ -5,6 +5,7 @@ import com.yahoo.document.DocumentTypeManager; import com.yahoo.document.DocumentTypeManagerConfigurer; import com.yahoo.document.select.parser.ParseException; import com.yahoo.config.subscription.ConfigSubscriber; +import com.yahoo.documentapi.messagebus.MessageBusDocumentAccess; /** * <p>This is the starting point of the <b>document api</b>. This api provides @@ -55,13 +56,29 @@ public abstract class DocumentAccess { * while attempting to create such an object, this method will throw an * exception. * - * @deprecated Inject a DocumentManagerConfig and create a MessageBusDocumentAccess from this instead. + * @deprecated DocumentAccess may be injected in containers — otherwise use {@link #createForNonContainer()}. * * @return a running document access object with all default configuration */ @Deprecated(since = "7") public static DocumentAccess createDefault() { - return new com.yahoo.documentapi.messagebus.MessageBusDocumentAccess(); + return new MessageBusDocumentAccess(); + } + + + /** + * This is a convenience method to return a document access object when running + * outside of a Vespa application container, 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. + * This document access requires new config subscriptions to be set up, which should + * be avoided in application containers, but is suitable for, e.g., CLIs. + * + * @return a running document access object with all default configuration + */ + public static DocumentAccess createForNonContainer() { + return new MessageBusDocumentAccess(); } /** |