You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/building.md.vm
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ This guide explains how to build ${project.name} from source code.
5
5
## Prerequisites
6
6
7
7
| Requirement | Minimum Version | Notes |
8
-
|-------------|-----------------|-------|
8
+
|:------------|:----------------|:------|
9
9
| Java JDK | 17 | Required for building (output JARs are JDK 11 compatible) |
10
10
| Maven | 3.9.0 | Required for building |
11
11
| Git | 2.0 | Required for cloning |
@@ -154,6 +154,18 @@ mvn install
154
154
mvn license:format
155
155
```
156
156
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
+
157
169
## Generated Sources
158
170
159
171
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
174
186
175
187
## Next Steps
176
188
189
+
Once you've built the project, explore these resources to start using the library:
190
+
177
191
- [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
Copy file name to clipboardExpand all lines: src/site/markdown/claude-integration.md.vm
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -28,22 +28,22 @@ The configuration provides Claude with:
28
28
29
29
## Claude Plugins
30
30
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:
32
32
33
33
### OSCAL Plugin
34
34
35
35
The `oscal` plugin provides OSCAL-specific skills:
36
36
37
37
| Skill | Description |
38
-
|-------|-------------|
38
+
|:------|:------------|
39
39
| `oscal:oscal-basics` | OSCAL document structure, models, and concepts |
40
40
41
41
### Metaschema Plugin
42
42
43
43
The `metaschema` plugin provides Metaschema knowledge:
44
44
45
45
| Skill | Description |
46
-
|-------|-------------|
46
+
|:------|:------------|
47
47
| `metaschema:metaschema-basics` | Introduction to Metaschema concepts |
48
48
| `metaschema:metaschema-module-authoring` | Creating and modifying Metaschema modules |
Copy file name to clipboardExpand all lines: src/site/markdown/guides/architecture.md.vm
+72-22Lines changed: 72 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,17 @@ This guide explains the architecture and module structure of liboscal-java.
4
4
5
5
## Overview
6
6
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.
8
8
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:
10
18
11
19
```
12
20
liboscal-java
@@ -18,21 +26,25 @@ liboscal-java
18
26
└── OSCAL Metaschema modules (generated model classes)
19
27
├── oscal_catalog
20
28
├── oscal_profile
29
+
├── oscal_mapping
21
30
├── oscal_ssp
22
31
├── oscal_component-definition
23
32
├── oscal_assessment-plan
24
33
├── oscal_assessment-results
25
34
└── oscal_poam
26
35
```
27
36
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:
29
40
30
41
```
31
42
dev.metaschema.oscal.lib
32
43
├── OscalBindingContext # Central entry point
33
44
├── model/ # Generated OSCAL model classes
34
45
│ ├── Catalog
35
46
│ ├── Profile
47
+
│ ├── MappingCollection
36
48
│ ├── SystemSecurityPlan
37
49
│ ├── ComponentDefinition
38
50
│ ├── AssessmentPlan
@@ -49,9 +61,11 @@ dev.metaschema.oscal.lib
49
61
50
62
## Key Components
51
63
64
+
The following sections describe the main classes you'll interact with when using the library.
65
+
52
66
### OscalBindingContext
53
67
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:
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:
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:
The library extends the base Metapath expression language with OSCAL-specific functions. These are automatically registered when you use `OscalBindingContext`:
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
+
118
134
### Reading Documents
119
135
136
+
When you deserialize an OSCAL document, the library detects the format, parses the content, and maps it to Java objects:
137
+
120
138
```
121
139
File/URL
122
140
↓
@@ -135,6 +153,8 @@ Application Code
135
153
136
154
### Writing Documents
137
155
156
+
Serialization is the reverse process—converting your Java objects back to XML, JSON, or YAML:
157
+
138
158
```
139
159
Model Objects
140
160
↓
@@ -149,6 +169,8 @@ File/Stream
149
169
150
170
### Profile Resolution
151
171
172
+
Profile resolution is more complex because it may involve loading external resources and applying multiple transformations:
173
+
152
174
```
153
175
Profile (with imports)
154
176
↓
@@ -163,14 +185,16 @@ Merge Controls
163
185
Resolved Catalog
164
186
```
165
187
166
-
## Integration Points
188
+
## Integration and Extension
167
189
168
-
### Metaschema Framework
190
+
This section describes how the library integrates with the Metaschema ecosystem and how you can extend it.
169
191
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:
171
195
172
196
| Metaschema Component | liboscal-java Usage |
173
-
|---------------------|---------------------|
197
+
|:---------------------|:--------------------|
174
198
| `IBindingContext` | `OscalBindingContext` extends it |
175
199
| `IDeserializer` | Load OSCAL documents |
176
200
| `ISerializer` | Write OSCAL documents |
@@ -179,24 +203,40 @@ liboscal-java extends the Metaschema framework:
179
203
180
204
### Extension Points
181
205
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
+
183
212
```java
184
213
// Register custom function
185
214
context.registerFunction(myCustomFunction);
186
215
```
187
216
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
+
189
221
```java
190
222
IConstraintValidationHandler handler = new MyHandler();
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:
195
233
196
-
- `OscalBindingContext.instance()` is thread-safe
234
+
- `OscalBindingContext.instance()` is thread-safe for reading configuration
197
235
- Deserializers are single-use (create new per operation)
198
236
- 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:
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:
213
255
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
217
259
218
260
## Build Process
219
261
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
+
220
264
```
221
265
1. Compile Metaschema Sources
222
266
↓
@@ -229,16 +273,22 @@ executor.submit(() -> {
229
273
5. Package JAR
230
274
```
231
275
276
+
If you're building from source, the generated classes appear in `target/generated-sources/metaschema/` and are automatically included in the compilation.
277
+
232
278
## Related Projects
233
279
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:
0 commit comments