Skip to content

Commit 650eba3

Browse files
Ajit GeorgeAjit George
Ajit George
authored and
Ajit George
committed
Merge branch 'release-3.0.4' into 3.0-master
2 parents 991b8c9 + 85426d4 commit 650eba3

File tree

234 files changed

+1342414
-2575
lines changed

Some content is hidden

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

234 files changed

+1342414
-2575
lines changed

.classpath

+32-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,32 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<classpath>
3-
<classpathentry kind="src" output="target/classes" path="src/main/java">
4-
<attributes>
5-
<attribute name="optional" value="true"/>
6-
<attribute name="maven.pomderived" value="true"/>
7-
</attributes>
8-
</classpathentry>
9-
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10-
<attributes>
11-
<attribute name="optional" value="true"/>
12-
<attribute name="maven.pomderived" value="true"/>
13-
</attributes>
14-
</classpathentry>
15-
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
16-
<attributes>
17-
<attribute name="maven.pomderived" value="true"/>
18-
</attributes>
19-
</classpathentry>
20-
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21-
<attributes>
22-
<attribute name="maven.pomderived" value="true"/>
23-
</attributes>
24-
</classpathentry>
25-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
26-
<attributes>
27-
<attribute name="maven.pomderived" value="true"/>
28-
</attributes>
29-
</classpathentry>
30-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
31-
<attributes>
32-
<attribute name="maven.pomderived" value="true"/>
33-
</attributes>
34-
</classpathentry>
35-
<classpathentry kind="output" path="target/classes"/>
36-
</classpath>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
10+
<attributes>
11+
<attribute name="optional" value="true"/>
12+
<attribute name="maven.pomderived" value="true"/>
13+
</attributes>
14+
</classpathentry>
15+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
16+
<attributes>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry kind="src" output="target/test-classes" path="src/test/resources">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
26+
<attributes>
27+
<attribute name="maven.pomderived" value="true"/>
28+
</attributes>
29+
</classpathentry>
30+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
31+
<classpathentry kind="output" path="target/classes"/>
32+
</classpath>

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ test-complete/build/
77
*.jar
88
*.war
99
*.ear
10+
.classpath
11+
.gitignore

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ The Java API supports the following core features of the MarkLogic database:
2626

2727
For more details, please read this [deeper dive](http://developer.marklogic.com/features/java-client-api-2)
2828

29+
### What's New in Java Client API 3.0.2
30+
31+
* Many bug fixes
32+
33+
### What's New in Java Client API 3.0.3
34+
35+
* Search Extract - add support to SearchHandle (actually MatchDocumentSummary) for content extracted by
36+
the [extract-document-data option](http://docs.marklogic.com/search:search#opt-extract-document-data)
37+
* Bi-Temporal enhancements - support bulk write of bitemporal documents; expose bitemporal system time
38+
* Bulk delete
39+
40+
### What's New in Java Client API 3.0.4
41+
42+
* Semantics API - GraphManager for CRUD of semantic graphs; SPARQLQueryManager for executing SPARQL
43+
queries (select, describe, construct, and ask) and using SPARQL Update
44+
* Enable [MarkLogic Jena API](https://github.com/marklogic/marklogic-jena) (separate project)
45+
* Enable [MarkLogic Sesame API](https://github.com/marklogic/marklogic-sesame) (separate project)
46+
2947
### QuickStart
3048

3149
To use the API in your maven project, include the following in your pom.xml:

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>com.marklogic</groupId>
55
<artifactId>java-client-api</artifactId>
66
<packaging>jar</packaging>
7-
<version>3.0.3</version>
7+
<version>3.0.4</version>
88
<name>MarkLogic Java Client API</name>
99
<description>The official MarkLogic Java client API.</description>
1010
<url>https://github.com/marklogic/java-client-api</url>

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

+8
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import com.marklogic.client.alerting.RuleManager;
3232
import com.marklogic.client.util.RequestLogger;
3333
import com.marklogic.client.pojo.PojoRepository;
34+
import com.marklogic.client.semantics.GraphManager;
35+
import com.marklogic.client.semantics.SPARQLQueryManager;
3436

3537
/**
3638
* A Database Client instantiates document and query managers and other objects
@@ -113,6 +115,12 @@ public interface DatabaseClient {
113115
*/
114116
public ServerConfigurationManager newServerConfigManager();
115117

118+
/** Creates a manager for CRUD operations on semantic graphs. */
119+
public GraphManager newGraphManager();
120+
121+
/** Creates a manager for executing SPARQL queries and retrieving results. */
122+
public SPARQLQueryManager newSPARQLQueryManager();
123+
116124
/**
117125
* Creates a PojoRepository specific to the specified class and its id type.
118126
* The PojoRepository provides a facade for persisting, retrieving, and

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

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

18+
import java.io.IOException;
19+
1820
import com.marklogic.client.impl.FailedRequest;
1921

2022
/**
@@ -29,7 +31,12 @@ public FailedRequestException(String message) {
2931
super(message);
3032
}
3133

34+
public FailedRequestException(String localMessage, Throwable cause) {
35+
super(localMessage, cause);
36+
}
37+
3238
public FailedRequestException(String localMessage, FailedRequest failedRequest) {
3339
super(localMessage, failedRequest);
3440
}
41+
3542
}

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

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public MarkLogicServerException(String localMessage) {
4545
super(localMessage);
4646
}
4747

48+
public MarkLogicServerException(String localMessage, Throwable cause) {
49+
super(localMessage, cause);
50+
}
51+
4852
@Override
4953
public String getMessage() {
5054
if (super.getMessage() != null && failedRequest != null) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright 2012-2015 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.marklogic.client.bitemporal;
17+
18+
import javax.xml.bind.DatatypeConverter;
19+
import com.marklogic.client.document.DocumentDescriptor;
20+
21+
public interface TemporalDescriptor extends DocumentDescriptor {
22+
/**
23+
* Returns the URI identifier for the database document.
24+
* @return the document URI
25+
*/
26+
public String getUri();
27+
28+
/**
29+
* Returns the temporal system time when the document was written or deleted.
30+
* The time is returned in ISO 8601 format like all MarkLogic timestamps. It
31+
* can be parsed by
32+
* {@link DatatypeConverter#parseDateTime DatatypeConverter.parseDateTime}
33+
* but will lose precision since java.util.Calendar only supports millisecond
34+
* precision.
35+
* @return the temporal system time
36+
*/
37+
public String getTemporalSystemTime();
38+
}

src/main/java/com/marklogic/client/bitemporal/TemporalDocumentManager.java

+48-17
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
import com.marklogic.client.ForbiddenUserException;
2020
import com.marklogic.client.ResourceNotFoundException;
2121
import com.marklogic.client.Transaction;
22+
import com.marklogic.client.bitemporal.TemporalDescriptor;
2223
import com.marklogic.client.document.DocumentDescriptor;
2324
import com.marklogic.client.document.DocumentManager;
2425
import com.marklogic.client.document.DocumentUriTemplate;
26+
import com.marklogic.client.document.DocumentWriteSet;
2527
import com.marklogic.client.document.ServerTransform;
2628
import com.marklogic.client.io.marker.AbstractReadHandle;
2729
import com.marklogic.client.io.marker.AbstractWriteHandle;
@@ -33,7 +35,7 @@ public interface TemporalDocumentManager<R extends AbstractReadHandle, W extends
3335
* Just like {@link DocumentManager#create(DocumentUriTemplate, DocumentMetadataWriteHandle,
3436
* AbstractWriteHandle, ServerTransform, Transaction) create} but create document
3537
* in a temporalCollection, which will enforce all the rules of
36-
* <a href="http://docs.marklogic.com/8.0/guide/concepts/data-management#id_98803">
38+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
3739
* bitemporal data management</a>.
3840
* @param template the template for constructing the document uri
3941
* @param metadataHandle a handle for writing the metadata of the document
@@ -42,9 +44,10 @@ public interface TemporalDocumentManager<R extends AbstractReadHandle, W extends
4244
* @param transaction an open transaction under which the document may have been created or deleted
4345
* @param temporalCollection the name of the temporal collection existing in the database into
4446
* which this document should be written
45-
* @return the database uri that identifies the created document
47+
* @return the TemporalDescriptor including the database uri that identifies the created document,
48+
* as well as the temporal system time when the document was created
4649
*/
47-
public DocumentDescriptor create(DocumentUriTemplate template,
50+
public TemporalDescriptor create(DocumentUriTemplate template,
4851
DocumentMetadataWriteHandle metadataHandle,
4952
W contentHandle,
5053
ServerTransform transform,
@@ -56,7 +59,7 @@ public DocumentDescriptor create(DocumentUriTemplate template,
5659
* Just like {@link DocumentManager#write(DocumentDescriptor, DocumentMetadataWriteHandle,
5760
* AbstractWriteHandle, ServerTransform, Transaction) write} but write document
5861
* in a temporalCollection, which will enforce all the rules of
59-
* <a href="http://docs.marklogic.com/8.0/guide/concepts/data-management#id_98803">
62+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
6063
* bitemporal data management</a>.
6164
* @param desc a descriptor for the URI identifier, format, and mimetype of the document
6265
* @param metadataHandle a handle for writing the metadata of the document
@@ -65,8 +68,9 @@ public DocumentDescriptor create(DocumentUriTemplate template,
6568
* @param transaction an open transaction under which the document may have been created or deleted
6669
* @param temporalCollection the name of the temporal collection existing in the database into
6770
* which this document should be written
71+
* @return the TemporalDescriptor with the temporal system time when the document was written
6872
*/
69-
public void write(DocumentDescriptor desc,
73+
public TemporalDescriptor write(DocumentDescriptor desc,
7074
DocumentMetadataWriteHandle metadataHandle,
7175
W contentHandle,
7276
ServerTransform transform,
@@ -78,7 +82,7 @@ public void write(DocumentDescriptor desc,
7882
* Just like {@link DocumentManager#write(String, DocumentMetadataWriteHandle,
7983
* AbstractWriteHandle, ServerTransform, Transaction) write} but write document
8084
* in a temporalCollection, which will enforce all the rules of
81-
* <a href="http://docs.marklogic.com/8.0/guide/concepts/data-management#id_98803">
85+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
8286
* bitemporal data management</a>.
8387
* @param docId the URI identifier for the document
8488
* @param metadataHandle a handle for writing the metadata of the document
@@ -87,8 +91,9 @@ public void write(DocumentDescriptor desc,
8791
* @param transaction an open transaction under which the document may have been created or deleted
8892
* @param temporalCollection the name of the temporal collection existing in the database into
8993
* which this document should be written
94+
* @return the TemporalDescriptor with the temporal system time when the document was written
9095
*/
91-
public void write(String docId,
96+
public TemporalDescriptor write(String docId,
9297
DocumentMetadataWriteHandle metadataHandle,
9398
W contentHandle,
9499
ServerTransform transform,
@@ -99,29 +104,31 @@ public void write(String docId,
99104
/**
100105
* Just like {@link DocumentManager#delete(DocumentDescriptor, Transaction) delete} but delete
101106
* document in a temporalCollection, which will enforce all the rules of
102-
* <a href="http://docs.marklogic.com/8.0/guide/concepts/data-management#id_98803">
107+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
103108
* bitemporal data management</a>.
104109
* @param desc a descriptor for the URI identifier, format, and mimetype of the document
105110
* @param transaction an open transaction under which the document may have been created or deleted
106111
* @param temporalCollection the name of the temporal collection existing in the database in
107112
* which this document should be marked as deleted
113+
* @return the TemporalDescriptor with the temporal system time when the document was deleted
108114
*/
109-
public void delete(DocumentDescriptor desc,
115+
public TemporalDescriptor delete(DocumentDescriptor desc,
110116
Transaction transaction,
111117
String temporalCollection)
112118
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException;
113119

114120
/**
115121
* Just like {@link DocumentManager#delete(String, Transaction) delete} but delete
116122
* document in a temporalCollection, which will enforce all the rules of
117-
* <a href="http://docs.marklogic.com/8.0/guide/concepts/data-management#id_98803">
123+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
118124
* bitemporal data management</a>.
119125
* @param docId the URI identifier for the document
120126
* @param transaction an open transaction under which the document may have been created or deleted
121127
* @param temporalCollection the name of the temporal collection existing in the database in
122128
* which this document should be marked as deleted
129+
* @return the TemporalDescriptor with the temporal system time when the document was deleted
123130
*/
124-
public void delete(String docId,
131+
public TemporalDescriptor delete(String docId,
125132
Transaction transaction,
126133
String temporalCollection)
127134
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException;
@@ -139,9 +146,10 @@ public void delete(String docId,
139146
* @param temporalCollection the name of the temporal collection existing in the database into
140147
* which this document should be written
141148
* @param systemTime the application-specified system time with which this document will be marked
142-
* @return the database uri that identifies the created document
149+
* @return the database uri that identifies the created document,
150+
* as well as the temporal system time when the document was created
143151
*/
144-
public DocumentDescriptor create(DocumentUriTemplate template,
152+
public TemporalDescriptor create(DocumentUriTemplate template,
145153
DocumentMetadataWriteHandle metadataHandle,
146154
W contentHandle,
147155
ServerTransform transform,
@@ -162,8 +170,9 @@ public DocumentDescriptor create(DocumentUriTemplate template,
162170
* @param temporalCollection the name of the temporal collection existing in the database into
163171
* which this document should be written
164172
* @param systemTime the application-specified system time with which this document will be marked
173+
* @return the TemporalDescriptor with the temporal system time when the document was written
165174
*/
166-
public void write(DocumentDescriptor desc,
175+
public TemporalDescriptor write(DocumentDescriptor desc,
167176
DocumentMetadataWriteHandle metadataHandle,
168177
W contentHandle,
169178
ServerTransform transform,
@@ -184,8 +193,9 @@ public void write(DocumentDescriptor desc,
184193
* @param temporalCollection the name of the temporal collection existing in the database into
185194
* which this document should be written
186195
* @param systemTime the application-specified system time with which this document will be marked
196+
* @return the TemporalDescriptor with the temporal system time when the document was written
187197
*/
188-
public void write(String docId,
198+
public TemporalDescriptor write(String docId,
189199
DocumentMetadataWriteHandle metadataHandle,
190200
W contentHandle,
191201
ServerTransform transform,
@@ -194,6 +204,25 @@ public void write(String docId,
194204
java.util.Calendar systemTime)
195205
throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException;
196206

207+
/**
208+
* Just like {@link DocumentManager#write(DocumentWriteSet, ServerTransform, Transaction)
209+
* write} but create document in a temporalCollection, which will enforce all the rules of
210+
* <a href="http://docs.marklogic.com/guide/temporal/managing">
211+
* bitemporal data management</a>.
212+
* @param writeSet the set of documents and metadata to write
213+
* @param transform a server transform to modify the contents of each document
214+
* @param transaction an open transaction under which the documents will be written
215+
* @param temporalCollection the name of the temporal collection existing in the database into
216+
* which this document should be written
217+
* @see <a href="http://docs.marklogic.com/guide/rest-dev/bulk">REST API -&gt; Reading
218+
* and Writing Multiple Documents</a>
219+
*/
220+
// TODO: do we return something for the temporal system time? is it per-document?
221+
public void write(DocumentWriteSet writeSet,
222+
ServerTransform transform,
223+
Transaction transaction,
224+
String temporalCollection);
225+
197226
/**
198227
* Just like {@link #delete(DocumentDescriptor, Transaction, String) delete} but delete
199228
* document at a specified system time
@@ -202,8 +231,9 @@ public void write(String docId,
202231
* @param temporalCollection the name of the temporal collection existing in the database in
203232
* which this document should be marked as deleted
204233
* @param systemTime the application-specified system time with which this document will be marked
234+
* @return the TemporalDescriptor with the temporal system time when the document was deleted
205235
*/
206-
public void delete(DocumentDescriptor desc,
236+
public TemporalDescriptor delete(DocumentDescriptor desc,
207237
Transaction transaction,
208238
String temporalCollection,
209239
java.util.Calendar systemTime)
@@ -217,8 +247,9 @@ public void delete(DocumentDescriptor desc,
217247
* @param temporalCollection the name of the temporal collection existing in the database in
218248
* which this document should be marked as deleted
219249
* @param systemTime the application-specified system time with which this document will be marked
250+
* @return the TemporalDescriptor with the temporal system time when the document was deleted
220251
*/
221-
public void delete(String docId,
252+
public TemporalDescriptor delete(String docId,
222253
Transaction transaction,
223254
String temporalCollection,
224255
java.util.Calendar systemTime)

0 commit comments

Comments
 (0)