Skip to content

Commit df4ba2d

Browse files
committed
Merge branch 'release-3.0.0-EA2'
2 parents b532dc3 + f7c692b commit df4ba2d

File tree

362 files changed

+44177
-431
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

362 files changed

+44177
-431
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ mvn test
2727
The following resources introduce and document the Java API:
2828

2929
* [The Java API in Five Minutes](http://developer.marklogic.com/try/java/index)
30-
* [JavaDoc](http://docs.marklogic.com/guide/java)
31-
* [User Guide](http://docs.marklogic.com/javadoc/client/index.html)
30+
* [Java Application Developer's Guide](http://docs.marklogic.com/guide/java)
31+
* [JavaDoc](http://docs.marklogic.com/javadoc/client/index.html)
3232

3333
### Installing
3434

pom.xml

+75-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,22 @@
44
<groupId>com.marklogic</groupId>
55
<artifactId>client-api-java</artifactId>
66
<packaging>jar</packaging>
7-
<version>3.0-SNAPSHOT</version>
7+
<version>3.0.0-EA2</version>
88
<name>client-api-java</name>
99
<url>http://developer.marklogic.com</url>
1010
<properties>
1111
<javadoc-title>${project.name} 2.0 ${maven.build.timestamp}</javadoc-title>
1212
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
1313
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
14+
<github.global.server>github</github.global.server>
1415
</properties>
16+
<distributionManagement>
17+
<repository>
18+
<id>internal.repo</id>
19+
<name>Temporary Staging Repository</name>
20+
<url>file://${project.build.directory}/mvn-repo</url>
21+
</repository>
22+
</distributionManagement>
1523
<build>
1624
<plugins>
1725
<plugin>
@@ -120,6 +128,37 @@
120128
</execution>
121129
</executions>
122130
</plugin>
131+
<plugin>
132+
<artifactId>maven-deploy-plugin</artifactId>
133+
<version>2.8.1</version>
134+
<configuration>
135+
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository>
136+
</configuration>
137+
</plugin>
138+
<plugin>
139+
<groupId>com.github.github</groupId>
140+
<artifactId>site-maven-plugin</artifactId>
141+
<version>0.9</version>
142+
<configuration>
143+
<message>Maven artifacts for ${project.version}</message>
144+
<merge>true</merge>
145+
<noJekyll>true</noJekyll>
146+
<outputDirectory>${project.build.directory}/mvn-repo</outputDirectory>
147+
<branch>refs/heads/mvn-repo</branch>
148+
<includes><include>**/*</include></includes>
149+
<repositoryName>java-client-api</repositoryName>
150+
<repositoryOwner>marklogic</repositoryOwner>
151+
</configuration>
152+
<executions>
153+
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
154+
<execution>
155+
<goals>
156+
<goal>site</goal>
157+
</goals>
158+
<phase>deploy</phase>
159+
</execution>
160+
</executions>
161+
</plugin>
123162
</plugins>
124163
</build>
125164
<dependencies>
@@ -174,10 +213,20 @@
174213
<artifactId>slf4j-api</artifactId>
175214
<version>1.7.4</version>
176215
</dependency>
216+
<dependency>
217+
<groupId>com.fasterxml.jackson.core</groupId>
218+
<artifactId>jackson-core</artifactId>
219+
<version>2.4.1</version>
220+
</dependency>
221+
<dependency>
222+
<groupId>com.fasterxml.jackson.core</groupId>
223+
<artifactId>jackson-annotations</artifactId>
224+
<version>2.4.1</version>
225+
</dependency>
177226
<dependency>
178227
<groupId>com.fasterxml.jackson.core</groupId>
179228
<artifactId>jackson-databind</artifactId>
180-
<version>2.2.1</version>
229+
<version>2.4.1</version>
181230
</dependency>
182231
<!-- test dependencies -->
183232
<dependency>
@@ -229,5 +278,29 @@
229278
<version>2.3</version>
230279
<scope>provided</scope>
231280
</dependency>
281+
<dependency>
282+
<groupId>org.geonames</groupId>
283+
<artifactId>geonames</artifactId>
284+
<version>1.0</version>
285+
<scope>provided</scope>
286+
</dependency>
287+
<dependency>
288+
<groupId>com.fasterxml.jackson.dataformat</groupId>
289+
<artifactId>jackson-dataformat-xml</artifactId>
290+
<version>2.4.1</version>
291+
<scope>test</scope>
292+
</dependency>
293+
<dependency>
294+
<groupId>com.fasterxml.jackson.dataformat</groupId>
295+
<artifactId>jackson-dataformat-csv</artifactId>
296+
<version>2.4.1</version>
297+
<scope>test</scope>
298+
</dependency>
299+
<dependency>
300+
<groupId>com.google.guava</groupId>
301+
<artifactId>guava</artifactId>
302+
<version>16.0.1</version>
303+
<scope>test</scope>
304+
</dependency>
232305
</dependencies>
233306
</project>

src/main/java/com/marklogic/client/DatabaseClient.java

+15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.marklogic.client;
1717

1818
import java.io.OutputStream;
19+
import java.io.Serializable;
1920

2021
import com.marklogic.client.admin.ServerConfigurationManager;
2122
import com.marklogic.client.document.BinaryDocumentManager;
@@ -28,6 +29,7 @@
2829
import com.marklogic.client.query.QueryManager;
2930
import com.marklogic.client.alerting.RuleManager;
3031
import com.marklogic.client.util.RequestLogger;
32+
import com.marklogic.client.pojo.PojoRepository;
3133

3234
/**
3335
* A Database Client instantiates document and query managers and other objects
@@ -110,6 +112,19 @@ public interface DatabaseClient {
110112
*/
111113
public ServerConfigurationManager newServerConfigManager();
112114

115+
/**
116+
* Creates a PojoRepository specific to the specified class and its id type.
117+
* The PojoRepository provides a facade for persisting, retrieving, and
118+
* querying data contained in Java objects. Annotations are required to
119+
* identify the id field and any fields for which you wish to create indexes.
120+
*
121+
* @param clazz the class type for this PojoRepository to handle
122+
* @param idClass the class type of the id field for this clazz, must obviously
123+
* be Serializable or we'll struggle to marshall it
124+
* @return the initialized PojoRepository
125+
**/
126+
public <T, ID extends Serializable> PojoRepository<T, ID> newPojoRepository(Class<T> clazz, Class<ID> idClass);
127+
113128
/**
114129
* Initializes a manager for a extension resource.
115130
*

src/main/java/com/marklogic/client/Page.java

+49
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,66 @@
1717

1818
import java.util.Iterator;
1919

20+
/** A generic interface for pagination through large sets of items of type &lt;T&gt;. */
2021
public interface Page<T> extends Iterable<T> {
22+
/** An iterator over the items in this page. */
2123
public Iterator<T> iterator();
24+
25+
/** The start position of this page within all possible items. For result sets
26+
* this is the position of the first result within the result set.
27+
* @return the start position
28+
*/
2229
public long getStart();
30+
31+
/** The page size which is the maximum number of items allowed in one page.
32+
* @return the page size */
2333
public long getPageSize();
34+
35+
/** The total count (potentially an estimate) of all possible items in the set.
36+
* For result sets this is the number of items within the result set.
37+
* For search result sets this is the estimated number of matching items.
38+
* @return the total count of possible items */
2439
public long getTotalSize();
40+
41+
/** The count of items in this page, which is always less than getPageSize().
42+
* If ({@link #getTotalSize()} - {@link #getStart()}) &gt; {@link #getPageSize()}
43+
* then size() == getPageSize().
44+
* @return the count of items in this page
45+
*/
2546
public long size();
47+
48+
49+
/** The number of pages covering all possible items.
50+
* @return the number of pages. Literally,
51+
* <pre>{@code (long) Math.ceil((double) getTotalSize() / (double) getPageSize()); }</pre>
52+
*/
2653
public long getTotalPages();
54+
55+
/** Whether there are any items in this page.
56+
* @return true if {@code size() > 0; }
57+
*/
2758
public boolean hasContent();
59+
60+
/** Whether there are any items in the next page.
61+
* @return true if {@code getPageNumber() < getTotalPages(); }
62+
*/
2863
public boolean hasNextPage();
64+
65+
/** Whether there is a previous page.
66+
* @return true if {@code getPageNumber() > 0 }
67+
*/
2968
public boolean hasPreviousPage();
69+
70+
/** The page number within the count of all possible pages.
71+
* @return {@code (long) Math.floor((double) start / (double) getPageSize()) + 1; }
72+
*/
3073
public long getPageNumber();
74+
75+
/** @return true if {@code getPageNumber() == 1 }
76+
*/
3177
public boolean isFirstPage();
78+
79+
/** @return true if {@code getPageNumber() == getTotalPages() }
80+
*/
3281
public boolean isLastPage();
3382
}

src/main/java/com/marklogic/client/admin/config/QueryOptions.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@
4949
* {@link com.marklogic.client.io.marker.StructureReadHandle read handle}
5050
* implementation instead of this class to write or read
5151
* query options. For instance:
52-
* <pre>String opts = new StringBuilder()
53-
* .append("&lt;options xmlns=\"http://marklogic.com/appservices/search\">")
54-
* .append( "&lt;debug>true&lt;/debug>")
55-
* .append("&lt;/options>")
56-
* .toString();
57-
*optsMgr.writeOptions("debug", new StringHandle(opts));</pre>
52+
* <pre>{@code
53+
* String opts = new StringBuilder()
54+
* .append("<options xmlns=\"http://marklogic.com/appservices/search\">")
55+
* .append( "<debug>true</debug>")
56+
* .append("</options>")
57+
* .toString();
58+
* optsMgr.writeOptions("debug", new StringHandle(opts)); }</pre>
5859
* or
59-
* <pre>String opts = "{\"options\":{\"debug\":true}}";
60-
*optsMgr.writeOptions("debug", new StringHandle(opts).withFormat(Format.JSON));</pre>
60+
* <pre>{@code
61+
* String opts = "{\"options\":{\"debug\":true}}";
62+
* optsMgr.writeOptions("debug", new StringHandle(opts).withFormat(Format.JSON)); }</pre>
6163
*/
6264
@Deprecated
6365
@XmlAccessorType(XmlAccessType.FIELD)

src/main/java/com/marklogic/client/admin/config/QueryOptionsBuilder.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,17 @@
9494
* {@link com.marklogic.client.io.marker.StructureReadHandle read handle}
9595
* implementation instead of this class to write or read
9696
* query options. For instance:
97-
* <pre>String opts = new StringBuilder()
98-
* .append("&lt;options xmlns=\"http://marklogic.com/appservices/search\">")
99-
* .append( "&lt;debug>true&lt;/debug>")
100-
* .append("&lt;/options>")
101-
* .toString();
102-
*optsMgr.writeOptions("debug", new StringHandle(opts));</pre>
97+
* <pre>{@code
98+
* String opts = new StringBuilder()
99+
* .append("<options xmlns=\"http://marklogic.com/appservices/search\">")
100+
* .append( "<debug>true</debug>")
101+
* .append("</options>")
102+
* .toString();
103+
* optsMgr.writeOptions("debug", new StringHandle(opts)); }</pre>
103104
* or
104-
* <pre>String opts = "{\"options\":{\"debug\":true}}";
105-
*optsMgr.writeOptions("debug", new StringHandle(opts).withFormat(Format.JSON));</pre>
105+
* <pre>{@code
106+
* String opts = "{\"options\":{\"debug\":true}}";
107+
* optsMgr.writeOptions("debug", new StringHandle(opts).withFormat(Format.JSON)); }</pre>
106108
*/
107109
@Deprecated
108110
public class QueryOptionsBuilder {

src/main/java/com/marklogic/client/document/DocumentManager.java

+53
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import com.marklogic.client.io.marker.DocumentPatchHandle;
3131
import com.marklogic.client.io.marker.SearchReadHandle;
3232
import com.marklogic.client.query.QueryDefinition;
33+
import com.marklogic.client.query.QueryManager.QueryView;
3334

3435
/**
3536
* A Document Manager provides database operations on a document.
@@ -367,14 +368,58 @@ public <T extends R> T read(DocumentDescriptor desc, DocumentMetadataReadHandle
367368
public <T extends R> T read(DocumentDescriptor desc, DocumentMetadataReadHandle metadataHandle, T contentHandle, ServerTransform transform, Transaction transaction)
368369
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException;
369370

371+
/**
372+
* Reads from the database a list of documents matching the provided uris. Allows
373+
* iteration across matching documents and metadata (only if setMetadataCategories
374+
* has been called to request metadata). To find out how many of your uris matched,
375+
* call the {@link DocumentPage#size() DocumentPage.size()} method.
376+
*
377+
* @param uris the database uris identifying documents to retrieve
378+
* @return the DocumentPage of matching documents and metadata
379+
*/
370380
public DocumentPage read(String... uris);
371381

382+
/**
383+
* Reads from the database a list of documents matching the provided uris. Allows
384+
* iteration across matching documents and metadata (only if setMetadataCategories
385+
* has been called to request metadata). To find out how many of your uris matched,
386+
* call the {@link DocumentPage#size() DocumentPage.size()} method.
387+
*
388+
* @param transform the transform to be run on the server on each document (must already be installed)
389+
* @param uris the database uris identifying documents to retrieve
390+
* @return the DocumentPage of matching documents and metadata
391+
*/
372392
public DocumentPage read(ServerTransform transform, String... uris);
373393

394+
/**
395+
* Reads from the database a list of documents matching the provided uris. Allows
396+
* iteration across matching documents and metadata (only if setMetadataCategories
397+
* has been called to request metadata). To find out how many of your uris matched,
398+
* call the {@link DocumentPage#size() DocumentPage.size()} method.
399+
*
400+
* @param transaction the transaction in which this read is participating
401+
* @param uris the database uris identifying documents to retrieve
402+
* @return the DocumentPage of matching documents and metadata
403+
*/
374404
public DocumentPage read(Transaction transaction, String... uris);
375405

406+
/**
407+
* Reads from the database a list of documents matching the provided uris. Allows
408+
* iteration across matching documents and metadata (only if setMetadataCategories
409+
* has been called to request metadata). To find out how many of your uris matched,
410+
* call the {@link DocumentPage#size() DocumentPage.size()} method.
411+
*
412+
* @param transform the transform to be run on the server on each document (must already be installed)
413+
* @param transaction the transaction in which this read is participating
414+
* @param uris the database uris identifying documents to retrieve
415+
* @return the DocumentPage of matching documents and metadata
416+
*/
376417
public DocumentPage read(ServerTransform transform, Transaction transaction, String... uris);
377418

419+
public DocumentPage readMetadata(String... uris);
420+
421+
public DocumentPage readMetadata(Transaction transaction, String... uris);
422+
378423
public DocumentPage search(QueryDefinition querydef, long start);
379424

380425
public DocumentPage search(QueryDefinition querydef, long start, Transaction transaction);
@@ -387,6 +432,14 @@ public <T extends R> T read(DocumentDescriptor desc, DocumentMetadataReadHandle
387432

388433
public void setPageLength(long length);
389434

435+
public Format getResponseFormat();
436+
437+
public void setResponseFormat(Format format);
438+
439+
public QueryView getSearchView();
440+
441+
public void setSearchView(QueryView view);
442+
390443
public DocumentWriteSet newWriteSet();
391444

392445
public void write(DocumentWriteSet writeSet);

src/main/java/com/marklogic/client/document/DocumentPatchBuilder.java

+30
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,36 @@ public String toString() {
5757
}
5858
}
5959

60+
61+
/**
62+
* MarkLogic's REST API patch operations support two path languages for JSON,
63+
* XPATH and JSONPATH. Default for MarkLogic 8 is XPATH,
64+
* but you can use the backwards-compatible JSONPATH too.
65+
*/
66+
public enum PathLanguage {
67+
68+
/**
69+
* Indicates that the given patch uses the XPATH language.
70+
*/
71+
XPATH,
72+
73+
/**
74+
* Indicates that the given patch uses the JSONPATH language.
75+
*/
76+
JSONPATH;
77+
78+
@Override
79+
public String toString() {
80+
return super.toString().toLowerCase();
81+
};
82+
83+
}
84+
85+
/**
86+
* Specifies the language for this patch to use
87+
*/
88+
public DocumentPatchBuilder pathLanguage(PathLanguage pathLang);
89+
6090
/**
6191
* Specifies an operation to delete an existing JSON or XML fragment.
6292
* @param selectPath the location of the JSON or XML fragment

0 commit comments

Comments
 (0)