Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metaschema-java 1.0.0 updates #174

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To list all file extensions:
# git ls-files | awk -F . {'print $NF'}|sort -u
#
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
108 changes: 90 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>gov.nist.secauto</groupId>
<artifactId>oss-parent</artifactId>
<version>27</version>
<version>28-SNAPSHOT</version>
</parent>
<groupId>gov.nist.secauto.oscal.tools.oscal-cli</groupId>
<artifactId>cli-core</artifactId>
Expand Down Expand Up @@ -78,8 +80,8 @@
</mailingLists>
<properties>
<!-- metaschema dependencies -->
<dependency.metaschema-framework.version>0.12.2</dependency.metaschema-framework.version>
<dependency.liboscal-java.version>3.0.3</dependency.liboscal-java.version>
<dependency.metaschema-framework.version>1.0.0-M2-SNAPSHOT</dependency.metaschema-framework.version>
<dependency.liboscal-java.version>3.0.4-SNAPSHOT</dependency.liboscal-java.version>

<!-- site configuration -->
<site.url>https://pages.nist.gov/metaschema-java/</site.url>
Expand Down Expand Up @@ -109,16 +111,23 @@

<!-- other dependencies -->
<dependency.auto-service.version>1.1.1</dependency.auto-service.version>
<dependency.commons-cli.version>1.5.0</dependency.commons-cli.version>
<dependency.commons-io.version>2.15.1</dependency.commons-io.version>
<dependency.commons-cli.version>1.7.0</dependency.commons-cli.version>
<dependency.commons-io.version>2.16.1</dependency.commons-io.version>
<dependency.everit-json.version>1.14.4</dependency.everit-json.version>
<dependency.jansi.version>2.4.1</dependency.jansi.version>
<dependency.jline.version>3.21.0</dependency.jline.version>
<dependency.log4j2.version>2.20.0</dependency.log4j2.version>
<dependency.spotbugs-annotations.version>4.7.3</dependency.spotbugs-annotations.version>
<dependency.json.version>20240303</dependency.json.version>
<dependency.log4j2.version>2.23.1</dependency.log4j2.version>
<dependency.pmd.version>7.1.0</dependency.pmd.version>
<dependency.spotbugs-annotations.version>4.8.3</dependency.spotbugs-annotations.version>
<dependency.saxon-he.version>12.4</dependency.saxon-he.version>
<dependency.xmlresolver.version>6.0.2</dependency.xmlresolver.version>
<dependency.xmlbeans.version>5.2.0</dependency.xmlbeans.version>
<dependency.xmlresolver.version>5.2.2</dependency.xmlresolver.version>

<plugin.license.version>4.2</plugin.license.version>
<plugin.maven-toolchains.version>3.1.0</plugin.maven-toolchains.version>
<plugin.pmd.version>3.22.0</plugin.pmd.version>
<plugin.spotbugs.version>4.8.4.0</plugin.spotbugs.version>
</properties>
<repositories>
<repository>
Expand Down Expand Up @@ -215,11 +224,22 @@
<classifier>data</classifier>
<version>${dependency.xmlresolver.version}</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>${dependency.xmlbeans.version}</version>
</dependency>
<dependency>
<groupId>com.github.erosb</groupId>
<artifactId>everit-json-schema</artifactId>
<version>${dependency.everit-json.version}</version>
</dependency>
<dependency>
<!-- for dependency convergence -->
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${dependency.json.version}</version>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
Expand All @@ -228,12 +248,7 @@
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -260,6 +275,27 @@

<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>${plugin.maven-toolchains.version}</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>11</version>
<vendor>temurin</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
Expand All @@ -282,13 +318,50 @@
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${plugin.spotbugs.version}</version>
<configuration>
<excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${plugin.pmd.version}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${dependency.pmd.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${dependency.pmd.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>pmd-verify</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<failurePriority>2</failurePriority>
<!-- fail on error for all builds -->
<failOnViolation>true</failOnViolation>
<printFailingErrors>true</printFailingErrors>
<format>sarif</format>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
Expand Down Expand Up @@ -428,9 +501,8 @@
<thirdPartyFilename>LICENSE-THIRD-PARTY.txt</thirdPartyFilename>
<licenseMerges>
<licenseMerge>The Apache Software License,
Version 2.0|Apache
License, Version 2.0|Apache Public License
2.0</licenseMerge>
Version 2.0|Apache License, Version
2.0|Apache Public License 2.0</licenseMerge>
</licenseMerges>
</configuration>
</execution>
Expand Down
3 changes: 3 additions & 0 deletions src/main/assembly/bin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<outputDirectory>/lib</outputDirectory>
<outputFileNameMapping>${artifact.groupId}.${artifact.artifactId}-${artifact.version}.${artifact.extension}</outputFileNameMapping>
<useProjectArtifact>true</useProjectArtifact>
<excludes>
<exclude>org.jetbrains:annotations</exclude>
</excludes>
</dependencySet>
</dependencySets>
<fileSets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

package gov.nist.secauto.oscal.tools.cli.core;

import gov.nist.secauto.metaschema.model.common.util.IVersionInfo;
import gov.nist.secauto.metaschema.core.util.IVersionInfo;

public class OscalCliVersion implements IVersionInfo {

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gov/nist/secauto/oscal/tools/cli/core/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@

import gov.nist.secauto.metaschema.cli.processor.CLIProcessor;
import gov.nist.secauto.metaschema.cli.processor.ExitStatus;
import gov.nist.secauto.metaschema.model.MetaschemaVersion;
import gov.nist.secauto.metaschema.model.common.util.IVersionInfo;
import gov.nist.secauto.metaschema.model.common.util.MetaschemaJavaVersion;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import gov.nist.secauto.metaschema.core.MetaschemaJavaVersion;
import gov.nist.secauto.metaschema.core.model.MetaschemaVersion;
import gov.nist.secauto.metaschema.core.util.IVersionInfo;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.oscal.lib.LibOscalVersion;
import gov.nist.secauto.oscal.lib.OscalVersion;
import gov.nist.secauto.oscal.tools.cli.core.commands.assessmentplan.AssessmentPlanCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import gov.nist.secauto.metaschema.cli.processor.command.DefaultExtraArgument;
import gov.nist.secauto.metaschema.cli.processor.command.ExtraArgument;
import gov.nist.secauto.metaschema.cli.processor.command.ICommandExecutor;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@

package gov.nist.secauto.oscal.tools.cli.core.commands.assessmentplan;

import gov.nist.secauto.metaschema.binding.io.xml.XmlUtil;
import gov.nist.secauto.metaschema.model.common.util.CollectionUtil;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import gov.nist.secauto.metaschema.model.common.validation.JsonSchemaContentValidator;
import gov.nist.secauto.metaschema.core.model.util.JsonUtil;
import gov.nist.secauto.metaschema.core.model.util.XmlUtil;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.oscal.lib.OscalBindingContext;
import gov.nist.secauto.oscal.tools.cli.core.commands.oscal.AbstractOscalValidationSubcommand;

import org.json.JSONObject;

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

Expand All @@ -52,16 +53,16 @@ public String getDescription() {
protected List<Source> getOscalXmlSchemas() throws IOException {
List<Source> retval = new LinkedList<>();
retval.add(
ObjectUtils.requireNonNull(
XmlUtil.getStreamSource(
OscalBindingContext.class.getResource("/schema/xml/oscal-ap_schema.xsd"))));
XmlUtil.getStreamSource(ObjectUtils.requireNonNull(
OscalBindingContext.class.getResource("/schema/xml/oscal-ap_schema.xsd"))));
return CollectionUtil.unmodifiableList(retval);
}

@Override
protected JSONObject getOscalJsonSchema() {
return JsonSchemaContentValidator.toJsonObject(
ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-ap_schema.json")));
protected JSONObject getOscalJsonSchema() throws IOException {
try (InputStream is = ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-ap_schema.json"))) {
return JsonUtil.toJsonObject(is);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@

package gov.nist.secauto.oscal.tools.cli.core.commands.assessmentresults;

import gov.nist.secauto.metaschema.binding.io.xml.XmlUtil;
import gov.nist.secauto.metaschema.model.common.util.CollectionUtil;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import gov.nist.secauto.metaschema.model.common.validation.JsonSchemaContentValidator;
import gov.nist.secauto.metaschema.core.model.util.JsonUtil;
import gov.nist.secauto.metaschema.core.model.util.XmlUtil;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.oscal.lib.OscalBindingContext;
import gov.nist.secauto.oscal.tools.cli.core.commands.oscal.AbstractOscalValidationSubcommand;

import org.json.JSONObject;

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

Expand All @@ -52,16 +53,16 @@ public String getDescription() {
protected List<Source> getOscalXmlSchemas() throws IOException {
List<Source> retval = new LinkedList<>();
retval.add(
ObjectUtils.requireNonNull(
XmlUtil.getStreamSource(
OscalBindingContext.class.getResource("/schema/xml/oscal-ar_schema.xsd"))));
XmlUtil.getStreamSource(ObjectUtils.requireNonNull(
OscalBindingContext.class.getResource("/schema/xml/oscal-ar_schema.xsd"))));
return CollectionUtil.unmodifiableList(retval);
}

@Override
protected JSONObject getOscalJsonSchema() {
return JsonSchemaContentValidator.toJsonObject(
ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-ar_schema.json")));
protected JSONObject getOscalJsonSchema() throws IOException {
try (InputStream is = ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-ar_schema.json"))) {
return JsonUtil.toJsonObject(is);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@

package gov.nist.secauto.oscal.tools.cli.core.commands.catalog;

import gov.nist.secauto.metaschema.binding.io.xml.XmlUtil;
import gov.nist.secauto.metaschema.model.common.util.CollectionUtil;
import gov.nist.secauto.metaschema.model.common.util.ObjectUtils;
import gov.nist.secauto.metaschema.model.common.validation.JsonSchemaContentValidator;
import gov.nist.secauto.metaschema.core.model.util.JsonUtil;
import gov.nist.secauto.metaschema.core.model.util.XmlUtil;
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;
import gov.nist.secauto.oscal.lib.OscalBindingContext;
import gov.nist.secauto.oscal.tools.cli.core.commands.oscal.AbstractOscalValidationSubcommand;

import org.json.JSONObject;

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

Expand All @@ -52,15 +53,16 @@ public String getDescription() {
protected List<Source> getOscalXmlSchemas() throws IOException {
List<Source> retval = new LinkedList<>();
retval.add(
ObjectUtils.requireNonNull(
XmlUtil.getStreamSource(OscalBindingContext.class.getResource("/schema/xml/oscal-catalog_schema.xsd"))));
XmlUtil.getStreamSource(ObjectUtils.requireNonNull(
OscalBindingContext.class.getResource("/schema/xml/oscal-catalog_schema.xsd"))));
return CollectionUtil.unmodifiableList(retval);
}

@Override
protected JSONObject getOscalJsonSchema() {
return JsonSchemaContentValidator.toJsonObject(
ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-catalog_schema.json")));
protected JSONObject getOscalJsonSchema() throws IOException {
try (InputStream is = ObjectUtils.requireNonNull(
OscalBindingContext.class.getResourceAsStream("/schema/json/oscal-catalog_schema.json"))) {
return JsonUtil.toJsonObject(is);
}
}
}
Loading
Loading