Skip to content

Commit

Permalink
Merge pull request #19 from gchq/6.0
Browse files Browse the repository at this point in the history
6.0
  • Loading branch information
at055612 committed Aug 5, 2024
2 parents 606c227 + 2bd1074 commit f95ece0
Show file tree
Hide file tree
Showing 45 changed files with 1,128 additions and 659 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@ jobs:
# Set this so it gets the annotated commit, not the commit being tagged.
# Which means we can get the release msg
# See https://github.com/actions/runner/issues/712
ref: ${{ github.ref }}
ref: ${{ github.ref }}

- name: Setup Java
id: setup_java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '8.0.312+7'
distribution: 'temurin'
java-version: '11.0.23+9'
cache: 'gradle'

# Make sure the wrapper jar has not been tampered with
- name: Validate gradle wrapper jar
id: validate_gradle_wrapper
uses: gradle/wrapper-validation-action@v1

# Set variables in github's special env file which are then automatically
# Set variables in github's special env file which are then automatically
# read into env vars in each subsequent step
- name: Set Environment Variables
id: set_env_var
Expand Down
46 changes: 45 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,48 @@ DO NOT ADD CHANGES HERE - ADD THEM USING log_change.sh
~~~


## [v6.0-beta.2_schema-v4.1.0] - 2024-06-28

* Add constants for system property keys to EventLoggingService.

* Improve javadoc.

* Add interface `ValidationErrorHandler` and change `ExceptionAndLoggingErrorHandler` and `LoggingErrorHandler` to implement it. Change constructors on `DefaultEventLoggingService` to take a `Supplier<ValidationErrorHandler>` instead of a `ErrorHandler`. Add `QuietErrorHandler` and make this the default. Default behaviour for no-args constructor on `DefaultEventLoggingService` is now to log a single `Logger` message containing all found validation messages at either `ERROR` or `WARN` level as appropriate. Previous behaviour was to log a stacktrace for the first validation failure in LOG mode. THROW mode previously only worked if `ExceptionAndLoggingErrorHandler` was used, now it can be used with `LoggingErrorHandler` or `QuietErrorHandler`, throwing when validation has done as much as it can.

* Make constructor for `event.logging.base.impl.EventLoggerBuilderImpl` public.


## [v6.0-beta.1_schema-v4.1.0] - 2024-06-19

* Change to JAXB 4 dependencies (`javax.xml` => `jakarta.xml`).

* Change minimum Java version to Java 11.

* Issue **gchq/event-logging-schema#86** : Change `PermittedOrganisations.permittedOrganisation` from type `Organistaion` to `List<Organistaion>`.

* Issue **gchq/event-logging-schema#62** : Add field `id` to `AnyContent`.

* Issue **gchq/event-logging-schema#84** : Change `BaseFile.hash` type from `Hash` to `List<Hash>`. This also affects the builder methods in `File` and `Folder`. Replace `withHash(myHash)` with `addHash(myHash)` or `withHash(List.of(myHash))`.

* Issue **gchq/event-logging-schema#80** : Change `Location.floor` type from `BigInteger` to `String`.

* Issue **gchq/event-logging-schema#75** : Add field `changes` to `UpdateEventAction`.

* Issue **gchq/event-logging-schema#85** : Add `IN` enumeration to `TermCondition`.

* Issue **gchq/event-logging-schema#67** : Add field `outcome` to `UnknownEventAction`.

* Issue **gchq/event-logging-schema#74** : Add field `date` to `Email`.

* Issue **gchq/event-logging-schema#69** : Add field `data` to the following classes: `AntiMalwareThreat`, `Door`, `EventTime`, `Location`, `NetworkEventAction`, `SystemDetail`.

* Change the class used for representing dates and times from `java.util.Date` to `java.time.Instant`.

* Issue **gchq/event-logging-schema#76** : Add `Data` element to `Permission` to allow for non-enumerated permission types. Add `Create`, `Delete` and `Use` to `PermissionAttributeSimpleType`.

* Change the java module name from `event.logging.api` to `uk.gov.gchq.eventlogging`.


## [v5.0.3_schema-v4.0.0] - 2023-11-21

* Fix CI build.
Expand Down Expand Up @@ -260,7 +302,9 @@ DO NOT ADD CHANGES HERE - ADD THEM USING log_change.sh
* Revert to java 8


[Unreleased]: https://github.com/gchq/event-logging/compare/v5.0.3_schema-v4.0.0...HEAD
[Unreleased]: https://github.com/gchq/event-logging/compare/v6.0-beta.2_schema-v4.1.0...HEAD
[v6.0-beta.2_schema-v4.1.0]: https://github.com/gchq/event-logging/compare/v6.0-beta.1_schema-v4.1.0...v6.0-beta.2_schema-v4.1.0
[v6.0-beta.1_schema-v4.1.0]: https://github.com/gchq/event-logging/compare/v5.0.3_schema-v4.0.0...v6.0-beta.1_schema-v4.1.0
[v5.0.3_schema-v4.0.0]: https://github.com/gchq/event-logging/compare/v5.0.2_schema-v4.0.0...v5.0.3_schema-v4.0.0
[v5.0.2_schema-v4.0.0]: https://github.com/gchq/event-logging/compare/v5.0.1_schema-v4.0.0...v5.0.2_schema-v4.0.0
[v5.0.1_schema-v4.0.0]: https://github.com/gchq/event-logging/compare/v5.0.0_schema-v4.0.0...v5.0.1_schema-v4.0.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ The Javadoc for the latest release of the library is available [here](https://gc
This library requires Java 8 as a minimum.
The only dependencies it brings with it are:

* `javax.xml.bind:jaxb-api`
* `org.glassfish.jaxb:jaxb-runtime`
* `jakarta.xml.bind:jakarta.xml.bind-api`
* `com.sun.xml.bind:jaxb-impl`
* `org.slf4j:slf4j-api`

By default the created events are serialised to XML and passed to an SLF4J logger which would typically be linked to a rolling file appender.
Expand Down
43 changes: 19 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
plugins {
//plugin for downloading content from the 'net
id "de.undercouch.download" version "3.4.3"
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
id "io.github.gradle-nexus.publish-plugin" version "1.2.0"
//plugin for producing a tree of task dependencies, run task 'taskTree'
id "com.dorongold.task-tree" version "1.5"
id "signing"
Expand All @@ -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 All @@ -67,15 +67,15 @@ ext.getMajorVersion = { versionStr ->

// Set this to the desired release version of the event-logging XML schema on github
// *****************************************************************************
def eventLoggingSchemaVer = "v4.0.0"
def eventLoggingSchemaVer = "v4.1.0"
// *****************************************************************************

// Set this to the last release of this repo on this branch, or earlier branches
// It is used to diff the current jaxb code against the last release so you can
// see if/how the java model has changed following schema changes or changes
// to the jaxb code generation.
// *****************************************************************************
ext.previousReleaseVersion = "v5.0-beta.32_schema-v4.0-beta.10"
ext.previousReleaseVersion = "v5.0.3_schema-v4.0.0"
// *****************************************************************************


Expand Down Expand Up @@ -165,24 +165,20 @@ ext.versions = [
]

// NOTE
// Using beta versions of jaxb libs as they resolve the split pkg problem between jaxb-core and jaxb-runtime
// for running on j9+
// >= v2.3.2 of the jaxb bom pull in the jakarta.xml.bind deps where as the v2.4.0-b one & <v2.3.2 use the old
// javax.xml.bind one.
// XJC code gen is still being done using JAXB 2, but we find/replace javax.xml => jakarta.xml
// so the published -api module can have JAXB 4 deps. Thus there is a mix of JAXB 2/4 deps
// below. Once jaxb-rich-contract-plugin is fixed so we can use its v4.2.0.0+ we can switch
// to all JAXB 4 deps (see https://github.com/mklemm/jaxb-rich-contract-plugin/issues/78)

ext.libs = [
assertj_core : "org.assertj:assertj-core:3.20.2",
classgraph : "io.github.classgraph:classgraph:4.8.146",
jackson_annotations : "com.fasterxml.jackson.core:jackson-annotations:2.13.3",
jackson_databind : "com.fasterxml.jackson.core:jackson-databind:2.13.3",
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 : "javax.xml.bind:jaxb-api", // Version set by jaxb_bom
jaxb_api : "jakarta.xml.bind:jakarta.xml.bind-api:4.0.2",
jaxb_basics : "org.jvnet.jaxb2_commons:jaxb2-basics:0.12.0",
jaxb_rich_contract_plugin : "net.codesup.util:jaxb2-rich-contract-plugin:2.1.0",
jaxb_runtime : "org.glassfish.jaxb:jaxb-runtime", // Version set by jaxb_bom
jaxb_runtime_2 : "org.glassfish.jaxb:jaxb-runtime", // Version set by jaxb_bom
jaxb_impl : "com.sun.xml.bind:jaxb-impl:4.0.4",
jaxb_xjc : "org.glassfish.jaxb:jaxb-xjc", // Version set by jaxb_bom
jaxb_bom : "org.glassfish.jaxb:jaxb-bom:2.4.0-b180830.0438",
jaxb_bom_2 : "org.glassfish.jaxb:jaxb-bom:2.4.0-b180830.0438",
junit_bom : "org.junit:junit-bom:5.10.0",
junit_jupiter_api : "org.junit.jupiter:junit-jupiter-api", // ver controlled by junit_bom
junit_jupiter_engine : "org.junit.jupiter:junit-jupiter-engine", // ver controlled by junit_bom
Expand All @@ -193,12 +189,11 @@ ext.libs = [
mockito_core : "org.mockito:mockito-core:$versions.mockito",
mockito_junit_jupiter : "org.mockito:mockito-junit-jupiter:$versions.mockito",
saxon_he : "net.sf.saxon:Saxon-HE:9.7.0-21",
slf4j_api : "org.slf4j:slf4j-api:1.7.30",
swagger_annotations : "io.swagger.core.v3:swagger-annotations:$versions.swagger",
slf4j_api : "org.slf4j:slf4j-api:1.7.36",
]

// NOTE
//
//

allprojects {
group "uk.gov.gchq.eventlogging" // no spaces as java pkg name convention
Expand All @@ -217,13 +212,13 @@ subprojects {

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
languageVersion = JavaLanguageVersion.of(11)
vendor = JvmVendorSpec.ADOPTIUM
}
}

dependencies {
implementation platform(libs.jaxb_bom)
implementation platform(libs.jaxb_bom_2)
}

//configurations {
Expand Down Expand Up @@ -251,9 +246,9 @@ subprojects {

// This means the reports from our integration tests won't over-write the reports from our unit tests.
tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
reports.html.outputLocation = 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
22 changes: 9 additions & 13 deletions event-logging-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,22 @@ apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'io.swagger.core.v3.swagger-gradle-plugin'

ext.moduleName = 'event.logging.api'
ext.moduleName = 'uk.gov.gchq.eventlogging'

def schemaDir = project.file('schema')

// We want a jar like event-logging-5.0-beta.16_schema-v4.0-beta.3.jar,
// not event-logging-api-5.0-beta.16_schema-v4.0-beta.3.jar
archivesBaseName = "event-logging"
base.archivesName = "event-logging"

dependencies {
implementation libs.jackson_annotations
implementation libs.jackson_databind
compileOnly libs.jakarta_servlet_api
implementation libs.jakarta_ws_rs_api
implementation libs.jaxb_api
implementation libs.swagger_annotations
// The JAXB implementation required for event serialisation to XML
runtimeOnly libs.jaxb_impl

// The production code uses the SLF4J logging API at compile time
implementation libs.slf4j_api

// The JAXB implementation required for event serialisation to XML
runtimeOnly libs.jaxb_runtime

testImplementation libs.classgraph
testImplementation(platform(libs.junit_bom))
testImplementation libs.junit_jupiter_api
testImplementation libs.junit_jupiter_params
Expand Down Expand Up @@ -68,6 +61,8 @@ jar {
)
}
version versions.eventLogging
// We want a jar like event-logging-5.0-beta.16_schema-v4.0-beta.3.jar,
// not event-logging-api-5.0-beta.16_schema-v4.0-beta.3.jar
}

javadoc {
Expand Down Expand Up @@ -195,12 +190,13 @@ tasks.build.dependsOn diffAgainstLatest
task runExampleAppBuild(type: GradleBuild) {
dependsOn publishToMavenLocal

buildFile = '../example-logged-application/build.gradle'
// Defaults to build.gradle
dir = '../example-logged-application'
tasks = ['clean', 'build']
startParameter.projectProperties = [mavenVersion: projectVersionForMaven]

doFirst {
println "Running separate example application build [$buildFile]"
println "Running separate example application build [$dir]"
}
}

Expand Down
26 changes: 0 additions & 26 deletions event-logging-api/openapi.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions event-logging-api/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module uk.gov.gchq.eventlogging {

exports event.logging;
exports event.logging.impl;
exports event.logging.jaxb;
exports event.logging.jaxb.fluent;
exports event.logging.util;

requires transitive jakarta.xml.bind;
requires java.xml;
requires org.slf4j;

opens event.logging to jakarta.xml.bind;
}
7 changes: 1 addition & 6 deletions event-logging-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,10 @@ dependencies {
implementation project(':event-logging-api')

// The production code uses the SLF4J logging API at compile time
implementation libs.jackson_annotations
implementation libs.jackson_databind
compileOnly libs.jakarta_servlet_api
implementation libs.jakarta_ws_rs_api
implementation libs.jaxb_api
implementation libs.slf4j_api
implementation libs.swagger_annotations
runtimeOnly libs.jaxb_impl

testImplementation libs.classgraph
testImplementation(platform(libs.junit_bom))
testImplementation libs.junit_jupiter_api
testImplementation libs.junit_jupiter_params
Expand Down
Loading

0 comments on commit f95ece0

Please sign in to comment.