oak-store-document-add-config
Add a new OSGi configuration property to the oak-store-document module. Modifies Configuration.java, DocumentNodeStoreService.java, DocumentNodeStoreBuilder.java, RDBDocumentNodeStoreBuilder.java, Utils.java, and all relevant test files with 90%+ coverage.
インストール方法を見る含まれるファイル(4)
- SKILL.md7.6 KB
- osgi-config-patterns.md4.3 KB
- test-patterns.md4.7 KB
- wiring-and-verification.md2.4 KB
SKILL.md(原文)
インストールする前に、エージェントに与えられる指示の中身を確認できます。
oak-add-config Skill
You are an expert in the Apache Jackrabbit Oak oak-store-document module. When this skill is invoked, you will add a new OSGi configuration property.
Supporting files
- Detailed production code patterns (steps 2–6): osgi-config-patterns.md
- Detailed test patterns (steps 7–10): test-patterns.md
- Wiring into usage class + compile/test (steps 11–12): wiring-and-verification.md
REQUIRED INPUT
The user must provide these values when invoking the skill. If any are missing, stop and ask:
| Parameter | Description | Example |
|---|---|---|
configName | camelCase OSGi attribute method name | avoidExclusiveMergeLock |
type | Java type: boolean, int, long, String | boolean |
defaultValue is optional — if not provided, use the Java default for the given type:
boolean→falseint/long→0String→""
The following are optional — derive or infer them if not provided:
| Parameter | Description | How to derive if missing |
|---|---|---|
jiraId | JIRA ticket ID | Deduce from current branch name (see below) |
attrName | Human-readable OSGi display name | Convert configName from camelCase to Title Case |
description | Full OSGi description text | Ask the user for a brief description, then expand it |
scope | both, mongo-only, or rdb-only | Ask the user explicitly. Default is mongo-only. |
featureToggle | Whether to add a feature toggle (true / false) | Ask the user explicitly. Default is false. |
Deducing
jiraIdfrom the branch: Rungit branch --show-currentand extract the JIRA ID (e.g.OAK-12139→jiraId=OAK-12139;issue/OAK-12139→jiraId=OAK-12139). If it differs from a user-supplied value, warn. If none can be deduced, ask.
Before proceeding, ask both optional questions in a single prompt:
- "Which backends does this config apply to? (mongo-only / rdb-only / both, default: mongo-only)"
- "Do you want a feature toggle for this config? (yes/no, default: no)"
DERIVED IDENTIFIERS
From the inputs, derive:
DEFAULT_CONST→DEFAULT_+ UPPER_SNAKE_CASE ofconfigNamee.g.avoidExclusiveMergeLock→DEFAULT_AVOID_EXCLUSIVE_MERGE_LOCKsetterName→set+ PascalCase(configName)getterName→ same asconfigNameutilsMethod→is+ PascalCase(configName stripped ofavoid/enable/use) +Enablede.g.isAvoidMergeLockEnabled
featureToggle=true only:
FT_NAME_CONST→FT_NAME_+ UPPER_SNAKE_CASE of configNameFT_VALUE→"FT_"+ UPPER_SNAKE +"_"+ jiraIdfeatureField→docStore+ PascalCase(configName stripped of trailingEnabled) +Feature
EXECUTION STEPS
Work through every step in order. Do NOT skip any step.
Read the supporting files as you reach each group of steps.
- Read key files — locate insertion points in all 9 files (listed below)
- Configuration.java — add
@AttributeDefinition+ import → see osgi-config-patterns.md - DocumentNodeStoreService.java — DEFAULT constant, FT_NAME, Feature field, activate/deactivate, configureBuilder → see osgi-config-patterns.md
- DocumentNodeStoreBuilder.java — value field, getter/setter, Feature getter/setter → see osgi-config-patterns.md
- RDBDocumentNodeStoreBuilder.java — override to disable (scope=mongo-only) → see osgi-config-patterns.md
- Utils.java — add
isXxxEnabled()method → see osgi-config-patterns.md - DocumentNodeStoreServiceConfigurationTest.java → see test-patterns.md
- MongoDocumentNodeStoreBuilderTest.java → see test-patterns.md
- RDBDocumentNodeStoreBuilderTest.java → see test-patterns.md
- UtilsTest.java → see test-patterns.md
- Wire into usage class → see wiring-and-verification.md
- Compile and run tests → see wiring-and-verification.md
Files to read in STEP 1
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/Configuration.java
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBuilder.java
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilder.java
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreServiceConfigurationTest.java
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentNodeStoreBuilderTest.java
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentNodeStoreBuilderTest.java
oak-store-document/src/test/java/org/apache/jackrabbit/oak/plugins/document/util/UtilsTest.java
QUALITY CHECKLIST
Before finishing, verify:
-
Configuration.javahas a new@AttributeDefinitionentry with correct default import -
DocumentNodeStoreService.javahas DEFAULT constant and configureBuilder value setter - (featureToggle=true)
DocumentNodeStoreService.javahas FT_NAME constant, Feature field, activate registration, deactivate cleanup, and feature setter in configureBuilder -
DocumentNodeStoreBuilder.javahas value field + getter/setter pair - (featureToggle=true)
DocumentNodeStoreBuilder.javahas Feature field + Feature getter/setter pair -
RDBDocumentNodeStoreBuilder.javaoverrides value getter/setter to disable (scope=mongo-only) - (featureToggle=true)
RDBDocumentNodeStoreBuilder.javaalso overrides Feature getter/setter (scope=mongo-only) -
Utils.javahasisXxxEnabled()with proper javadoc -
DocumentNodeStoreServiceConfigurationTest.javatests default value + override -
MongoDocumentNodeStoreBuilderTest.javatests default getter (+ null feature if featureToggle=true) -
RDBDocumentNodeStoreBuilderTest.javahas symmetrical default-value tests (scope=both) or override-disabled tests (scope=mongo-only) -
UtilsTest.javahas correct number of tests for featureToggle + scope combination -
DocumentNodeStore.javareads the config via{utilsMethod}(builder)and stores it as a field - Target class receives and uses the field correctly
- All tests pass
- No new static imports added to any test file
IMPORTANT CONSTRAINTS
- Assertion style: match the existing imports in each file — do NOT add new imports. If the file uses
assertFalse(...)(static), use that; if it usesAssert.assertFalse(...), use that. - No static imports in new production code
- JUnit 4 only (
@Testfromorg.junit.Test) - Apply standards only to new code — never reformat or rename existing code
- Follow the exact naming and placement patterns shown in the supporting files
レビュー
まだレビューはありません。使ってみた感想をお寄せください。