1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1515 */
16- package com .marklogic .client .example . cookbook . datamovement ;
16+ package com .marklogic .client .datamovement ;
1717
1818import java .io .IOException ;
1919import java .util .ArrayList ;
2929import com .fasterxml .jackson .core .JsonParser ;
3030import com .fasterxml .jackson .core .JsonToken ;
3131import com .marklogic .client .MarkLogicIOException ;
32- import com .marklogic .client .datamovement .BatchFailureListener ;
33- import com .marklogic .client .datamovement .QueryBatchListener ;
34- import com .marklogic .client .datamovement .QueryBatch ;
35- import com .marklogic .client .datamovement .QueryBatcher ;
3632import com .marklogic .client .expression .PlanBuilder ;
3733import com .marklogic .client .io .JacksonParserHandle ;
3834import com .marklogic .client .io .StringHandle ;
5450 * <pre>{@code
5551 * StructuredQueryDefinition query = new StructuredQueryBuilder().directory(1, "/employees/");
5652 * QueryBatcher qb = moveMgr.newQueryBatcher(query)
57- * .onUrisReady(new ExtractViaTemplateListener ().withTemplate(templateUri).onTypedRowReady(row -> {
53+ * .onUrisReady(new ExtractRowsViaTemplateListener ().withTemplate(templateUri).onTypedRowReady(row -> {
5854 * System.out.println("row:" + row);
5955 * }));
6056 * moveMgr.startJob(qb);
8581 * emitted by the rows. Also, the templates should emit only rows and not
8682 * triples.
8783 */
88- public class ExtractViaTemplateListener implements QueryBatchListener , AutoCloseable {
84+ public class ExtractRowsViaTemplateListener implements QueryBatchListener , AutoCloseable {
8985 private static Logger logger =
90- LoggerFactory .getLogger (ExtractViaTemplateListener .class );
86+ LoggerFactory .getLogger (ExtractRowsViaTemplateListener .class );
9187 private List <String > templateUris = new ArrayList <>();
9288 private String templateDb ;
9389 private List <Consumer <TypedRow >> rowListeners = new ArrayList <>();
9490 private List <BatchFailureListener <QueryBatch >> failureListeners = new ArrayList <>();
9591 private PlanBuilder pb ;
9692
97- public ExtractViaTemplateListener () {
98- logger .debug ("new ExtractViaTemplateListener - this should print once/job; " +
93+ public ExtractRowsViaTemplateListener () {
94+ logger .debug ("new ExtractRowsViaTemplateListener - this should print once/job; " +
9995 "if you see this once/batch, fix your job configuration" );
10096 }
10197
@@ -106,12 +102,12 @@ public ExtractViaTemplateListener() {
106102 * @param templateUri the uri of the template to be applied to each batch.
107103 * @return the instance for chaining
108104 */
109- public ExtractViaTemplateListener withTemplate (String templateUri ) {
105+ public ExtractRowsViaTemplateListener withTemplate (String templateUri ) {
110106 this .templateUris .add (templateUri );
111107 return this ;
112108 }
113109
114- private ExtractViaTemplateListener withTemplateDatabase (String templateDatabase ) {
110+ private ExtractRowsViaTemplateListener withTemplateDatabase (String templateDatabase ) {
115111 this .templateDb = templateDatabase ;
116112 return this ;
117113 }
@@ -123,7 +119,7 @@ private ExtractViaTemplateListener withTemplateDatabase(String templateDatabase)
123119 * @param listener the listener which needs to be applied to each row
124120 * @return the instance for chaining
125121 */
126- public ExtractViaTemplateListener onTypedRowReady (Consumer <TypedRow > listener ) {
122+ public ExtractRowsViaTemplateListener onTypedRowReady (Consumer <TypedRow > listener ) {
127123 rowListeners .add (listener );
128124 return this ;
129125 }
@@ -136,7 +132,7 @@ public ExtractViaTemplateListener onTypedRowReady(Consumer<TypedRow> listener) {
136132 *
137133 * @return this instance for method chaining
138134 */
139- public ExtractViaTemplateListener onFailure (BatchFailureListener <QueryBatch > listener ) {
135+ public ExtractRowsViaTemplateListener onFailure (BatchFailureListener <QueryBatch > listener ) {
140136 failureListeners .add (listener );
141137 return this ;
142138 }
@@ -147,7 +143,7 @@ public void initializeListener(QueryBatcher queryBatcher) {
147143 }
148144
149145 /**
150- * This is the method QueryBatcher calls for ExtractViaTemplateListener to do
146+ * This is the method QueryBatcher calls for ExtractRowsViaTemplateListener to do
151147 * its thing. You should not need to call it.
152148 *
153149 * @param batch the batch of uris and some metadata about the current status
0 commit comments