Skip to content

Commit

Permalink
Update javax to jakarta namespaces (#1236)
Browse files Browse the repository at this point in the history
* Work on servlet migration

* Update javax to jakarta namespaces

* Build fixes

---------

Co-authored-by: JP <[email protected]>
  • Loading branch information
jamesagnew and JPercival authored Nov 3, 2023
1 parent b123ae8 commit 1da3590
Show file tree
Hide file tree
Showing 54 changed files with 100 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ dependencies {

// These are JAXB dependencies excluded because the libraries need to work
// on Android. But for test purposes we use them pretty much everywhere.
testRuntimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7'
testRuntimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2'
testRuntimeOnly 'org.eclipse.parsson:parsson:1.1.5'
testRuntimeOnly 'xpp3:xpp3:1.1.4c'
}

Expand Down
19 changes: 10 additions & 9 deletions Src/java/buildSrc/src/main/groovy/cql.xjc-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@ configurations {
}

dependencies {
xjc 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.13.1'
xjc 'org.jvnet.jaxb2_commons:jaxb2-basics:0.13.1'
xjc 'org.jvnet.jaxb2_commons:jaxb2-fluent-api:3.0'
xjc 'codes.rafael.jaxb2_commons:jaxb2-basics-ant:3.0.0'
xjc 'codes.rafael.jaxb2_commons:jaxb2-basics:3.0.0'
xjc 'codes.rafael.jaxb2_commons:jaxb2-fluent-api:3.0.0'
// Eclipse has taken over all Java EE reference components
// https://www.infoworld.com/article/3310042/eclipse-takes-over-all-java-ee-reference-components.html
// https://wiki.eclipse.org/Jakarta_EE_Maven_Coordinates
xjc 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
xjc 'org.glassfish.jaxb:jaxb-xjc:2.4.0-b180830.0438'
xjc 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7'
xjc 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
xjc 'org.glassfish.jaxb:jaxb-xjc:3.0.2'
xjc 'org.glassfish.jaxb:jaxb-runtime:4.0.3'
xjc 'org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.2'
xjc 'org.slf4j:slf4j-simple:1.7.36'

api 'org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1'
api 'jakarta.xml.bind:jakarta.xml.bind-api:2.3.3'
api 'codes.rafael.jaxb2_commons:jaxb2-basics-runtime:3.0.0'
api 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
}

ext.xjc = [
Expand Down Expand Up @@ -66,4 +67,4 @@ sourceSets {

clean {
delete xjc.destDir
}
}
1 change: 1 addition & 0 deletions Src/java/cqf-fhir-npm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
dependencies {
implementation project(':cql-to-elm')
implementation project(':cqf-fhir')
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'org.apache.commons:commons-compress:1.24.0'
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package org.cqframework.fhir.npm;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

import jakarta.xml.bind.JAXB;
import org.hl7.cql.model.ModelIdentifier;
import org.hl7.cql.model.ModelInfoProvider;
import org.hl7.elm_modelinfo.r1.ModelInfo;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.model.Library;
import org.hl7.fhir.utilities.npm.NpmPackage;

import javax.xml.bind.JAXB;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
* Provides a model info provider that can resolve CQL model info from an Npm package
Expand Down
2 changes: 1 addition & 1 deletion Src/java/cql-to-elm-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
implementation project(':model-jaxb')
implementation project(':elm-jaxb')
implementation 'net.sf.jopt-simple:jopt-simple:4.7'
runtimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:2.7.7'
runtimeOnly 'org.eclipse.persistence:org.eclipse.persistence.moxy:4.0.1'
runtimeOnly 'xpp3:xpp3_min:1.1.4c'
runtimeOnly 'xmlpull:xmlpull:1.1.3.1'

Expand Down
3 changes: 2 additions & 1 deletion Src/java/cql-to-elm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ dependencies {
}

implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.15.2'
implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.13.2'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'

testImplementation project(':elm-jackson')
testImplementation project(':model-jackson')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
import org.hl7.cql_annotations.r1.Tag;
import org.hl7.elm.r1.*;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;
import java.util.stream.Collectors;

/**
* Common functionality used by {@link CqlPreprocessorVisitor} and {@link Cql2ElmVisitor}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import javax.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBElement;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import javax.xml.bind.JAXBException;
import jakarta.xml.bind.JAXBException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
Expand Down
1 change: 1 addition & 0 deletions Src/java/elm-fhir/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies {
implementation project(':engine')
implementation project(":engine-fhir")
implementation "org.mapstruct:mapstruct:${mapstructVersion}"
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'

testImplementation project(':quick')
testImplementation "org.reflections:reflections:0.10.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverter;
import org.opencds.cqf.cql.engine.fhir.converter.FhirTypeConverterFactory;

import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
import jakarta.xml.bind.JAXBElement;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.ZonedDateTime;
Expand Down
2 changes: 1 addition & 1 deletion Src/java/elm-jackson/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies {
api project(':elm')
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2'
implementation 'com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.15.2'
implementation 'com.fasterxml.jackson.module:jackson-module-jakarta-xmlbind-annotations:2.15.2'
// needs javax.json.JsonException when using SAXUnmarshaller.getNewXMLReader
implementation 'org.glassfish:javax.json:1.0.4'
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
package org.cqframework.cql.elm.serializing.jackson;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import org.cqframework.cql.elm.serializing.ElmLibraryReader;
import org.cqframework.cql.elm.serializing.LibraryWrapper;
import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn;
import org.hl7.cql_annotations.r1.CqlToElmBase;
import org.hl7.elm.r1.Library;
import org.hl7.elm.r1.TypeSpecifier;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TrackableMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn;
Expand All @@ -20,7 +20,7 @@ public class ElmJsonMapper {
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL)
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL))
.addModule(new JaxbAnnotationModule())
.addModule(new JakartaXmlBindAnnotationModule())
.addMixIn(Trackable.class, TrackableMixIn.class)
.addMixIn(TypeSpecifier.class, TypeSpecifierMixIn.class)
.addMixIn(CqlToElmBase.class, CqlToElmBaseMixIn.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
package org.cqframework.cql.elm.serializing.jackson;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import org.cqframework.cql.elm.serializing.ElmLibraryReader;
import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn;
import org.hl7.cql_annotations.r1.CqlToElmBase;
import org.hl7.elm.r1.Library;
import org.hl7.elm.r1.TypeSpecifier;

import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.fasterxml.jackson.dataformat.xml.XmlFactory;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import com.fasterxml.jackson.module.jakarta.xmlbind.JakartaXmlBindAnnotationModule;
import org.cqframework.cql.elm.serializing.jackson.mixins.CqlToElmBaseMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TrackableMixIn;
import org.cqframework.cql.elm.serializing.jackson.mixins.TypeSpecifierMixIn;
Expand All @@ -31,7 +31,7 @@ public class ElmXmlMapper {
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL)
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL))
.addModule(new JaxbAnnotationModule())
.addModule(new JakartaXmlBindAnnotationModule())
.addMixIn(Trackable.class, TrackableMixIn.class)
.addMixIn(TypeSpecifier.class, TypeSpecifierMixIn.class)
.addMixIn(CqlToElmBase.class, CqlToElmBaseMixIn.class)
Expand Down
2 changes: 2 additions & 0 deletions Src/java/elm-jaxb/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ plugins {

dependencies {
api project(':elm')
api 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
api 'jakarta.json:jakarta.json-api:2.1.3'
implementation 'org.apache.commons:commons-text:1.10.0'
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.cqframework.cql.elm.serializing.jaxb;

import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.PropertyException;
import jakarta.xml.bind.Unmarshaller;
import jakarta.xml.bind.ValidationEvent;
import jakarta.xml.bind.ValidationEventHandler;
import org.cqframework.cql.elm.serializing.ElmLibraryReader;
import org.hl7.elm.r1.Library;

import javax.xml.bind.*;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class ElmJsonLibraryReader implements ElmLibraryReader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.hl7.elm.r1.Library;
import org.hl7.elm.r1.ObjectFactory;

import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.PropertyException;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.PropertyException;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.hl7.cql_annotations.r1.CqlToElmBase;
import org.hl7.elm.r1.Library;

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

public class ElmJsonMapper {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import org.cqframework.cql.elm.serializing.ElmLibraryReader;
import org.hl7.elm.r1.Library;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Unmarshaller;
import javax.xml.transform.Source;
import java.io.File;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.hl7.elm.r1.Library;
import org.hl7.elm.r1.ObjectFactory;

import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.PropertyException;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
import jakarta.xml.bind.PropertyException;
import java.io.*;

public class ElmXmlLibraryWriter implements ElmLibraryWriter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.hl7.cql_annotations.r1.CqlToElmBase;
import org.hl7.elm.r1.Library;

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

public class ElmXmlMapper {

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.List;
import java.util.stream.Collectors;

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

import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlCompilerOptions;
Expand Down
1 change: 1 addition & 0 deletions Src/java/elm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
}

dependencies {
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.1'
implementation project(':model')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.hl7.cql.model.DataType;

import javax.xml.bind.annotation.XmlTransient;
import jakarta.xml.bind.annotation.XmlTransient;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:cql-annotations:r1", xmlns = {
@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:cql-annotations:r1", xmlns = {
@XmlNs(prefix="a", namespaceURI = "urn:hl7-org:cql-annotations:r1")},
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.hl7.cql_annotations.r1;

import javax.xml.bind.annotation.XmlNs;
import jakarta.xml.bind.annotation.XmlNs;
6 changes: 3 additions & 3 deletions Src/java/elm/src/main/java/org/hl7/elm/r1/package-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@javax.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = {
@jakarta.xml.bind.annotation.XmlSchema(namespace = "urn:hl7-org:elm:r1", xmlns = {
@XmlNs(prefix = "", namespaceURI = "urn:hl7-org:elm:r1"),
@XmlNs(prefix = "t", namespaceURI = "urn:hl7-org:elm-types:r1"),
@XmlNs(prefix = "xsi", namespaceURI = "http://www.w3.org/2001/XMLSchema-instance"),
Expand All @@ -7,7 +7,7 @@
@XmlNs(prefix = "qdm43", namespaceURI = "urn:healthit-gov:qdm:v4_3"),
@XmlNs(prefix = "qdm53", namespaceURI = "urn:healthit-gov:qdm:v5_3"),
@XmlNs(prefix = "a", namespaceURI = "urn:hl7-org:cql-annotations:r1")},
elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
elementFormDefault = jakarta.xml.bind.annotation.XmlNsForm.QUALIFIED)
package org.hl7.elm.r1;

import javax.xml.bind.annotation.XmlNs;
import jakarta.xml.bind.annotation.XmlNs;
Original file line number Diff line number Diff line change
@@ -1 +1 @@
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Original file line number Diff line number Diff line change
@@ -1 +1 @@
javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
jakarta.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
Loading

0 comments on commit 1da3590

Please sign in to comment.