Skip to content

Commit

Permalink
Uplift rich-contract to 4.2.0.0, uplift bindings file
Browse files Browse the repository at this point in the history
  • Loading branch information
at055612 committed Jun 5, 2024
1 parent aefb892 commit b6bb8f7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 68 deletions.
13 changes: 6 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ext.isPropertySet = { propName ->
}
}

ext.ensurePropertyIsSet = { propName ->
ext.ensurePropertyIsSet = { propName ->
if (!isPropertySet(propName)) {
throw new GradleException(
"Expecting project property [${propName}] or env var [ORG_GRADLE_PROJECT_${propName}] to be set.")
Expand All @@ -45,7 +45,7 @@ ext.ensurePropertyIsSet = { propName ->

//if the project has a value for the passed property (i.e from the cmd line via -PpropName=xxx)
//use that, else use a default value
ext.getPropertyOrDefault = { propName, defaultValue ->
ext.getPropertyOrDefault = { propName, defaultValue ->
def val;
if (isPropertySet(propName)) {
val = project.getProperty(propName)
Expand Down Expand Up @@ -178,9 +178,8 @@ ext.libs = [
jakarta_servlet_api : "jakarta.servlet:jakarta.servlet-api:4.0.4",
jakarta_ws_rs_api : "jakarta.ws.rs:jakarta.ws.rs-api:2.1.6",
jaxb_api : "jakarta.xml.bind:jakarta.xml.bind-api", // Version set by jaxb_bom
//jaxb_basics : "org.jvnet.jaxb2_commons:jaxb2-basics:0.12.0",
jaxb_plugins : "org.jvnet.jaxb:jaxb-plugins:4.0.6",
jaxb_rich_contract_plugin : "net.codesup.util:jaxb2-rich-contract-plugin:4.1.0",
jaxb_plugins : "org.jvnet.jaxb:jaxb-plugins:4.0.6", // See https://github.com/highsource/jaxb-tools
jaxb_rich_contract_plugin : "net.codesup.util:jaxb-rich-contract-plugin:4.2.0.0",
jaxb_runtime : "org.glassfish.jaxb:jaxb-runtime", // Version set by jaxb_bom
jaxb_xjc : "org.glassfish.jaxb:jaxb-xjc", // Version set by jaxb_bom
jaxb_bom : "org.glassfish.jaxb:jaxb-bom:4.0.5",
Expand All @@ -199,7 +198,7 @@ ext.libs = [
]

// NOTE
//
//

allprojects {
group "uk.gov.gchq.eventlogging" // no spaces as java pkg name convention
Expand Down Expand Up @@ -254,7 +253,7 @@ subprojects {
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")

//Use full logging for test exceptions so we can see where the failure occurred
//Use full logging for test exceptions so we can see where the failure occurred
testLogging {
events "failed"
exceptionFormat = 'full'
Expand Down
2 changes: 1 addition & 1 deletion event-logging-generator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ task downloadSchema() {
copy {
from schemaFile
into schemaDir
}
}
} else {
println "Downloading schema from ${eventLoggingSchemaUrl}"
download {
Expand Down
119 changes: 59 additions & 60 deletions event-logging-generator/simple-binding.xjb
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb"
xmlns:inheritance="urn:jaxb.jvnet.org:plugin:inheritance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:evt="event-logging:3"
jaxb:extensionBindingPreferences="xjc"
jaxb:version="2.0">
jaxb:extensionBindingPrefixes="inheritance"
jaxb:version="3.0">

<!--
<!--
~~~~~~~~~~
IMPORTANT:
IMPORTANT:
~~~~~~~~~~
This binding file operates on the transient schema.mod.xsd file that is derived from the
source schema (event-logging.xsd in the event-logging repo). All types named
XxxComplexType are renamed to Xxx in GenClasses.java. This is to provide better java
class names. E.g FooBarComplexType becomes FooBar. Thus any xpath queries in here
source schema (event-logging.xsd in the event-logging repo). All types named
XxxComplexType are renamed to Xxx in GenClasses.java. This is to provide better java
class names. E.g FooBarComplexType becomes FooBar. Thus any xpath queries in here
must use the shorter form of the complex type names.
-->

<jaxb:bindings schemaLocation="schema/schema.mod.xsd" node="/xs:schema">

<!-- localScoping to prevent nested classes -->
<jaxb:globalBindings
generateElementProperty="false"
<jaxb:globalBindings
generateElementProperty="false"
localScoping="toplevel">

<jaxb:javaType
name="java.util.Date"
xmlType="xs:date"
parseMethod="event.logging.jaxb.DateAdaptor.parseDate"
<jaxb:javaType
name="java.util.Date"
xmlType="xs:date"
parseMethod="event.logging.jaxb.DateAdaptor.parseDate"
printMethod="event.logging.jaxb.DateAdaptor.printDate" />
<jaxb:javaType
name="java.util.Date"
xmlType="evt:DateTime"
parseMethod="event.logging.jaxb.DateAdaptor.parseDate"
<jaxb:javaType
name="java.util.Date"
xmlType="evt:DateTime"
parseMethod="event.logging.jaxb.DateAdaptor.parseDate"
printMethod="event.logging.jaxb.DateAdaptor.printDate" />
</jaxb:globalBindings>

Expand Down Expand Up @@ -109,34 +108,34 @@
</jaxb:bindings>

<!-- make these types implement a common marker interface so we can have a single property -->
<jaxb:bindings
multiple="true"
<jaxb:bindings
multiple="true"
node="xs:complexType[@name='User' or @name='Device' or @name='Group']">

<inheritance:implements>AuthenticationEntity</inheritance:implements>
<inheritance:implements>AuthenticationEntity</inheritance:implements>
</jaxb:bindings>

<!-- Make (User|Device)ComplexType classes implement Endpoint to make the choice
in SendreceiveGroup/Source|Dest be List<Endpoint> instead of List<Object> -->
<jaxb:bindings multiple="true" node="xs:complexType[@name='User' or @name='Device']">
<inheritance:implements>Endpoint</inheritance:implements>
<inheritance:implements>Endpoint</inheritance:implements>
</jaxb:bindings>

<!-- make these types implement a common marker interface so we can have a single property -->
<jaxb:bindings multiple="true" node="xs:complexType[@name='User' or @name='Group']">
<inheritance:implements>PermissionEntity</inheritance:implements>
<inheritance:implements>PermissionEntity</inheritance:implements>
</jaxb:bindings>

<!-- make any top level complex types with an Outcome complexType element implement HasOutcome to
make it easier to get the outcome from an action -->
<jaxb:bindings multiple="true" node="xs:complexType[.//xs:element[@type='evt:Outcome' or @type='evt:CopyMoveOutcome' or @type='evt:AuthenticateOutcome'] or .//xs:group[@ref='evt:InstallationGroup']]">
<inheritance:implements>HasOutcome</inheritance:implements>
<inheritance:implements>HasOutcome</inheritance:implements>
</jaxb:bindings>

<!-- Change prop name from userOrDevice to endpoints-->
<jaxb:bindings node="xs:group[@name='SendReceiveGroup']/xs:sequence">
<jaxb:bindings
multiple="true"
<jaxb:bindings
multiple="true"
node="xs:element[@name='Source' or @name='Destination']//xs:choice">

<jaxb:property name="endpoints" >
Expand All @@ -148,7 +147,7 @@

<!-- make these types implement a common marker interface so we can have a single property -->
<jaxb:bindings multiple="true" node="xs:complexType[@name='Software' or @name='Hardware' or @name='Media']">
<inheritance:implements>InstallationEntity</inheritance:implements>
<inheritance:implements>InstallationEntity</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:group[@name='InstallationGroup']/xs:sequence/xs:choice">
Expand All @@ -159,7 +158,7 @@



<!--
<!--
Rename all the choices in EventDetail (i.e the schema actions) to
XxxxEventAction. This is partly for clarity but also to avoid some name
clashes now we have all top level classes. Also make each class implement
Expand All @@ -180,7 +179,7 @@
<jaxb:bindings node="xs:complexType">
<jaxb:factoryMethod name="UnknownEventAction"/>
<jaxb:class name="UnknownEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>
</jaxb:bindings>

Expand All @@ -189,7 +188,7 @@
<jaxb:bindings node="xs:complexType[@name='Authenticate']">
<jaxb:factoryMethod name="AuthenticateEventAction"/>
<jaxb:class name="AuthenticateEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>

<!-- Change the property name and type for the user|device|group choice -->
<jaxb:bindings node="xs:sequence/xs:choice">
Expand All @@ -203,119 +202,119 @@
<jaxb:bindings node="xs:complexType[@name='Authorise']">
<jaxb:factoryMethod name="AuthoriseEventAction"/>
<jaxb:class name="AuthoriseEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>

</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Copy']">
<jaxb:factoryMethod name="CopyEventAction"/>
<jaxb:class name="CopyEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Move']">
<jaxb:factoryMethod name="MoveEventAction"/>
<jaxb:class name="MoveEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Create']">
<jaxb:factoryMethod name="CreateEventAction"/>
<jaxb:class name="CreateEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='View']">
<jaxb:factoryMethod name="ViewEventAction"/>
<jaxb:class name="ViewEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Search']">
<jaxb:factoryMethod name="SearchEventAction"/>
<jaxb:class name="SearchEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='BaseObjectOutcome']">
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Import']">
<jaxb:factoryMethod name="ImportEventAction"/>
<jaxb:class name="ImportEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Export']">
<jaxb:factoryMethod name="ExportEventAction"/>
<jaxb:class name="ExportEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Update']">
<jaxb:factoryMethod name="UpdateEventAction"/>
<jaxb:class name="UpdateEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Delete']">
<jaxb:factoryMethod name="DeleteEventAction"/>
<jaxb:class name="DeleteEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Process']">
<jaxb:factoryMethod name="ProcessEventAction"/>
<jaxb:class name="ProcessEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Print']">
<jaxb:factoryMethod name="PrintEventAction"/>
<jaxb:class name="PrintEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Install']">
<jaxb:factoryMethod name="InstallEventAction"/>
<jaxb:class name="InstallEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Uninstall']">
<jaxb:factoryMethod name="UninstallEventAction"/>
<jaxb:class name="UninstallEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='NetworkEventAction']">
<!-- no rename needed as the type is already called EventAction -->
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Alert']">
<jaxb:factoryMethod name="AlertEventAction"/>
<jaxb:class name="AlertEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Send']">
<jaxb:factoryMethod name="SendEventAction"/>
<jaxb:class name="SendEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Receive']">
<jaxb:factoryMethod name="ReceiveEventAction"/>
<jaxb:class name="ReceiveEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings node="xs:complexType[@name='Approval']">
<jaxb:factoryMethod name="ApprovalEventAction"/>
<jaxb:class name="ApprovalEventAction" />
<inheritance:implements>EventAction</inheritance:implements>
<inheritance:implements>EventAction</inheritance:implements>
</jaxb:bindings>

<!-- End of EventAction stuff -->
Expand All @@ -334,8 +333,8 @@
</jaxb:bindings>

<!-- Change the property name and type for the multi object group -->
<jaxb:bindings
multiple="true"
<jaxb:bindings
multiple="true"
node="xs:complexType[@name='MultiObject' or @name='BaseObjectOutcome' or @name='Authorise']//xs:group[@ref='evt:MultiObjectGroup']">

<jaxb:property name="objects" >
Expand All @@ -346,15 +345,15 @@
<!-- Make all query items implement the same marker interface so we can have a List<AdvancedQueryItem> -->

<jaxb:bindings multiple="true" node="xs:complexType[@name='Term']">
<inheritance:implements>AdvancedQueryItem</inheritance:implements>
<inheritance:implements>AdvancedQueryItem</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings multiple="true" node="xs:complexType[@name='And' or @name='Or' or @name='Not']">
<!-- This extends AdvancedQueryItem -->
<inheritance:implements>AdvancedQueryOperator</inheritance:implements>
<inheritance:implements>AdvancedQueryOperator</inheritance:implements>
</jaxb:bindings>

<jaxb:bindings
multiple="true"
<jaxb:bindings
multiple="true"
node="xs:complexType[@name='And' or @name='Or' or @name='Not']/xs:group[@ref='evt:AdvancedQueryOperatorGroup']">

<jaxb:property name="queryItems" >
Expand All @@ -373,7 +372,7 @@
<!-- Force it to be List<AdvancedQueryItem> instead of List<java.lang.Object> -->
<jaxb:baseType name="AdvancedQueryItem" />
</jaxb:property>
</jaxb:bindings>
</jaxb:bindings>

<jaxb:factoryMethod name="AdvancedQuery"/>
<jaxb:class name="AdvancedQuery" />
Expand All @@ -392,6 +391,6 @@
</jaxb:bindings>

</jaxb:bindings> <!-- /xs:schema -->
</jaxb:bindings>
</jaxb:bindings>

<!-- vim:set expandtab shiftwidth=4 tabstop=4: -->

0 comments on commit b6bb8f7

Please sign in to comment.