Skip to content

Commit

Permalink
Update to verify with Jarkarta, remove unused javax dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
mrttrifork committed Nov 1, 2024
1 parent 883e51a commit ad824e0
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 82 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Contains the schemas and wsdl file used in the CTR project for the new DGWS inte

Run `mvn clean package` to create a zip file of the wsdl and schema files in `ctr-schemas` repo. The zip file is located in the `target` folder.

## Verify

Run `mvn clean verify` to verify that all the schemas are correct before making a release. The generated java classes can be found [here](target/generated-sources/wsimport/dk/lmst/ctr/xml_schema/_2022/_12/_01).

If they don't exist it means that the verification failed

## Upload zip file to Github

When creating a release in Github of this project, the Github action workflow will automatically create a zip file and upload it to the Github packages.
Expand Down
62 changes: 22 additions & 40 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>dk.lmst.ctr</groupId>
<artifactId>ctr-schemas</artifactId>
<version>1.1.18</version>
<version>1.1.19</version>
<name>ctr-schemas</name>
<description>CTR schemas</description>
<packaging>pom</packaging>
Expand All @@ -21,29 +21,9 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>resources</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>/src/main/assembly/resources.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>unpack-ctr</id>
Expand Down Expand Up @@ -95,9 +75,9 @@
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.6</version>
<version>3.0.2</version>
<executions>
<execution>
<goals>
Expand All @@ -122,23 +102,25 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.7.1</version>
<executions>
<execution>
<id>resources</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
<configuration>
<descriptors>
<descriptor>/src/main/assembly/resources.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.jws</groupId>
<artifactId>javax.jws-api</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.12.5</version>
</dependency>
</dependencies>
</project>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dk.lmst.ctr.schemas.api.adapters;
package dk.fmkonline.jaxb.adapters;

import org.joda.time.LocalDate;
import java.time.LocalDate;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

public class LocalDateAdapter extends XmlAdapter<String, LocalDate> {

Expand All @@ -13,7 +13,7 @@ public LocalDate unmarshal(String v) throws Exception {
if (v.endsWith("Z")) {
v = v.substring(0, v.length() - 1);
}
return new LocalDate(v);
return LocalDate.parse(v);
}

public String marshal(LocalDate v) throws Exception {
Expand All @@ -22,5 +22,4 @@ public String marshal(LocalDate v) throws Exception {
}
return v.toString();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package dk.lmst.ctr.schemas.api.adapters;
package dk.fmkonline.jaxb.adapters;

import javax.xml.bind.annotation.adapters.XmlAdapter;
import jakarta.xml.bind.annotation.adapters.XmlAdapter;

public class LongAdapter extends XmlAdapter<String, Long> {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package dk.fmkonline.jaxb.adapters;

import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;

/**
* A jaxb adapter that only accepts dateTimes with a timezone
*/
public class ZonedDateTimeAdapter extends XmlAdapter<String, ZonedDateTime> {

public ZonedDateTime unmarshal(String zonedDateTimeString) throws Exception {
if (zonedDateTimeString == null) {
return null;
}
return ZonedDateTime.parse(zonedDateTimeString);
}

public String marshal(ZonedDateTime zonedDateTime) throws Exception {
if (zonedDateTime == null) {
return null;
}
return zonedDateTime.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}
}
22 changes: 12 additions & 10 deletions src/main/xjb/jaxb-bindings-wsimport.xjb
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>

<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:extensionBindingPrefixes="xjc" jaxb:version="2.1">
<jaxb:bindings xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:extensionBindingPrefixes="xjc" jaxb:version="3.0">

<jaxb:globalBindings>
<xjc:simple />
<jaxb:serializable />
<jaxb:globalBindings generateValueClass="true">
<xjc:simple/>
<jaxb:serializable/>

<xjc:javaType name="java.lang.Long" xmlType="xs:long" adapter="dk.lmst.ctr.schemas.api.adapters.LongAdapter" />
<xjc:javaType name="java.lang.Long" xmlType="xs:long" adapter="dk.lmst.ctr.schemas.api.adapters.LongAdapter"/>

<xjc:javaType name="org.joda.time.LocalDate" xmlType="xs:date" adapter="dk.lmst.ctr.schemas.api.adapters.LocalDateAdapter" />
<xjc:javaType name="java.time.LocalDate" xmlType="xs:date"
adapter="dk.lmst.ctr.schemas.api.adapters.LocalDateAdapter"/>

<xjc:javaType name="org.joda.time.DateTime" xmlType="xs:dateTime" adapter="dk.lmst.ctr.schemas.api.adapters.DateTimeAdapter" />
<xjc:javaType name="java.time.ZonedDateTime" xmlType="xs:dateTime"
adapter="dk.lmst.ctr.schemas.api.adapters.ZonedDateTimeAdapter"/>

</jaxb:globalBindings>
<jaxb:bindings schemaLocation="../../../target/api/ctr-schemas/src/schemas/medcom/dgws/2006/04/medcom.xsd">
<jaxb:schemaBindings>
<jaxb:package name="dk.fmkonline.dgws.server.medcom" />
<jaxb:package name="dk.fmkonline.dgws.server.medcom"/>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>

0 comments on commit ad824e0

Please sign in to comment.