Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 1 addition & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,61 +51,7 @@ Full documentation is available at:

## Including JAXB support

If you are using Java 11 or higher (including Java 17) and you wish to use [JAXB](https://docs.oracle.com/javase/tutorial/jaxb/intro/)
with the client, you'll need to include JAXB API and implementation dependencies as those are no
longer included in Java 11 and higher.

For Maven, include the following in your pom.xml file:

<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>

For Gradle, include the following in your build.gradle file (this can be included in the same `dependencies` block
as the one that includes the marklogic-client-api dependency):

dependencies {
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
implementation "org.glassfish.jaxb:jaxb-core:2.3.0.1"
}

You are free to use any implementation of JAXB that you wish, but you need to ensure that you're using a JAXB
implementation that corresponds to the `javax.xml.bind` interfaces. JAXB 3.0 and 4.0 interfaces are packaged under
`jakarta.xml.bind`, and the Java API does not yet depend on those interfaces.

Thus, you are free to include an implementation of JAXB 3.0 or 4.0 in your project for your own use; it will not
affect the Java API. A caveat though is if you are trying to use different major versions of the same JAXB
implementation library - such as `org.glassfish.jaxb:jaxb-runtime` - then you will run into an expected dependency
conflict between the two versions of the library. This can be worked around by using a different implementation of
JAXB 3.0 or JAXB 4.0 - for example:

dependencies {
// JAXB 2 dependencies required by Java Client
implementation "javax.xml.bind:jaxb-api:2.3.1"
implementation "org.glassfish.jaxb:jaxb-runtime:2.3.2"
implementation "org.glassfish.jaxb:jaxb-core:2.3.0.1"

// JAXB 4 dependencies required by other application code
implementation "jakarta.xml.bind:jakarta.xml.bind-api:4.0.0"
implementation "com.sun.xml.bind:jaxb-impl:4.0.1"
}

The client will soon be updated to use the newer `jakarta.xml.bind` interfaces. Until then, the above approach
or one similar to it will allow for both the old and new JAXB interfaces and implementations to exist together in the
same classpath.
TODO, Need to rewrite this for Java Client 7.0.0.

## Support

Expand Down
5 changes: 0 additions & 5 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ plugins {
}

dependencies {
if (JavaVersion.current().isJava9Compatible()) {
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.2'
implementation 'org.glassfish.jaxb:jaxb-core:2.3.0.1'
}
implementation project(':marklogic-client-api')

// Forcing usage of 3.4.0 instead of 3.2.0 to address vulnerability - https://security.snyk.io/vuln/SNYK-JAVA-COMSQUAREUPOKIO-5820002
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import java.io.IOException;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import javax.xml.xpath.XPathExpressionException;

import com.marklogic.client.FailedRequestException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

import java.io.IOException;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.annotation.XmlRootElement;

import com.marklogic.client.DatabaseClient;
import com.marklogic.client.DatabaseClientFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.text.SimpleDateFormat;
import java.util.HashMap;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;

import com.marklogic.client.DatabaseClient;
import com.marklogic.client.DatabaseClientFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/
package com.marklogic.client.example.cookbook.datamovement;

import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.annotation.XmlRootElement;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -53,7 +53,7 @@ public static void main(String args[]) throws JAXBException {

/**
* A sample class which we will be using in order to demonstrate
* reading and writing large number of POJOs
* reading and writing large number of POJOs
*/
@XmlRootElement
public static class ProductDetails {
Expand Down Expand Up @@ -136,7 +136,7 @@ public void readBulkPOJOS() throws JAXBException {
// Create a query definition in order to use it with QueryBatcher
StructuredQueryDefinition query = new StructuredQueryBuilder().collection("products-collection1");

// Create a QueryBatcher in order to retrieve bulk POJOs
// Create a QueryBatcher in order to retrieve bulk POJOs
// from the database matching the query definition
QueryBatcher queryBatcher = moveMgr.newQueryBatcher(query)
.withBatchSize(batchSize)
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.marklogic
version=6.7-SNAPSHOT
version=7.0-SNAPSHOT
describedName=MarkLogic Java Client API
publishUrl=file:../marklogic-java/releases

Expand Down
8 changes: 1 addition & 7 deletions marklogic-client-api-functionaltests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@ dependencies {
implementation 'com.fasterxml.jackson.core:jackson-core:2.15.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.3'
implementation "org.jdom:jdom2:2.0.6.1"
implementation "com.marklogic:ml-app-deployer:4.6.1"

if (JavaVersion.current().isJava9Compatible()) {
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.8'
implementation 'org.glassfish.jaxb:jaxb-core:2.3.0.1'
}
implementation "com.marklogic:ml-app-deployer:4.7.0"

testImplementation 'ch.qos.logback:logback-classic:1.3.14'
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import static org.junit.jupiter.api.Assertions.*;
import org.skyscreamer.jsonassert.JSONAssert;

import javax.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBContext;
import javax.xml.transform.Source;
import javax.xml.transform.dom.DOMSource;
import java.io.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import static org.junit.jupiter.api.Assertions.*;
import org.skyscreamer.jsonassert.JSONAssert;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.FileInputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.marklogic.client.functionaltest;

import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class Product
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import com.marklogic.client.query.StructuredQueryDefinition;
import org.junit.jupiter.api.*;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.datatype.DatatypeFactory;
import java.util.Calendar;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.ls.DOMImplementationLS;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
Expand Down
26 changes: 18 additions & 8 deletions marklogic-client-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
// Copyright (c) 2022 MarkLogic Corporation

plugins {
id 'maven-publish'
id 'java-library'
id 'maven-publish'
}

group = 'com.marklogic'

description = "The official MarkLogic Java client API."

dependencies {
if (JavaVersion.current().isJava9Compatible()) {
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.8'
implementation 'org.glassfish.jaxb:jaxb-core:2.3.0.1'
}
// With 7.0.0, now using the Jakarta JAXB APIs instead of the JAVAX JAXB APIs that were bundled in Java 8.
// To ease support for Java 8, we are depending on version 3.x of the Jakarta JAXB APIs as those only require Java 8,
// whereas the 4.x version requires Java 11 or higher.
api "jakarta.xml.bind:jakarta.xml.bind-api:3.0.1"
implementation "org.glassfish.jaxb:jaxb-runtime:3.0.2"
implementation "org.glassfish.jaxb:jaxb-core:3.0.2"

implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
Expand Down Expand Up @@ -43,7 +45,7 @@ dependencies {

// Allows talking to the Manage API. It depends on the Java Client itself, which will usually be a slightly older
// version, but that should not have any impact on the tests.
testImplementation "com.marklogic:ml-app-deployer:4.6.1"
testImplementation "com.marklogic:ml-app-deployer:4.7.0"

// Starting with mockito 5.x, Java 11 is required, so sticking with 4.x as we have to support Java 8.
testImplementation "org.mockito:mockito-core:4.11.0"
Expand All @@ -52,7 +54,7 @@ dependencies {

testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.3'
testImplementation 'ch.qos.logback:logback-classic:1.3.14'
// schema validation issue with testImplementation 'xerces:xercesImpl:2.12.0'
// schema validation issue with testImplementation 'xerces:xercesImpl:2.12.0'
testImplementation 'org.opengis.cite.xerces:xercesImpl-xsd11:2.12-beta-r1667115'
testImplementation 'org.apache.commons:commons-lang3:3.14.0'
testImplementation 'org.apache.httpcomponents:httpclient:4.5.14'
Expand Down Expand Up @@ -204,3 +206,11 @@ task debugCloudAuth(type: JavaExec) {
classpath = sourceSets.test.runtimeClasspath
args = [cloudHost, cloudKey, cloudBasePath]
}

task runXmlSmokeTests(type: Test) {
description = "Run a bunch of XML-related tests for smoke-testing on a particular JVM"
include "com/marklogic/client/test/BufferableHandleTest.class"
include "com/marklogic/client/test/EvalTest.class"
include "com/marklogic/client/test/HandleAsTest.class"
include "com/marklogic/client/test/JAXBHandleTest.class"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
package com.marklogic.client.bitemporal;

import com.marklogic.client.document.DocumentDescriptor;
import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;

public interface TemporalDescriptor extends DocumentDescriptor {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import java.util.Calendar;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.datatype.Duration;

import com.marklogic.client.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.nio.charset.CharsetEncoder;
import java.util.*;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.datatype.Duration;

import com.marklogic.client.query.SearchQueryDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.Set;

import javax.xml.XMLConstants;
import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import javax.mail.internet.MimeMultipart;
import javax.mail.util.ByteArrayDataSource;
import javax.net.ssl.*;
import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import java.io.ByteArrayInputStream;
import java.io.Closeable;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

/**
* A TuplesBuilder parses a set of tuple results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.regex.Pattern;
import java.util.stream.Stream;

import javax.xml.bind.DatatypeConverter;
import jakarta.xml.bind.DatatypeConverter;
import javax.xml.datatype.Duration;

/**
Expand Down Expand Up @@ -641,7 +641,7 @@ static private Pattern getInstantPattern() {
}
return instantPattern;
}

static public <I> String[] convert(I[] in, Function<I, String> converter) {
if (in == null) return null;
String[] out = new String[in.length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@

import java.util.ArrayList;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

import com.marklogic.client.query.AggregateResult;
import com.marklogic.client.query.CountedDistinctValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.util.HashMap;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

/**
* A ValuesListBuilder parses list of value results.
Expand Down
Loading