Skip to content

Commit

Permalink
Updating to latest metaschema-java:1.0.0-M2-SNAPSHOT.
Browse files Browse the repository at this point in the history
  • Loading branch information
david-waltermire committed Oct 19, 2023
1 parent 235ce9b commit 8ec833a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>gov.nist.secauto</groupId>
<artifactId>oss-parent</artifactId>
<version>27-SNAPSHOT</version>
<version>28-SNAPSHOT</version>
</parent>

<groupId>gov.nist.secauto.oscal</groupId>
Expand Down Expand Up @@ -124,7 +124,7 @@
<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<dependency.metaschema-framework.version>1.0.0-SNAPSHOT</dependency.metaschema-framework.version>
<dependency.metaschema-framework.version>1.0.0-M2-SNAPSHOT</dependency.metaschema-framework.version>

<dependency.auto-service.version>1.0.1</dependency.auto-service.version>
<dependency.commons-lang3.version>3.13.0</dependency.commons-lang3.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public final class HasOscalNamespace {
static final IFunction SIGNATURE_ONE_ARG = IFunction.builder()
.name("has-oscal-namespace")
.namespace(OscalBindingContext.NS_OSCAL)
.argument(IArgument.newBuilder()
.argument(IArgument.builder()
.name("namespace")
.type(IStringItem.class)
.oneOrMore()
Expand All @@ -74,12 +74,12 @@ public final class HasOscalNamespace {
static final IFunction SIGNATURE_TWO_ARGS = IFunction.builder()
.name("has-oscal-namespace")
.namespace(OscalBindingContext.NS_OSCAL)
.argument(IArgument.newBuilder()
.argument(IArgument.builder()
.name("propOrPart")
.type(IAssemblyNodeItem.class)
.one()
.build())
.argument(IArgument.newBuilder()
.argument(IArgument.builder()
.name("namespace")
.type(IStringItem.class)
.oneOrMore()
Expand Down Expand Up @@ -173,10 +173,10 @@ public static IBooleanItem hasNamespace(

Object defaultValue = flag.getDefinition().getDefaultValue();
if (defaultValue != null) {
nodeNamespace = IAnyUriItem.valueOf(ObjectUtils.notNull(defaultValue.toString())).getValue();
nodeNamespace = IAnyUriItem.valueOf(ObjectUtils.notNull(defaultValue.toString())).asUri();
}
} else {
nodeNamespace = IAnyUriItem.cast(FnData.fnDataItem(ns)).getValue();
nodeNamespace = IAnyUriItem.cast(FnData.fnDataItem(ns)).asUri();
}

String nodeNamespaceString = AbstractProperty.normalizeNamespace(nodeNamespace).toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class ResolveProfile {
static final IFunction SIGNATURE_ONE_ARG = IFunction.builder()
.name("resolve-profile")
.namespace(OscalBindingContext.NS_OSCAL)
.argument(IArgument.newBuilder()
.argument(IArgument.builder()
.name("profile")
.type(INodeItem.class)
.zeroOrOne()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

package gov.nist.secauto.oscal.lib.profile.resolver;

import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream;

import gov.nist.secauto.metaschema.core.metapath.DynamicContext;
import gov.nist.secauto.metaschema.core.metapath.IDocumentLoader;
import gov.nist.secauto.metaschema.core.metapath.ISequence;
Expand Down Expand Up @@ -81,7 +79,6 @@

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
Expand Down Expand Up @@ -159,7 +156,7 @@ public void setBoundLoader(@NonNull IBoundLoader loader) {
public DynamicContext getDynamicContext() {
synchronized (this) {
if (dynamicContext == null) {
dynamicContext = StaticContext.builder().build().newDynamicContext();
dynamicContext = StaticContext.builder().build().dynamicContext();
dynamicContext.setDocumentLoader(getBoundLoader());
}
assert dynamicContext != null;
Expand Down Expand Up @@ -446,9 +443,7 @@ private IDocumentNodeItem getImport(
if (buffer != null) {
URI resourceUri = baseUri.resolve("#" + resource.getUuid());
assert resourceUri != null;
try (InputStream is = new ByteBufferBackedInputStream(buffer)) {
retval = loader.loadAsNodeItem(is, resourceUri);
}
retval = loader.loadAsNodeItem(resourceUri);
}

if (retval == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private static void handleMarkup(
@NonNull IFieldNodeItem item,
@NonNull Context context) {
IMarkupItem markupItem = (IMarkupItem) FnData.fnDataItem(item);
IMarkupString<?> markup = markupItem.getValue();
IMarkupString<?> markup = markupItem.asMarkup();
handleMarkup(item, markup, context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void testConstraintValidation()
IDocumentNodeItem nodeItem = loader.loadAsNodeItem(new URL(
"https://raw.githubusercontent.com/Rene2mt/fedramp-automation/a692b9385d8fbcacbb1d3e3d0b0d7e3c45a205d0/src/content/baselines/rev5/xml/FedRAMP_rev5_HIGH-baseline_profile.xml"));

DynamicContext dynamicContext = StaticContext.builder().build().newDynamicContext();
DynamicContext dynamicContext = StaticContext.instance().dynamicContext();
dynamicContext.setDocumentLoader(loader);
FindingCollectingConstraintValidationHandler handler = new FindingCollectingConstraintValidationHandler();
DefaultConstraintValidator validator = new DefaultConstraintValidator(dynamicContext, handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void test() throws FileNotFoundException, IOException, URISyntaxException {
StaticContext staticContext = StaticContext.builder()
.baseUri(baseUri)
.build();
DynamicContext dynamicContext = staticContext.newDynamicContext();
DynamicContext dynamicContext = staticContext.dynamicContext();
dynamicContext.setDocumentLoader(loader);

// File file = new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class ProfileResolutionTests {

@BeforeAll
static void setup() throws SaxonApiException {
DynamicContext context = StaticContext.builder().build().newDynamicContext();
DynamicContext context = StaticContext.instance().dynamicContext();
context.setDocumentLoader(new DefaultBoundLoader(OscalBindingContext.instance()));
profileResolver = new ProfileResolver();
profileResolver.setDynamicContext(context);
Expand Down

0 comments on commit 8ec833a

Please sign in to comment.