Skip to content

Commit 073305a

Browse files
docs: left-justify prerequisite tables
1 parent a713ea2 commit 073305a

13 files changed

+391
-77
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ You can include these artifacts in your Maven POM as a dependency.
2929

3030
## Building
3131

32-
This project can be built with [Apache Maven](https://maven.apache.org/) version 3.8.4 or greater.
32+
This project can be built with [Apache Maven](https://maven.apache.org/) version 3.9.0 or greater.
3333

3434
The following instructions can be used to clone and build this project.
3535

src/site/markdown/building.md.vm

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This guide explains how to build ${project.name} from source code.
55
## Prerequisites
66

77
| Requirement | Minimum Version | Notes |
8-
|-------------|-----------------|-------|
8+
|:------------|:----------------|:------|
99
| Java JDK | 17 | Required for building (output JARs are JDK 11 compatible) |
1010
| Maven | 3.9.0 | Required for building |
1111
| Git | 2.0 | Required for cloning |
@@ -154,6 +154,18 @@ mvn install
154154
mvn license:format
155155
```
156156

157+
## Building the Site
158+
159+
To build the project documentation site:
160+
161+
```bash
162+
mvn install site -DskipTests
163+
```
164+
165+
**Note:** The `install` and `site` goals must run together in a single Maven invocation. This is required because the Javadoc plugin needs access to the generated OSCAL model classes, which are only available after the `install` phase completes within the same Maven session.
166+
167+
Running `mvn site` alone will fail with Javadoc errors about missing model classes.
168+
157169
## Generated Sources
158170

159171
OSCAL model classes are generated during the build from Metaschema definitions in the `oscal/` submodule. These generated classes appear in:
@@ -174,5 +186,7 @@ For contribution guidelines, including code style requirements and the pull requ
174186

175187
## Next Steps
176188

189+
Once you've built the project, explore these resources to start using the library:
190+
177191
- [Installation](installation.html) - Add the library to your project
178-
- [API Overview](api-overview.html) - Learn about the core library classes
192+
- [Architecture](guides/architecture.html) - Understand the library structure

src/site/markdown/claude-integration.md.vm

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@ The configuration provides Claude with:
2828

2929
## Claude Plugins
3030

31-
Enhanced capabilities are available through Claude plugins from the [metaschema-framework](https://github.com/metaschema-framework) organization:
31+
Enhanced capabilities are available through [Claude plugins](https://github.com/metaschema-framework/claude-plugins/tree/main) from the metaschema-framework organization:
3232

3333
### OSCAL Plugin
3434

3535
The `oscal` plugin provides OSCAL-specific skills:
3636

3737
| Skill | Description |
38-
|-------|-------------|
38+
|:------|:------------|
3939
| `oscal:oscal-basics` | OSCAL document structure, models, and concepts |
4040

4141
### Metaschema Plugin
4242

4343
The `metaschema` plugin provides Metaschema knowledge:
4444

4545
| Skill | Description |
46-
|-------|-------------|
46+
|:------|:------------|
4747
| `metaschema:metaschema-basics` | Introduction to Metaschema concepts |
4848
| `metaschema:metaschema-module-authoring` | Creating and modifying Metaschema modules |
4949
| `metaschema:metaschema-constraints-authoring` | Writing validation constraints |
@@ -54,7 +54,7 @@ The `metaschema` plugin provides Metaschema knowledge:
5454
The `metaschema-tools` plugin provides CLI and library guidance:
5555

5656
| Skill | Description |
57-
|-------|-------------|
57+
|:------|:------------|
5858
| `metaschema-tools:metaschema-java-library` | Java library interfaces and patterns |
5959
| `metaschema-tools:using-metaschema-java` | CLI commands for validation and conversion |
6060

@@ -63,7 +63,7 @@ The `metaschema-tools` plugin provides CLI and library guidance:
6363
The `oscal-tools` plugin provides CLI guidance:
6464

6565
| Skill | Description |
66-
|-------|-------------|
66+
|:------|:------------|
6767
| `oscal-tools:using-oscal-cli` | OSCAL CLI commands and workflows |
6868

6969
## Installing Plugins
@@ -131,7 +131,9 @@ Claude Code integrates with the development workflow defined in CLAUDE.md:
131131

132132
## Related Resources
133133

134+
For more information about Claude Code and the technologies used in this project:
135+
134136
- [Claude Code Documentation](https://docs.anthropic.com/en/docs/claude-code)
135-
- [Metaschema Framework Plugins](https://github.com/metaschema-framework)
137+
- [Metaschema Framework Plugins](https://github.com/metaschema-framework/claude-plugins/tree/main)
136138
- [OSCAL Documentation](https://pages.nist.gov/OSCAL/)
137139
- [Metaschema Specification](https://metaschema.dev/)

src/site/markdown/guides/architecture.md.vm

Lines changed: 72 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ This guide explains the architecture and module structure of liboscal-java.
44

55
## Overview
66

7-
liboscal-java is built on top of the [Metaschema Java Tools](https://github.com/metaschema-framework/metaschema-java) framework. It provides OSCAL-specific functionality while leveraging the general-purpose Metaschema capabilities.
7+
liboscal-java is built on top of the [Metaschema Java Tools](https://github.com/metaschema-framework/metaschema-java) framework. It provides OSCAL-specific functionality while leveraging the general-purpose Metaschema capabilities for serialization, validation, and querying.
88

9-
## Dependency Hierarchy
9+
Understanding the architecture helps you work effectively with the library, especially when debugging issues or extending its capabilities. The library follows a layered design where each layer builds on the capabilities provided by the layer below.
10+
11+
## Library Structure
12+
13+
This section describes how the library is organized and relates to its dependencies.
14+
15+
### Dependency Hierarchy
16+
17+
The following diagram shows how liboscal-java relates to the underlying Metaschema framework and the OSCAL model definitions:
1018

1119
```
1220
liboscal-java
@@ -18,21 +26,25 @@ liboscal-java
1826
└── OSCAL Metaschema modules (generated model classes)
1927
├── oscal_catalog
2028
├── oscal_profile
29+
├── oscal_mapping
2130
├── oscal_ssp
2231
├── oscal_component-definition
2332
├── oscal_assessment-plan
2433
├── oscal_assessment-results
2534
└── oscal_poam
2635
```
2736

28-
## Package Structure
37+
### Package Structure
38+
39+
The library's Java packages are organized by functionality. The main entry point is `OscalBindingContext`, and all OSCAL model classes live under the `model` subpackage:
2940

3041
```
3142
dev.metaschema.oscal.lib
3243
├── OscalBindingContext # Central entry point
3344
├── model/ # Generated OSCAL model classes
3445
│ ├── Catalog
3546
│ ├── Profile
47+
│ ├── MappingCollection
3648
│ ├── SystemSecurityPlan
3749
│ ├── ComponentDefinition
3850
│ ├── AssessmentPlan
@@ -49,9 +61,11 @@ dev.metaschema.oscal.lib
4961

5062
## Key Components
5163

64+
The following sections describe the main classes you'll interact with when using the library.
65+
5266
### OscalBindingContext
5367

54-
The central class for working with OSCAL documents:
68+
The `OscalBindingContext` is your starting point for all OSCAL operations. It provides factory methods for creating serializers, deserializers, and validators:
5569

5670
```java
5771
OscalBindingContext context = OscalBindingContext.instance();
@@ -72,7 +86,7 @@ StaticContext staticCtx = context.getStaticContext();
7286

7387
### Generated Model Classes
7488

75-
OSCAL model classes are generated during the build from Metaschema definitions:
89+
Rather than hand-writing Java classes for each OSCAL element, the library generates them from the official OSCAL Metaschema definitions. This ensures the Java model always matches the OSCAL specification:
7690

7791
```
7892
oscal/src/main/metaschema/
@@ -89,7 +103,7 @@ target/generated-sources/metaschema/
89103

90104
### ProfileResolver
91105

92-
Resolves OSCAL profiles to catalogs:
106+
One of the most important OSCAL operations is profile resolution—converting a profile (which references controls in external catalogs) into a standalone resolved catalog. The `ProfileResolver` class handles this:
93107

94108
```java
95109
ProfileResolver resolver = new ProfileResolver();
@@ -105,18 +119,22 @@ Catalog resolved = resolver.resolve(profile);
105119

106120
### OSCAL Function Library
107121

108-
OSCAL-specific Metapath functions:
122+
The library extends the base Metapath expression language with OSCAL-specific functions. These are automatically registered when you use `OscalBindingContext`:
109123

110124
| Function | Purpose |
111-
|----------|---------|
125+
|:---------|:--------|
112126
| `has-oscal-namespace` | Check namespace membership |
113127
| `resolve-profile` | Resolve profile imports |
114128
| `resolve-reference` | Resolve internal references |
115129

116130
## Data Flow
117131

132+
Understanding how data flows through the system helps when debugging issues or optimizing performance. This section traces the path of data through the major operations.
133+
118134
### Reading Documents
119135

136+
When you deserialize an OSCAL document, the library detects the format, parses the content, and maps it to Java objects:
137+
120138
```
121139
File/URL
122140
@@ -135,6 +153,8 @@ Application Code
135153

136154
### Writing Documents
137155

156+
Serialization is the reverse process—converting your Java objects back to XML, JSON, or YAML:
157+
138158
```
139159
Model Objects
140160
@@ -149,6 +169,8 @@ File/Stream
149169

150170
### Profile Resolution
151171

172+
Profile resolution is more complex because it may involve loading external resources and applying multiple transformations:
173+
152174
```
153175
Profile (with imports)
154176
@@ -163,14 +185,16 @@ Merge Controls
163185
Resolved Catalog
164186
```
165187

166-
## Integration Points
188+
## Integration and Extension
167189

168-
### Metaschema Framework
190+
This section describes how the library integrates with the Metaschema ecosystem and how you can extend it.
169191

170-
liboscal-java extends the Metaschema framework:
192+
### Metaschema Framework Integration
193+
194+
liboscal-java extends the base Metaschema framework with OSCAL-specific functionality. The following table shows how the library maps to Metaschema components:
171195

172196
| Metaschema Component | liboscal-java Usage |
173-
|---------------------|---------------------|
197+
|:---------------------|:--------------------|
174198
| `IBindingContext` | `OscalBindingContext` extends it |
175199
| `IDeserializer` | Load OSCAL documents |
176200
| `ISerializer` | Write OSCAL documents |
@@ -179,24 +203,40 @@ liboscal-java extends the Metaschema framework:
179203

180204
### Extension Points
181205

182-
**Custom Metapath Functions:**
206+
The library provides hooks for adding custom functionality without modifying the core code.
207+
208+
#### Custom Metapath Functions
209+
210+
You can extend the Metapath query language with domain-specific functions. This is useful when you need operations that aren't provided by the built-in function library:
211+
183212
```java
184213
// Register custom function
185214
context.registerFunction(myCustomFunction);
186215
```
187216

188-
**Custom Constraint Handlers:**
217+
#### Custom Constraint Handlers
218+
219+
To customize how constraint violations are reported or handled, implement your own validation handler. This allows integration with logging frameworks, custom error reporting, or workflow systems:
220+
189221
```java
190222
IConstraintValidationHandler handler = new MyHandler();
191223
deserializer.setConstraintValidationHandler(handler);
192224
```
193225

194-
## Threading Model
226+
## Runtime Considerations
227+
228+
This section covers topics important when deploying applications that use the library.
229+
230+
### Threading Model
231+
232+
When using the library in multi-threaded applications, understanding which components are thread-safe helps avoid subtle bugs. The general pattern is to share the context but create fresh serializers and deserializers for each operation:
195233

196-
- `OscalBindingContext.instance()` is thread-safe
234+
- `OscalBindingContext.instance()` is thread-safe for reading configuration
197235
- Deserializers are single-use (create new per operation)
198236
- Serializers are single-use (create new per operation)
199-
- Model objects are not thread-safe for modification
237+
- Model objects are not thread-safe for concurrent modification
238+
239+
The following example shows the recommended pattern for parallel processing:
200240

201241
```java
202242
// Good: Shared context, per-operation deserializers
@@ -209,14 +249,18 @@ executor.submit(() -> {
209249
});
210250
```
211251

212-
## Memory Considerations
252+
### Memory Considerations
253+
254+
OSCAL documents can vary significantly in size, from small component definitions to comprehensive catalogs like NIST SP 800-53. Keep these factors in mind when working with larger documents:
213255

214-
- Large catalogs (SP 800-53) can consume significant memory
215-
- Consider streaming for very large documents
216-
- Profile resolution loads entire import chain into memory
256+
- Large catalogs (SP 800-53) can consume significant memory when fully loaded
257+
- Consider streaming approaches for very large documents if you only need to process portions
258+
- Profile resolution loads the entire import chain into memory, which can be substantial for profiles with deep import hierarchies
217259

218260
## Build Process
219261

262+
The library uses Maven for its build process. A key step is the automatic generation of Java model classes from the OSCAL Metaschema definitions. This ensures the Java API always matches the official OSCAL specification:
263+
220264
```
221265
1. Compile Metaschema Sources
222266
@@ -229,16 +273,22 @@ executor.submit(() -> {
229273
5. Package JAR
230274
```
231275

276+
If you're building from source, the generated classes appear in `target/generated-sources/metaschema/` and are automatically included in the compilation.
277+
232278
## Related Projects
233279

280+
liboscal-java is part of a larger ecosystem of tools for working with OSCAL and Metaschema. Understanding these relationships helps when you need to trace issues or find additional capabilities:
281+
234282
| Project | Relationship |
235-
|---------|--------------|
283+
|:--------|:-------------|
236284
| [metaschema-java](https://github.com/metaschema-framework/metaschema-java) | Core framework dependency |
237285
| [oscal-cli](https://github.com/metaschema-framework/oscal-cli) | CLI built on liboscal-java |
238286
| [OSCAL](https://github.com/usnistgov/OSCAL) | Source Metaschema definitions |
239287

240288
## Next Steps
241289

290+
Continue learning about liboscal-java with these related guides:
291+
242292
- [Loading OSCAL Modules](loading-oscal-modules.html) - Get started with the context
243293
- [Reading & Writing Data](reading-writing-data.html) - Work with documents
244294
- [Installation](../installation.html) - Add to your project

src/site/markdown/guides/executing-metapath.md.vm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ import dev.metaschema.core.metapath.MetapathExpression;
1515
import dev.metaschema.core.metapath.IMetapathExpression;
1616
import dev.metaschema.core.metapath.item.IItem;
1717
import dev.metaschema.core.metapath.item.ISequence;
18-
import dev.metaschema.databind.model.IBoundObject;
18+
import dev.metaschema.databind.io.Format;
19+
import dev.metaschema.databind.io.IDeserializer;
20+
import java.nio.file.Path;
1921

2022
OscalBindingContext context = OscalBindingContext.instance();
2123

2224
// Load a catalog
23-
Catalog catalog = loadCatalog("catalog.json");
25+
IDeserializer<Catalog> deserializer = context.newDeserializer(
26+
Format.JSON, Catalog.class);
27+
Catalog catalog = deserializer.deserialize(Path.of("catalog.json"));
2428

2529
// Compile an expression
2630
IMetapathExpression expression = MetapathExpression.compile(
@@ -262,6 +266,8 @@ public class MetapathQueryCache {
262266

263267
## Next Steps
264268

269+
Continue learning about liboscal-java with these related guides:
270+
265271
- [Validating with Constraints](validating-with-constraints.html) - Validate queried data
266272
- [Reading & Writing Data](reading-writing-data.html) - Load documents to query
267273
- [Architecture](architecture.html) - Understand Metapath internals

0 commit comments

Comments
 (0)