Apache Sling JCR Resource Resolver

Clone this repo:
  1. ec69c71 docs: tighten AGENTS.md and README.md project documentation (#56) by Carsten Ziegeler · 12 hours ago master
  2. 7eaad02 Add security section to AGENTS.md by Robert Munteanu · 6 weeks ago
  3. 902ecca docs: expand AGENTS.md and README.md with new files and commands (#55) by Carsten Ziegeler · 6 weeks ago
  4. cd3a450 docs: add AGENTS.md, CLAUDE.md and expand README (#54) by Carsten Ziegeler · 6 weeks ago
  5. a7fec37 Merge pull request #53 from apache/maia/workflow-1779948574717 by Carsten Ziegeler · 7 weeks ago

Apache Sling

Build Status Test Status Coverage Sonarcloud Status JavaDoc Maven Central jcr License

Apache Sling JCR Resource

This module is part of the Apache Sling project.

This bundle provides Sling's JCR-backed resource provider and resolver internals. It maps JCR nodes and properties to Sling Resource objects, handles provider/session lifecycle, supports query and binary download integrations, exposes JCR-backed ValueMap implementations, and emits resource change events from JCR observation.

Build and test

# Build and package (skip tests)
mvn clean package -DskipTests

# Full build (including tests)
mvn clean install

# Run all tests
mvn test

# Run a single test class
mvn test -Dtest=JcrResourceProviderTest

# Run session lifecycle/provider handling tests
mvn test -Dtest=JcrResourceProviderSessionHandlingTest

# Run a single test method
mvn test -Dtest=JcrValueMapTest#testPutMultipleValues

# Generate coverage report
mvn test jacoco:report

Development checks

# Apply formatting
mvn spotless:apply

# Check formatting
mvn spotless:check

# Verify license headers
mvn apache-rat:check

# Check API baseline compatibility
mvn bnd-baseline:baseline

Repository layout

pom.xml                          Maven build descriptor
bnd.bnd                          OSGi metadata and package instructions
src/
  main/
    java/org/apache/sling/jcr/resource/
      api/                       Public API (JcrResourceChange, JcrResourceConstants)
      internal/                  Internal implementation
        helper/                  Conversion utilities, cache entry, access logging, lazy streams
        helper/jcr/              Core JCR ResourceProvider, provider state, query/binary support
        scripting/               Optional scripting bindings integration
    resources/SLING-INF/nodetypes/
                                 Sling/JCR node type definitions (folder, resource, vanitypath, redirect, mapping)
  test/
    java/                        JUnit 4 tests plus shared test infrastructure
target/                          Build output (generated classes, OSGI-INF, SLING-INF, surefire-reports, baseline report)
                                 Includes generated-sources/annotations and generated-test-sources/test-annotations

Key technical details

  • Java source/target level is Java 8 (sling.java.version=8).
  • Parent POM is org.apache.sling:sling-bundle-parent:66.
  • Current artifact development version is 3.3.7-SNAPSHOT.
  • Oak baseline is 1.44.0 (minimum required for JackrabbitNode.getPropertyOrNull support).
  • Jackrabbit baseline is 2.18.0.
  • org.apache.sling.scripting.api is optional at runtime (resolution:=optional in bnd.bnd).
  • Adapter metadata is generated by sling-maven-plugin during process-classes.
  • org.apache.jackrabbit.util and org.apache.jackrabbit.name are embedded via -conditionalpackage.
  • Bundle nodetypes are provided from src/main/resources/SLING-INF/nodetypes/ (folder.cnd, resource.cnd, vanitypath.cnd, redirect.cnd, mapping.cnd).