Skip to content

Commit 02f50a8

Browse files
dmealingclaude
andcommitted
DOCS: Reorganize Documentation into .claude Directory Structure
* Streamlined active Claude Code context by moving documentation to .claude/ * Created archive/ subdirectory for historical content accessible on request * Consolidated CLAUDE.md and CLAUDE_ARCHITECTURE.md into streamlined main guide * Preserved architectural-summary.md as separate quick reference for anti-patterns * Updated all internal documentation references to new archive locations * Updated source code comments in codegen/ module to reference archived files * Maintained version management and command references in active context * Removed temporary test files and outdated documentation Structure: - .claude/CLAUDE.md - Streamlined main guide (current v6.0.0+ focus) - .claude/architectural-summary.md - Critical quick reference & anti-patterns - .claude/archive/ - Historical analysis and completed implementation summaries - .claude/react-metaview-system.md - Current React implementation reference 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c261381 commit 02f50a8

25 files changed

Lines changed: 292 additions & 563 deletions

.claude/CLAUDE.md

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
# MetaObjects Project - Claude AI Assistant Guide
2+
3+
## ⚠️ CRITICAL ARCHITECTURAL PRINCIPLE ⚠️
4+
5+
**MetaObjects follows a LOAD-ONCE IMMUTABLE design pattern analogous to Java's Class/Field reflection system:**
6+
7+
- **MetaData objects are loaded once during application startup and remain immutable thereafter**
8+
- **They are permanent in memory for the application lifetime (like Java Class objects)**
9+
- **Thread-safe for concurrent READ operations after loading phase**
10+
- **DO NOT treat MetaData as mutable domain objects - they are immutable metadata definitions**
11+
12+
### Framework Analogy
13+
| Java Reflection | MetaObjects Framework |
14+
|----------------|----------------------|
15+
| `Class.forName()` | `MetaDataLoader.load()` |
16+
| `Class.getFields()` | `MetaObject.getMetaFields()` |
17+
| `Field.get(object)` | `MetaField.getValue(object)` |
18+
| Permanent in memory | Permanent MetaData objects |
19+
| Thread-safe reads | Thread-safe metadata access |
20+
| ClassLoader registry | MetaDataTypeRegistry |
21+
22+
## Project Overview
23+
24+
MetaObjects is a Java-based suite of tools for metadata-driven development, providing sophisticated control over applications beyond traditional model-driven development techniques.
25+
26+
- **Current Version**: 5.2.0 (development)
27+
- **Java Version**: Java 21
28+
- **Build Tool**: Maven
29+
- **License**: Apache License 2.0
30+
31+
## Current Architecture (v6.0.0+)
32+
33+
### Service-Based Type Registry
34+
- **MetaDataTypeRegistry**: Service-based type registry (replaces TypesConfig)
35+
- **MetaDataEnhancementService**: Context-aware metadata enhancement
36+
- **ServiceLoader Discovery**: OSGI-compatible service discovery
37+
- **Cross-Language Ready**: String-based types work across Java/C#/TypeScript
38+
39+
### Project Structure
40+
```
41+
├── metadata/ # Base metadata models and types
42+
├── codegen/ # Code generation libraries (v6.0.0+)
43+
├── maven-plugin/ # Maven plugin for code generation
44+
├── core/ # Core MetaObjects functionality
45+
├── om/ # Object Manager module
46+
├── omdb/ # Database Object Manager
47+
├── omnosql/ # NoSQL Object Manager
48+
├── web/ # React MetaView components
49+
├── demo/ # Demo applications with React integration
50+
└── docs/ # Documentation
51+
```
52+
53+
### Build Dependencies (CRITICAL ORDER)
54+
```
55+
metadata → codegen → maven-plugin → core → om → omdb/omnosql → web → demo
56+
```
57+
58+
**Build the project**: `mvn clean compile`
59+
60+
## Core Concepts
61+
62+
### MetaObjects Types
63+
- **ValueMetaObject**: Dynamic objects with public getter/setter access
64+
- **DataMetaObject**: Wrapped objects with protected access + Builder patterns
65+
- **ProxyMetaObject**: Proxy implementations without concrete classes
66+
- **MappedMetaObject**: Works with Map interface objects
67+
68+
### Key Features
69+
- **Metadata-driven development** with sophisticated control mechanisms
70+
- **Cross-language code generation** (Java, C#, TypeScript)
71+
- **JSON/XML serialization** with custom type adapters
72+
- **Validation framework** with field-level and object-level validators
73+
- **React MetaView System** with TypeScript components
74+
- **Enhanced error reporting** with hierarchical paths and context
75+
76+
## Current Service Architecture Patterns
77+
78+
### MetaDataTypeRegistry Usage
79+
```java
80+
// v6.0.0+ pattern - service-based type registry
81+
MetaDataTypeRegistry registry = ServiceRegistry.getInstance()
82+
.getService(MetaDataTypeRegistry.class);
83+
84+
// Register custom types
85+
registry.registerType("customField", CustomField.class);
86+
```
87+
88+
### MetaDataEnhancement Usage
89+
```java
90+
// Attribute enhancement for cross-cutting concerns
91+
MetaDataEnhancementService enhancer = new MetaDataEnhancementService();
92+
for (MetaObject metaObject : loader.getChildren(MetaObject.class)) {
93+
enhancer.enhanceForService(metaObject, "objectManagerDB",
94+
Map.of("dialect", "postgresql", "schema", "public"));
95+
}
96+
// Objects now have dbTable, dbCol, dbNullable attributes
97+
```
98+
99+
### Modern API Patterns
100+
```java
101+
// Optional-based APIs (v5.1.0+)
102+
Optional<String> name = metaObject.findString("name");
103+
String email = metaObject.requireString("email"); // throws if missing
104+
105+
// Builder patterns
106+
ValueObject obj = ValueObject.builder()
107+
.field("name", "John")
108+
.field("age", 30)
109+
.build();
110+
111+
// Stream APIs
112+
metaObject.getFieldsStream()
113+
.filter(field -> field.getType() == DataTypes.STRING)
114+
.forEach(field -> processField(field));
115+
```
116+
117+
## React MetaView Integration
118+
119+
### Backend API Pattern
120+
```java
121+
// Spring REST controllers serve metadata as JSON
122+
@RestController
123+
public class MetaDataApiController {
124+
125+
@GetMapping("/api/metadata/{objectName}")
126+
public ResponseEntity<String> getMetaObjectJson(@PathVariable String objectName) {
127+
MetaObject metaObject = loader.getMetaObject(objectName);
128+
return ResponseEntity.ok(JsonObjectWriter.write(metaObject));
129+
}
130+
}
131+
```
132+
133+
### Frontend Component Pattern
134+
```typescript
135+
// TypeScript MetaView components
136+
import { MetaViewRenderer } from './components/metaviews/MetaViewRenderer';
137+
import { MetaObjectForm } from './components/forms/MetaObjectForm';
138+
139+
// Automatic form generation from metadata
140+
<MetaObjectForm
141+
metaObjectName="User"
142+
onSubmit={handleSubmit}
143+
validation={true}
144+
/>
145+
```
146+
147+
### JSON Metadata Location
148+
- Place JSON metadata in `/src/main/resources/metadata/` for proper classpath loading
149+
- Use FileMetaDataLoader with JsonMetaDataParser for existing infrastructure
150+
151+
## Development Guidelines
152+
153+
### Code Style & Patterns
154+
- Use **SLF4J** for all logging (migrated from Commons Logging)
155+
- Follow **Builder patterns** for complex object creation
156+
- Use **Optional-based APIs** for safe null handling
157+
- Maintain **backward compatibility** in all changes
158+
- Add **comprehensive JavaDoc** for public APIs
159+
160+
### Testing
161+
- Use **JUnit 4.13.2** for testing
162+
- All modules must compile successfully with Java 21
163+
- Test files should follow existing patterns in `*/src/test/java/`
164+
165+
### Module Integration
166+
- **codegen module**: Contains all code generation functionality
167+
- **web module**: React TypeScript components and generic Spring controllers
168+
- **demo module**: Fishstore demo, data controllers, and JSON metadata
169+
- **Controllers**: Demo-specific controllers → demo module, generic → web module
170+
171+
### React & Frontend Development
172+
- **Use Existing Infrastructure**: Leverage FileMetaDataLoader, JsonObjectWriter from IO package
173+
- **Spring Integration**: Proper controller module placement based on functionality
174+
- **TypeScript Components**: Follow React MetaView patterns for metadata-driven UI
175+
- **State Management**: Redux Toolkit with React Query for form state and data fetching
176+
177+
## Enhanced Error Reporting (v5.2.0+)
178+
179+
### Rich Exception Context
180+
```java
181+
try {
182+
// MetaObjects operation
183+
} catch (MetaDataException e) {
184+
Optional<MetaDataPath> path = e.getMetaDataPath();
185+
Optional<String> operation = e.getOperation();
186+
Map<String, Object> context = e.getContext();
187+
188+
// Enhanced error messages include context and alternatives
189+
// "Field 'invalidField' not found in User: Available: age, email, name"
190+
}
191+
```
192+
193+
### Factory Method Patterns
194+
```java
195+
// Context-rich exception creation
196+
ObjectNotFoundException.forId(userId, metaObject, "userLookup");
197+
PersistenceException.forSave(entity, metaObject, sqlException);
198+
GeneratorException.forTemplate("user.java.vm", metaObject, templateException);
199+
```
200+
201+
## Key Build Commands
202+
203+
```bash
204+
# Build entire project
205+
mvn clean compile
206+
207+
# Run tests
208+
mvn test
209+
210+
# Package project
211+
mvn package
212+
213+
# Generate code using MetaObjects plugin
214+
mvn metaobjects:generate
215+
216+
# Build specific module (respects dependency order)
217+
cd metadata && mvn compile
218+
cd core && mvn compile
219+
```
220+
221+
## Maven Configuration
222+
- Parent POM manages dependency versions
223+
- OSGi bundle support enabled via Apache Felix Maven Bundle Plugin
224+
- Java 21 compatibility with --release flag
225+
- Two distribution profiles: default (Draagon) and nexus (Maven Central)
226+
227+
## Critical Files for Development
228+
229+
### Source Code
230+
- Core source: `core/src/main/java/com/draagon/meta/`
231+
- Metadata models: `metadata/src/main/java/com/draagon/meta/`
232+
- Tests: `*/src/test/java/`
233+
234+
### React MetaView System
235+
- React components: `web/src/typescript/components/metaviews/`
236+
- React forms: `web/src/typescript/components/forms/`
237+
- TypeScript types: `web/src/typescript/types/metadata.ts`
238+
- Spring controllers: `web/src/main/java/com/draagon/meta/web/react/api/`
239+
- Demo controllers: `demo/src/main/java/com/draagon/meta/demo/fishstore/api/`
240+
- JSON metadata: `demo/src/main/resources/metadata/fishstore-metadata.json`
241+
242+
### Configuration
243+
- `pom.xml` - Main project configuration
244+
- `package.json` & `tsconfig.json` - React/TypeScript configuration (web module)
245+
- `README.md` - Basic project information
246+
- `RELEASE_NOTES.md` - Version history
247+
248+
## Key Technologies & Dependencies
249+
250+
- **Java 21** with Maven compiler plugin 3.13.0
251+
- **SLF4J + Logback** for logging
252+
- **JUnit 4.13.2** for testing
253+
- **OSGi Bundle Support** via Apache Felix Maven Bundle Plugin
254+
- **Gson 2.13.1** for JSON handling
255+
- **Commons Validator 1.9.0** for validation
256+
- **React + TypeScript** for frontend components
257+
- **Redux Toolkit** for state management
258+
259+
## VERSION MANAGEMENT FOR CLAUDE AI
260+
261+
**CRITICAL**: When user requests "increment version", "update version", or "release new version":
262+
263+
1. **AUTOMATICALLY UPDATE ALL VERSION REFERENCES**:
264+
- All pom.xml files (root + 8 modules)
265+
- README.md "Current Release:" line
266+
- RELEASE_NOTES.md (add new version section)
267+
- This CLAUDE.md version references
268+
269+
2. **FOLLOW VERSION STRATEGY**:
270+
- Release: Remove -SNAPSHOT from current version
271+
- Next Dev: Increment version + add -SNAPSHOT
272+
- Ensure ALL modules have identical versions
273+
274+
3. **VERIFY BUILD**: Run `mvn clean compile` after changes
275+
276+
This ensures complete version synchronization across the entire project when versions are updated.
File renamed without changes.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Release date: [Current Date]
7272
```
7373

7474
### Step 5: Update CLAUDE.md
75-
Located at: `./CLAUDE.md`
75+
Located at: `./.claude/CLAUDE.md`
7676

7777
Update lines:
7878
- Line 6: `- **Current Version**: X.Y.Z-SNAPSHOT (latest stable: X.Y.Z)`
@@ -84,7 +84,7 @@ Search and verify these files/patterns are updated:
8484
- All pom.xml files contain new version
8585
- README.md shows new current release
8686
- RELEASE_NOTES.md has new version section
87-
- CLAUDE.md reflects new version
87+
- .claude/CLAUDE.md reflects new version
8888
- Any hardcoded version references in documentation
8989

9090
## Files That Must Be Updated
@@ -97,7 +97,7 @@ Search and verify these files/patterns are updated:
9797
5. **./om/pom.xml** - Object Manager module version
9898
6. **./README.md** - Current Release line
9999
7. **./RELEASE_NOTES.md** - Add new version section
100-
8. **./CLAUDE.md** - Current version and recent changes header
100+
8. **./.claude/CLAUDE.md** - Current version and recent changes header
101101

102102
### Secondary Files (Update if uncommented in build)
103103
9. **./demo/pom.xml** - Demo module version
@@ -118,7 +118,7 @@ When user requests version increment:
118118
# 1. Update all POM files with new version
119119
# 2. Update README.md current release
120120
# 3. Update RELEASE_NOTES.md with new section
121-
# 4. Update CLAUDE.md version references
121+
# 4. Update .claude/CLAUDE.md version references
122122
# 5. Verify all changes with grep search
123123
# 6. Build and test the project
124124
mvn clean compile
@@ -167,7 +167,7 @@ grep "Current Release:" README.md
167167
head -20 RELEASE_NOTES.md | grep "Version"
168168

169169
# Verify CLAUDE.md version
170-
grep "Current Version" CLAUDE.md
170+
grep "Current Version" .claude/CLAUDE.md
171171
```
172172

173173
## Error Prevention
@@ -176,15 +176,15 @@ grep "Current Version" CLAUDE.md
176176
1. **Version Consistency**: All pom.xml files MUST have same version
177177
2. **SNAPSHOT Handling**: Development versions should end with -SNAPSHOT
178178
3. **Date Updates**: RELEASE_NOTES.md should have current date
179-
4. **Section Headers**: Update major changes section in CLAUDE.md
179+
4. **Section Headers**: Update major changes section in .claude/CLAUDE.md
180180
5. **Build Verification**: Project must compile after version changes
181181

182182
### Common Mistakes to Avoid
183183
1. Forgetting to update child module versions
184184
2. Missing README.md current release update
185185
3. Not adding new section to RELEASE_NOTES.md
186186
4. Inconsistent version numbers across modules
187-
5. Forgetting to update CLAUDE.md version references
187+
5. Forgetting to update .claude/CLAUDE.md version references
188188

189189
## Implementation Notes for Claude AI
190190

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,9 @@ Critical metadata overlay functionality restoration that was broken during the v
483483

484484
## Quick Reference Files
485485

486-
- **Comprehensive Analysis**: `CLAUDE_ARCHITECTURAL_ANALYSIS.md`
487-
- **Detailed Enhancements**: `CLAUDE_ENHANCEMENTS.md`
488-
- **Architecture Guide**: `CLAUDE_ARCHITECTURE.md`
489-
- **This Summary**: `CLAUDE_ARCHITECTURAL_SUMMARY.md`
486+
- **Comprehensive Analysis**: `archive/architectural-analysis/CLAUDE_ARCHITECTURAL_ANALYSIS.md`
487+
- **Detailed Enhancements**: `archive/architectural-analysis/CLAUDE_ENHANCEMENTS.md`
488+
- **Architecture Guide**: `archive/architectural-analysis/original-architecture-guide.md`
489+
- **This Summary**: `architectural-summary.md` (current file)
490490

491491
This framework deserves enhancement, not replacement. The core design is sophisticated and follows metadata framework best practices.

CLAUDE_ARCHITECTURAL_ANALYSIS.md renamed to .claude/archive/architectural-analysis/CLAUDE_ARCHITECTURAL_ANALYSIS.md

File renamed without changes.

CLAUDE_ENHANCEMENTS.md renamed to .claude/archive/architectural-analysis/CLAUDE_ENHANCEMENTS.md

File renamed without changes.

CLAUDE_ARCHITECTURE.md renamed to .claude/archive/architectural-analysis/original-architecture-guide.md

File renamed without changes.

CLAUDE.md renamed to .claude/archive/architectural-analysis/original-comprehensive-guide.md

File renamed without changes.

ENHANCEMENTS_SUMMARY.md renamed to .claude/archive/implementation-summaries/ENHANCEMENTS_SUMMARY.md

File renamed without changes.

GENERATOR_ENHANCEMENT_SUMMARY.md renamed to .claude/archive/implementation-summaries/GENERATOR_ENHANCEMENT_SUMMARY.md

File renamed without changes.

0 commit comments

Comments
 (0)