Skip to content

Commit 893a125

Browse files
committed
fix #845 - remove markdown from javadocs and replace with html
1 parent b2a34fc commit 893a125

18 files changed

+417
-338
lines changed

src/main/java/com/marklogic/client/datamovement/ApplyTransformListener.java

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,65 +31,72 @@
3131
import java.util.stream.Collectors;
3232

3333
/**
34-
* Modifies documents in-place in the database by applying a {@link
34+
* <p>Modifies documents in-place in the database by applying a {@link
3535
* com.marklogic.client.document.ServerTransform server-side transform}.
3636
* If the transform modifies documents to no longer match the query,
37-
* ApplyTransformListener should only be used when:
37+
* ApplyTransformListener should only be used when:</p>
3838
*
39-
* 1. [merge timestamp][] is enabled and
40-
* {@link QueryBatcher#withConsistentSnapshot} is called, or
41-
* 2. {@link DataMovementManager#newQueryBatcher(Iterator)
42-
* newQueryBatcher(Iterator&lt;String&gt;)} is used to traverse a static data set
39+
* <ol>
40+
* <li><a href="https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468">merge timestamp</a>
41+
* is enabled and {@link QueryBatcher#withConsistentSnapshot} is called, or</li>
42+
* <li>{@link DataMovementManager#newQueryBatcher(Iterator)
43+
* newQueryBatcher(Iterator&lt;String&gt;)} is used to traverse a static data set</li>
44+
* </ol>
4345
*
44-
* [merge timestamp]: https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468
46+
* <br>For example, given the REST transform myTransform.sjs:
4547
*
46-
* For example, given the REST transform myTransform.sjs:
47-
*
48-
* function transform_function(context, params, content) {
49-
* var document = content.toObject();
50-
* document.someProperty = params.newValue;
51-
* return document;
52-
* };
53-
* exports.transform = transform_function;
48+
* <pre>{@code
49+
* function transform_function(context, params, content) {
50+
* var document = content.toObject();
51+
* document.someProperty = params.newValue;
52+
* return document;
53+
* };
54+
* exports.transform = transform_function;
55+
*}</pre>
5456
*
5557
* installed in the server like so (using the MarkLogic Java Client API):
5658
*
57-
* restAdminClient.newServerConfigManager().newTransformExtensionsManager().writeJavascriptTransform(
58-
* "myTransform", new FileHandle(new File("myTransform.sjs")));
59+
* <pre>{@code
60+
* restAdminClient.newServerConfigManager().newTransformExtensionsManager().writeJavascriptTransform(
61+
* "myTransform", new FileHandle(new File("myTransform.sjs")));
62+
*}</pre>
5963
*
6064
* you can run the transform on documents matching a query like so:
6165
*
62-
* ServerTransform transform = new ServerTransform(transformName2)
63-
* .addParameter("newValue", "some new value");
64-
* ApplyTransformListener listener = new ApplyTransformListener()
65-
* .withTransform(transform)
66-
* .withApplyResult(ApplyResult.REPLACE);
67-
* QueryBatcher batcher = moveMgr.newQueryBatcher(query)
68-
* .onUrisReady(listener);
69-
* JobTicket ticket = moveMgr.startJob( batcher );
70-
* batcher.awaitCompletion();
71-
* moveMgr.stopJob(ticket);
72-
*
73-
* As with all the provided listeners, this listener will not meet the needs of
74-
* all applications but the [source code][] for it should serve as helpful sample
75-
* code so you can write your own custom listeners.
66+
* <pre>{@code
67+
* ServerTransform transform = new ServerTransform(transformName2)
68+
* .addParameter("newValue", "some new value");
69+
* ApplyTransformListener listener = new ApplyTransformListener()
70+
* .withTransform(transform)
71+
* .withApplyResult(ApplyResult.REPLACE);
72+
* QueryBatcher batcher = moveMgr.newQueryBatcher(query)
73+
* .onUrisReady(listener);
74+
* JobTicket ticket = moveMgr.startJob( batcher );
75+
* batcher.awaitCompletion();
76+
* moveMgr.stopJob(ticket);
77+
*}</pre>
7678
*
77-
* [source code]: https://github.com/marklogic/java-client-api/blob/develop/src/main/java/com/marklogic/client/datamovement/ApplyTransformListener.java
79+
* <p>As with all the provided listeners, this listener will not meet the needs
80+
* of all applications but the
81+
* <a target="_blank" href="https://github.com/marklogic/java-client-api/blob/develop/src/main/java/com/marklogic/client/datamovement/ApplyTransformListener.java">source code</a>
82+
* for it should serve as helpful sample code so you can write your own custom
83+
* listeners.</p>
7884
*
79-
* In this listener, we initialize only the HostAvailabilityListener's
85+
* <p>In this listener, we initialize only the HostAvailabilityListener's
8086
* RetryListener and not NoResponseListener's RetryListener because if we get
8187
* empty responses when we try to apply a transform to the batch of URIs
8288
* retrieved from the server, we are not sure what happened in the server - if
8389
* the transform has been applied or it has not been applied. Retrying in those
8490
* scenarios would apply the transform twice if the transform has been already
85-
* applied and this is not desirable.
91+
* applied and this is not desirable.</p>
8692
*
87-
* In order to handle such scenarios where we get an empty response, it is
93+
* <p>In order to handle such scenarios where we get an empty response, it is
8894
* recommended to add a BatchFailureListener which would take care of apply
8995
* transform failures and retry only for those URIs for which the apply
9096
* transform has failed. If the transform is idempotent, we can just initialize
91-
* the RetryListener of the NoResponseListener by calling NoResponseListener.initializeRetryListener(this)
92-
* and add it to the BatchFailureListeners similar to what we have in the other listeners.
97+
* the RetryListener of the NoResponseListener by calling
98+
* NoResponseListener.initializeRetryListener(this) and add it to the
99+
* BatchFailureListeners similar to what we have in the other listeners.</p>
93100
*/
94101
public class ApplyTransformListener implements QueryBatchListener {
95102
private static Logger logger = LoggerFactory.getLogger(ApplyTransformListener.class);
@@ -105,6 +112,11 @@ public ApplyTransformListener() {
105112
"if you see this once/batch, fix your job configuration");
106113
}
107114

115+
/**
116+
* This implementation of initializeListener adds this instance of
117+
* ApplyTransformListener to the two RetryListener's in this QueryBatcher so
118+
* they will retry any batches that fail during the apply-transform request.
119+
*/
108120
@Override
109121
public void initializeListener(QueryBatcher queryBatcher) {
110122
HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);

src/main/java/com/marklogic/client/datamovement/BatchListener.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,27 @@
2323
*/
2424
public interface BatchListener<T extends Batch<?>> {
2525
/**
26-
* The method called by QueryBatcher or WriteBatcher to run your
27-
* custom code on this batch. You usually implement this as a lambda expression.
26+
* <p>The method called by QueryBatcher or WriteBatcher to run your
27+
* custom code on this batch. You usually implement this as a lambda expression.</p>
2828
*
2929
* For example, see the lambda expression passed to onUrisReady:
3030
*
31+
* <pre>{@code
3132
* QueryBatcher qhb = dataMovementManager.newQueryBatcher(query)
3233
* .withBatchSize(1000)
3334
* .withThreadCount(20)
34-
* .onUrisReady(batch -&gt; {
35+
* .onUrisReady(batch -> {
3536
* for ( String uri : batch.getItems() ) {
3637
* if ( uri.endsWith(".txt") ) {
3738
* batch.getClient().newDocumentManager().delete(uri);
3839
* }
3940
* }
4041
* })
41-
* .onQueryFailure(queryBatchException -&gt; queryBatchException.printStackTrace());
42+
* .onQueryFailure(queryBatchException -> queryBatchException.printStackTrace());
4243
* JobTicket ticket = dataMovementManager.startJob(qhb);
4344
* qhb.awaitCompletion();
4445
* dataMovementManager.stopJob(ticket);
46+
*}</pre>
4547
*
4648
* @param batch the batch of uris and some metadata about the current status of the job
4749
*/

src/main/java/com/marklogic/client/datamovement/Batcher.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public interface Batcher {
4545
String getJobId();
4646

4747
/**
48-
* The size of each batch (usually 50-500). With some experimentation with
48+
* <p>The size of each batch (usually 50-500). With some experimentation with
4949
* your custom job, this value can be tuned. Tuning this value is one of the
50-
* best ways to achieve optimal throughput.
50+
* best ways to achieve optimal throughput.</p>
5151
*
52-
* This method cannot be called after the job has started.
52+
* <p>This method cannot be called after the job has started.</p>
5353
*
5454
* @param batchSize the batch size -- must be 1 or greater
5555
* @return this instance (for method chaining)
@@ -62,15 +62,15 @@ public interface Batcher {
6262
int getBatchSize();
6363

6464
/**
65-
* The number of threads to be used internally by this job to perform
65+
* <p>The number of threads to be used internally by this job to perform
6666
* concurrent tasks on batches (usually &gt; 10). With some experimentation with your custom
6767
* job and client environment, this value can be tuned. Tuning this value is
6868
* one of the best ways to achieve optimal throughput or to throttle the
6969
* server resources used by this job. Setting this to 1 does not guarantee
7070
* that batches will be processed sequentially because the calling thread
71-
* will sometimes also process batches.
71+
* will sometimes also process batches.</p>
7272
*
73-
* This method cannot be called after the job has started.
73+
* <p>This method cannot be called after the job has started.</p>
7474
*
7575
* @param threadCount the number of threads to use in this Batcher
7676
*

src/main/java/com/marklogic/client/datamovement/DataMovementManager.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import java.util.Iterator;
2727

2828
/**
29-
* DataMovementManager is the starting point for getting new instances of
29+
* <p>DataMovementManager is the starting point for getting new instances of
3030
* QueryBatcher and WriteBatcher, configured with a DatabaseClient and
3131
* ForestConfiguration. On instantiation, it will immediately call
3232
* readForestConfig to obtain the ForestConfiguration from which it can create
@@ -36,16 +36,18 @@
3636
* the port in the DatabaseClient. Call {@link #release()
3737
* dataMovementMangaer.release()} when you're done with your
3838
* DataMovementManager instance to free resources associated with those
39-
* host-specific DatabaseClient instances.
39+
* host-specific DatabaseClient instances.</p>
4040
*
4141
* Sample Usage:
4242
*
43+
* <pre>{@code
4344
* DataMovementManager dataMovementManager = databaseClient.newDataMovementManager();
4445
* WriteBatcher batcher = dataMovementManager.newWriteBatcher();
4546
* dataMovementManager.startJob(batcher);
4647
* . . .
4748
* dataMovementManager.stopJob(batcher);
4849
* dataMovementManager.release();
50+
*}</pre>
4951
*/
5052
public interface DataMovementManager {
5153
/** Calls release() on all host-specific DatabaseClient instances (but not on
@@ -159,17 +161,16 @@ public interface DataMovementManager {
159161
public QueryBatcher newQueryBatcher(RawCombinedQueryDefinition query);
160162

161163
/**
162-
* Create a new QueryBatcher instance configured to retrieve uris from this
164+
* <p>Create a new QueryBatcher instance configured to retrieve uris from this
163165
* Iterator. This form enables the uris (actually any String) to come from
164166
* any source, whereas the other form requires the uris to come from the
165167
* results of a query. This form is helpful when deleting documents when one
166-
* cannot set the server's [merge timestamp][]. For more discussion, see
167-
* {@link QueryBatcher}.
168+
* cannot set the server's
169+
* <a href="https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468">merge timestamp</a>.
170+
* For more discussion, see {@link QueryBatcher}.</p>
168171
*
169-
* The Iterator needn't be thread-safe as it is only iterated from one
170-
* thread.
171-
*
172-
* [merge timestamp]: https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468
172+
* <p>The Iterator needn't be thread-safe as it is only iterated from one
173+
* thread.</p>
173174
*
174175
* @param iterator the provider of uris
175176
*

src/main/java/com/marklogic/client/datamovement/DeleteListener.java

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,46 @@
2222
import java.util.List;
2323

2424
/**
25-
* Sends a Java API bulk {@link com.marklogic.client.document.DocumentManager#delete(String...) delete}
25+
* <p>Sends a Java API bulk {@link com.marklogic.client.document.DocumentManager#delete(String...) delete}
2626
* request for all the documents from each batch. Because it deletes
27-
* documents, it should only be used when:
27+
* documents, it should only be used when:</p>
2828
*
29-
* 1. [merge timestamp][] is enabled and
30-
* {@link QueryBatcher#withConsistentSnapshot} is called, or
31-
* 2. {@link DataMovementManager#newQueryBatcher(Iterator)
32-
* newQueryBatcher(Iterator&lt;String&gt;)} is used to traverse a static data set
29+
* <ol>
30+
* <li><a href="https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468">merge timestamp</a>
31+
* is enabled and {@link QueryBatcher#withConsistentSnapshot} is called, or</li>
32+
* <li>{@link DataMovementManager#newQueryBatcher(Iterator)
33+
* newQueryBatcher(Iterator&lt;String&gt;)} is used to traverse a static data set</li>
34+
* </ol>
3335
*
34-
* [merge timestamp]: https://docs.marklogic.com/guide/app-dev/point_in_time#id_32468
35-
*
36-
* When merge timestamp is enabled, pass a DeleteListener instance to
36+
* <br>When merge timestamp is enabled, pass a DeleteListener instance to
3737
* QueryBatcher onUrisReady like so:
3838
*
39+
* <pre>{@code
3940
* QueryBatcher deleteBatcher = moveMgr.newQueryBatcher(query)
4041
* .onUrisReady(new DeleteListener())
4142
* .withConsistentSnapshot();
4243
* JobTicket ticket = moveMgr.startJob(deleteBatcher);
4344
* deleteBatcher.awaitCompletion();
4445
* moveMgr.stopJob(ticket);
46+
*}</pre>
4547
*
4648
* With Iterator&lt;String&gt;, pass a DeleteListener instance to
4749
* QueryBatcher onUrisReady like so:
4850
*
51+
* <pre>{@code
4952
* QueryBatcher deleteBatcher = moveMgr.newQueryBatcher(query)
5053
* .onUrisReady(new DeleteListener());
5154
* JobTicket ticket = moveMgr.startJob(deleteBatcher);
5255
* deleteBatcher.awaitCompletion();
5356
* moveMgr.stopJob(ticket);
57+
*}</pre>
5458
*
55-
* As with all the provided listeners, this listener will not meet the needs of
56-
* all applications but the [source code][] for it should serve as helpful sample
57-
* code so you can write your own custom listeners.
58-
*
59-
* [source code]: https://github.com/marklogic/java-client-api/blob/develop/src/main/java/com/marklogic/client/datamovement/DeleteListener.java
60-
*/
59+
* <p>As with all the provided listeners, this listener will not meet the needs
60+
* of all applications but the
61+
* <a target="_blank" href="https://github.com/marklogic/java-client-api/blob/develop/src/main/java/com/marklogic/client/datamovement/DeleteListener.java">source code</a>
62+
* for it should serve as helpful sample code so you can write your own custom
63+
* listeners.</p>
64+
*/
6165
public class DeleteListener implements QueryBatchListener {
6266
private static Logger logger = LoggerFactory.getLogger(DeleteListener.class);
6367
private List<BatchFailureListener<Batch<String>>> failureListeners = new ArrayList<>();
@@ -68,6 +72,11 @@ public DeleteListener() {
6872
"if you see this once/batch, fix your job configuration");
6973
}
7074

75+
/**
76+
* This implementation of initializeListener adds this instance of
77+
* DeleteListener to the two RetryListener's in this QueryBatcher so they
78+
* will retry any batches that fail during the delete request.
79+
*/
7180
@Override
7281
public void initializeListener(QueryBatcher queryBatcher) {
7382
HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);

src/main/java/com/marklogic/client/datamovement/ExportListener.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,39 +34,41 @@
3434
import java.util.Set;
3535

3636
/**
37-
* Reads document contents (and optionally metadata) for each batch, then sends
37+
* <p>Reads document contents (and optionally metadata) for each batch, then sends
3838
* each document to any listeners registered with {@link #onDocumentReady
3939
* onDocumentReady} for further processing or writing to any target supported
4040
* by Java. Supports reading partial documents via transforms. Supports
4141
* exporting all documents at a consistent point-in-time using
42-
* withConsistentSnapshot.
42+
* withConsistentSnapshot.</p>
4343
*
4444
* For example:
4545
*
46+
* <pre>{@code
4647
* QueryBatcher exportBatcher = moveMgr.newQueryBatcher(query)
4748
* .withConsistentSnapshot()
4849
* .onUrisReady(
4950
* new ExportListener()
50-
* .withConsistentSnapshot()
51-
* .onDocumentReady(doc -&gt; {
52-
* logger.debug("Contents=[{}]", doc.getContentAs(String.class));
53-
* })
51+
* .withConsistentSnapshot()
52+
* .onDocumentReady(doc -> {
53+
* logger.debug("Contents=[{}]", doc.getContentAs(String.class));
54+
* })
5455
* )
55-
* .onQueryFailure(exception -&gt; exception.printStackTrace());
56+
* .onQueryFailure(exception -> exception.printStackTrace());
5657
*
5758
* JobTicket ticket = moveMgr.startJob(exportBatcher);
5859
* exportBatcher.awaitCompletion();
5960
* moveMgr.stopJob(ticket);
61+
*}</pre>
6062
*
61-
* By default only document contents are retrieved. If you would also like
63+
* <p>By default only document contents are retrieved. If you would also like
6264
* metadata, make sure to call {@link #withMetadataCategory withMetadataCategory}
63-
* to configure which categories of metadata you desire.
65+
* to configure which categories of metadata you desire.</p>
6466
*
65-
* As with all the provided listeners, this listener will not meet the needs of
66-
* all applications but the [source code][] for it should serve as helpful sample
67-
* code so you can write your own custom listeners.
68-
*
69-
* [source code]: https://github.com/marklogic/java-client-api/blob/master/src/main/java/com/marklogic/client/datamovement/ExportListener.java
67+
* <p>As with all the provided listeners, this listener will not meet the needs
68+
* of all applications but the
69+
* <a target="_blank" href="https://github.com/marklogic/java-client-api/blob/develop/src/main/java/com/marklogic/client/datamovement/ExportListener.java">source code</a>
70+
* for it should serve as helpful sample code so you can write your own custom
71+
* listeners.</p>
7072
*/
7173
public class ExportListener implements QueryBatchListener {
7274
private static Logger logger = LoggerFactory.getLogger(ExportListener.class);
@@ -96,6 +98,11 @@ protected DocumentPage getDocs(QueryBatch batch) {
9698
}
9799
}
98100

101+
/**
102+
* This implementation of initializeListener adds this instance of
103+
* ExportListener to the two RetryListener's in this QueryBatcher so they
104+
* will retry any batches that fail during the read request.
105+
*/
99106
@Override
100107
public void initializeListener(QueryBatcher queryBatcher) {
101108
HostAvailabilityListener hostAvailabilityListener = HostAvailabilityListener.getInstance(queryBatcher);

0 commit comments

Comments
 (0)