|
1 |
| -# The MarkLogic Java Client API |
2 |
| - |
3 |
| -The API makes it easy to write, read, delete, and find documents |
4 |
| -in a [MarkLogic](http://developer.marklogic.com/) database. |
5 |
| - |
6 |
| -For example: |
7 |
| - |
8 |
| - // write a text, binary, XML, or JSON document from any source with ACID guarantees |
9 |
| - documentManager.write(uri, new FileHandle() |
10 |
| - .with(new File("file1234.json")) |
11 |
| - .withFormat(JSON)); |
12 |
| - |
13 |
| - // read and directly parse to your preferred type, even your own POJOs! |
14 |
| - JsonNode jsonDocContents = documentManager.readAs(uri, JsonNode.class); |
15 |
| - |
16 |
| - // get matches super-fast using full-featured search |
17 |
| - JsonNode results = queryManager.search( |
18 |
| - new StructuredQueryBuilder().term("quick", "brown", "fox"), |
19 |
| - new JacksonHandle()).get(); |
20 |
| - |
21 |
| -The Java API supports the following core features of the MarkLogic database: |
22 |
| - |
23 |
| -* Write and read binary, JSON, text, and XML documents. |
24 |
| -* Query data structure trees, marked-up text, and all the hybrids in between those extremes. |
25 |
| -* Project values, tuples, and triples from hierarchical documents and aggregate over them. |
26 |
| -* Patch documents with partial updates. |
27 |
| -* Use Optimistic Locking to detect contention without creating locks on the server. |
28 |
| -* Execute ACID modifications so the change either succeeds or throws an exception. |
29 |
| -* Execute multi-statement transactions so changes to multiple documents succeed or fail together. |
30 |
| -* Call Data Services by means of a Java interface on the client for data functionality |
31 |
| -implemented by an endpoint on the server. |
32 |
| - |
33 |
| -### What's New in Java Client API 5 |
34 |
| - |
35 |
| -* Splitters for CSV records, for entries in a ZipInputStream, and for line-delimited JSON or XML |
36 |
| -for streaming to WriteBatcher. |
37 |
| -* Support for Bulk IO Data Services to make it easy to implement connectors for dataflow |
38 |
| -frameworks - see https://github.com/marklogic/java-client-api/wiki/Bulk-Data-Services for more |
39 |
| -detail. |
40 |
| - |
41 |
| -### What's New in Java Client API 4 |
42 |
| - |
43 |
| -* Optic API - blends relational with NoSQL by providing joins and aggregates over documents |
44 |
| - * is powered by the new row index and query optimizer |
45 |
| - * uses row, triple, and/or lexicon lenses |
46 |
| - * matches the functionality of the Optic API for XQuery and Javascript, but idiomatic for Java |
47 |
| - developers |
48 |
| -* Data Movement SDK - move large amounts of data into, out of, or within a MarkLogic cluster |
49 |
| - * WriteBatcher distributes writes across many threads and across the entire MarkLogic cluster |
50 |
| - * QueryBatcher enables bulk processing or export of matches to a query by distributing the query |
51 |
| - across many threads and batch processing to listeners |
52 |
| - * Comes with ApplyTransformListener, DeleteListener, ExportListener, ExportToWriterListener, and |
53 |
| - UrisToWriterListener |
54 |
| - * With custom listeners you can easily and efficiently apply your business logic to batches of query |
55 |
| - matches |
56 |
| -* Kerberos and Client Certificate Authentication |
57 |
| -* Geospatial double precision and queries on region indexes |
58 |
| -* Temporal document enhancements |
59 |
| - * protect and wipe |
60 |
| - * more control over version uris |
61 |
| -* Support for document metadata values |
62 |
| - |
63 |
| -See also [CHANGELOG.md](CHANGELOG.md) |
64 |
| - |
65 |
| -### QuickStart |
66 |
| - |
67 |
| -To use the API in your maven project, include the following in your pom.xml: |
68 |
| - |
69 |
| - <dependency> |
70 |
| - <groupId>com.marklogic</groupId> |
71 |
| - <artifactId>marklogic-client-api</artifactId> |
72 |
| - <version>4.1.0</version> |
73 |
| - </dependency> |
74 |
| - |
75 |
| -And add this repository to your pom.xml repositories section: |
76 |
| - |
77 |
| - <repository> |
78 |
| - <id>jcenter</id> |
79 |
| - <url>http://jcenter.bintray.com</url> |
80 |
| - </repository> |
81 |
| - |
82 |
| -For gradle projects, include the following: |
83 |
| - |
84 |
| - dependencies { |
85 |
| - compile group: 'com.marklogic', name: 'marklogic-client-api', version: '4.1.0' |
86 |
| - } |
87 |
| - |
88 |
| -Use gradle 1.7+ and add this to your build.gradle repositories section: |
89 |
| - |
90 |
| - jcenter() |
91 |
| - |
92 |
| -Read [The Java API in Five Minutes](http://developer.marklogic.com/try/java/index) |
93 |
| - |
94 |
| -### Learning More |
95 |
| - |
96 |
| -The following resources document the Java API: |
97 |
| - |
98 |
| -* [Java Application Developer's Guide](http://docs.marklogic.com/guide/java) |
99 |
| -* [JavaDoc](http://docs.marklogic.com/javadoc/client/index.html) |
100 |
| - |
101 |
| -### Installing |
102 |
| - |
103 |
| -To use the Java API, either add Maven or Gradle dependency as explained above or download the jar and its dependencies: |
104 |
| - |
105 |
| -http://developer.marklogic.com/products/java |
106 |
| - |
107 |
| -Of course, you'll also need to install the database -- which you can do for free with |
108 |
| -the developer license: |
109 |
| - |
110 |
| -https://developer.marklogic.com/free-developer |
111 |
| - |
112 |
| -To obtain verified downloads signed with MarkLogic's PGP key, use maven tools or directly download |
113 |
| -the .jar and .asc files from |
114 |
| -[maven central](http://repo1.maven.org/maven2/com/marklogic/marklogic-client-api/4.1.0/). MarkLogic's |
115 |
| -pgp key ID is 48D4B86E and it is available from pgp.mit.edu by installing gnupg and running the command: |
116 |
| - |
117 |
| - $ gpg --keyserver pgp.mit.edu --recv-key 48D4B86E |
118 |
| - |
119 |
| -Files can be verified with the command: |
120 |
| - |
121 |
| - $ gpg marklogic-client-api-4.1.0.jar.asc |
122 |
| - |
123 |
| - |
124 |
| -### Building and Contributing |
125 |
| - |
126 |
| -You can build the API in the same way as any Gradle project on git: |
127 |
| - |
128 |
| -1. Clone the java-client-api repository on your machine. |
129 |
| -2. Choose the appropriate branch (usually develop) |
130 |
| -3. Execute a Gradle build in the directory containing the main project's build.gradle file. |
131 |
| - |
132 |
| -You might want to skip the tests until you have configured a test database and REST server: |
133 |
| - |
134 |
| - $ ./gradlew build -x test |
135 |
| - |
136 |
| -See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more on contributing to this github project. |
137 |
| - |
138 |
| -### Running JUnit Tests |
139 |
| - |
140 |
| - $ ./gradlew java-client-api:compileTestJava |
141 |
| - $ ./gradlew testServerInit |
142 |
| - $ ./gradlew java-client-api:test |
143 |
| - |
144 |
| -## Support |
145 |
| -The MarkLogic Java Client API is maintained by [MarkLogic](https://www.marklogic.com/) Engineering and is made available under the [Apache 2.0 license](https://github.com/marklogic/java-client-api/blob/master/LICENSE). It is designed for use in production applications with MarkLogic Server. Everyone is encouraged to file bug reports, feature requests, and pull requests through [GitHub](https://github.com/marklogic/java-client-api/issues). This input is critical and will be carefully considered. However, we can’t promise a specific resolution or timeframe for any request. In addition, MarkLogic provides technical support for [release tags](https://github.com/marklogic/java-client-api/releases) of the Java Client API to licensed customers under the terms outlined in the [MarkLogic Technical Support Handbook](http://www.marklogic.com/files/Mark_Logic_Support_Handbook.pdf). Customers with an active maintenance contract can sign up for MarkLogic Technical Support on our [support portal](https://help.marklogic.com/). |
| 1 | +# The MarkLogic Java Client API |
| 2 | + |
| 3 | +The API makes it easy to write, read, delete, and find documents |
| 4 | +in a [MarkLogic](http://developer.marklogic.com/) database. |
| 5 | + |
| 6 | +For example: |
| 7 | + |
| 8 | + // write a text, binary, XML, or JSON document from any source with ACID guarantees |
| 9 | + documentManager.write(uri, new FileHandle() |
| 10 | + .with(new File("file1234.json")) |
| 11 | + .withFormat(JSON)); |
| 12 | + |
| 13 | + // read and directly parse to your preferred type, even your own POJOs! |
| 14 | + JsonNode jsonDocContents = documentManager.readAs(uri, JsonNode.class); |
| 15 | + |
| 16 | + // get matches super-fast using full-featured search |
| 17 | + JsonNode results = queryManager.search( |
| 18 | + new StructuredQueryBuilder().term("quick", "brown", "fox"), |
| 19 | + new JacksonHandle()).get(); |
| 20 | + |
| 21 | +The Java API supports the following core features of the MarkLogic database: |
| 22 | + |
| 23 | +* Write and read binary, JSON, text, and XML documents. |
| 24 | +* Query data structure trees, marked-up text, and all the hybrids in between those extremes. |
| 25 | +* Project values, tuples, and triples from hierarchical documents and aggregate over them. |
| 26 | +* Patch documents with partial updates. |
| 27 | +* Use Optimistic Locking to detect contention without creating locks on the server. |
| 28 | +* Execute ACID modifications so the change either succeeds or throws an exception. |
| 29 | +* Execute multi-statement transactions so changes to multiple documents succeed or fail together. |
| 30 | +* Call Data Services by means of a Java interface on the client for data functionality |
| 31 | +implemented by an endpoint on the server. |
| 32 | + |
| 33 | +### What's New in Java Client API 5 |
| 34 | + |
| 35 | +* Upgrade to OkHttp 4.4.0 release. |
| 36 | +* Splitters for CSV records, for entries in a ZipInputStream, and for line-delimited JSON or XML |
| 37 | +for streaming to WriteBatcher. |
| 38 | +* Support for Bulk IO Data Services to make it easy to implement connectors for dataflow |
| 39 | +frameworks - see https://github.com/marklogic/java-client-api/wiki/Bulk-Data-Services for more |
| 40 | +detail. |
| 41 | + |
| 42 | +### What's New in Java Client API 4 |
| 43 | + |
| 44 | +* Optic API - blends relational with NoSQL by providing joins and aggregates over documents |
| 45 | + * is powered by the new row index and query optimizer |
| 46 | + * uses row, triple, and/or lexicon lenses |
| 47 | + * matches the functionality of the Optic API for XQuery and Javascript, but idiomatic for Java |
| 48 | + developers |
| 49 | +* Data Movement SDK - move large amounts of data into, out of, or within a MarkLogic cluster |
| 50 | + * WriteBatcher distributes writes across many threads and across the entire MarkLogic cluster |
| 51 | + * QueryBatcher enables bulk processing or export of matches to a query by distributing the query |
| 52 | + across many threads and batch processing to listeners |
| 53 | + * Comes with ApplyTransformListener, DeleteListener, ExportListener, ExportToWriterListener, and |
| 54 | + UrisToWriterListener |
| 55 | + * With custom listeners you can easily and efficiently apply your business logic to batches of query |
| 56 | + matches |
| 57 | +* Kerberos and Client Certificate Authentication |
| 58 | +* Geospatial double precision and queries on region indexes |
| 59 | +* Temporal document enhancements |
| 60 | + * protect and wipe |
| 61 | + * more control over version uris |
| 62 | +* Support for document metadata values |
| 63 | + |
| 64 | +See also [CHANGELOG.md](CHANGELOG.md) |
| 65 | + |
| 66 | +### QuickStart |
| 67 | + |
| 68 | +To use the API in your maven project, include the following in your pom.xml: |
| 69 | + |
| 70 | + <dependency> |
| 71 | + <groupId>com.marklogic</groupId> |
| 72 | + <artifactId>marklogic-client-api</artifactId> |
| 73 | + <version>5.2.0</version> |
| 74 | + </dependency> |
| 75 | + |
| 76 | +And add this repository to your pom.xml repositories section: |
| 77 | + |
| 78 | + <repository> |
| 79 | + <id>jcenter</id> |
| 80 | + <url>http://jcenter.bintray.com</url> |
| 81 | + </repository> |
| 82 | + |
| 83 | +For gradle projects, include the following: |
| 84 | + |
| 85 | + dependencies { |
| 86 | + compile group: 'com.marklogic', name: 'marklogic-client-api', version: '5.2.0' |
| 87 | + } |
| 88 | + |
| 89 | +Use gradle 1.7+ and add this to your build.gradle repositories section: |
| 90 | + |
| 91 | + jcenter() |
| 92 | + |
| 93 | +Read [The Java API in Five Minutes](http://developer.marklogic.com/try/java/index) |
| 94 | + |
| 95 | +### Learning More |
| 96 | + |
| 97 | +The following resources document the Java API: |
| 98 | + |
| 99 | +* [Java Application Developer's Guide](http://docs.marklogic.com/guide/java) |
| 100 | +* [JavaDoc](http://docs.marklogic.com/javadoc/client/index.html) |
| 101 | + |
| 102 | +### Installing |
| 103 | + |
| 104 | +To use the Java API, either add Maven or Gradle dependency as explained above or download the jar and its dependencies: |
| 105 | + |
| 106 | +http://developer.marklogic.com/products/java |
| 107 | + |
| 108 | +Of course, you'll also need to install the database -- which you can do for free with |
| 109 | +the developer license: |
| 110 | + |
| 111 | +https://developer.marklogic.com/free-developer |
| 112 | + |
| 113 | +To obtain verified downloads signed with MarkLogic's PGP key, use maven tools or directly download |
| 114 | +the .jar and .asc files from |
| 115 | +[maven central](http://repo1.maven.org/maven2/com/marklogic/marklogic-client-api/5.2.0/). MarkLogic's |
| 116 | +pgp key ID is 48D4B86E and it is available from pgp.mit.edu by installing gnupg and running the command: |
| 117 | + |
| 118 | + $ gpg --keyserver pgp.mit.edu --recv-key 48D4B86E |
| 119 | + |
| 120 | +Files can be verified with the command: |
| 121 | + |
| 122 | + $ gpg marklogic-client-api-5.2.0.jar.asc |
| 123 | + |
| 124 | + |
| 125 | +### Building and Contributing |
| 126 | + |
| 127 | +You can build the API in the same way as any Gradle project on git: |
| 128 | + |
| 129 | +1. Clone the java-client-api repository on your machine. |
| 130 | +2. Choose the appropriate branch (usually develop) |
| 131 | +3. Execute a Gradle build in the directory containing the main project's build.gradle file. |
| 132 | + |
| 133 | +You might want to skip the tests until you have configured a test database and REST server: |
| 134 | + |
| 135 | + $ ./gradlew build -x test |
| 136 | + |
| 137 | +See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for more on contributing to this github project. |
| 138 | + |
| 139 | +### Running JUnit Tests |
| 140 | + |
| 141 | + $ ./gradlew java-client-api:compileTestJava |
| 142 | + $ ./gradlew testServerInit |
| 143 | + $ ./gradlew java-client-api:test |
| 144 | + |
| 145 | +## Support |
| 146 | +The MarkLogic Java Client API is maintained by [MarkLogic](https://www.marklogic.com/) Engineering and is made available under the [Apache 2.0 license](https://github.com/marklogic/java-client-api/blob/master/LICENSE). It is designed for use in production applications with MarkLogic Server. Everyone is encouraged to file bug reports, feature requests, and pull requests through [GitHub](https://github.com/marklogic/java-client-api/issues). This input is critical and will be carefully considered. However, we can’t promise a specific resolution or timeframe for any request. In addition, MarkLogic provides technical support for [release tags](https://github.com/marklogic/java-client-api/releases) of the Java Client API to licensed customers under the terms outlined in the [MarkLogic Technical Support Handbook](http://www.marklogic.com/files/Mark_Logic_Support_Handbook.pdf). Customers with an active maintenance contract can sign up for MarkLogic Technical Support on our [support portal](https://help.marklogic.com/). |
0 commit comments