|
| 1 | +# RODA - Repository of Authentic Digital Records |
| 2 | + |
| 3 | +## Repository Overview |
| 4 | + |
| 5 | +RODA is a **long-term digital preservation repository** built with Java that implements the OAIS reference model. It's a multi-module Maven project providing functionalities for ingesting, managing, and providing access to various types of digital content. |
| 6 | + |
| 7 | +**Key Technologies:** |
| 8 | +- Java 21 (Oracle JDK) |
| 9 | +- Apache Maven 3.8.6+ (build system) |
| 10 | +- GWT 2.12.2 (Web UI framework) |
| 11 | +- Spring Boot 3.4.10 (backend framework) |
| 12 | +- Apache Solr 9.10.0 (indexing/search) |
| 13 | +- PostgreSQL 17 (database) |
| 14 | +- Docker (deployment) |
| 15 | + |
| 16 | +**Project Size:** Large-scale enterprise application with ~3 main modules (roda-common, roda-core, roda-ui) |
| 17 | + |
| 18 | +**License:** Open source |
| 19 | + |
| 20 | +## Build & Development Setup |
| 21 | + |
| 22 | +### Prerequisites |
| 23 | + |
| 24 | +1. **Java 21** (Oracle JDK) - Required for compilation |
| 25 | +2. **Maven 3.8.6+** - Build tool |
| 26 | +3. **GitHub account configured with Maven** - Required to access GitHub Packages dependencies |
| 27 | + - Follow: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-with-a-personal-access-token |
| 28 | + - Configure `~/.m2/settings.xml` with GitHub personal access token |
| 29 | +4. **Docker & Docker Compose** - For running development dependencies (Solr, PostgreSQL, etc.) |
| 30 | + |
| 31 | +### Build Commands |
| 32 | + |
| 33 | +**Standard build:** |
| 34 | +```bash |
| 35 | +mvn clean package |
| 36 | +``` |
| 37 | + |
| 38 | +**Build without tests (faster):** |
| 39 | +```bash |
| 40 | +mvn clean package -Dmaven.test.skip=true |
| 41 | +``` |
| 42 | + |
| 43 | +**Build only core modules:** |
| 44 | +```bash |
| 45 | +mvn clean package -Pcore |
| 46 | +``` |
| 47 | + |
| 48 | +**Install to local Maven repository:** |
| 49 | +```bash |
| 50 | +mvn install -Pcore -DskipTests |
| 51 | +``` |
| 52 | + |
| 53 | +### Running Tests |
| 54 | + |
| 55 | +**Run all tests:** |
| 56 | +```bash |
| 57 | +mvn clean test |
| 58 | +``` |
| 59 | + |
| 60 | +**Run CI tests (Travis group):** |
| 61 | +```bash |
| 62 | +mvn -Dtestng.groups="travis" -Denforcer.skip=true clean org.jacoco:jacoco-maven-plugin:prepare-agent test |
| 63 | +``` |
| 64 | + |
| 65 | +**Important:** Tests require external services (Solr, PostgreSQL, ZooKeeper, OpenLDAP) running via Docker. The CI workflow in `.github/workflows/CI.yml` shows the complete test setup. |
| 66 | + |
| 67 | +### Development Environment Setup |
| 68 | + |
| 69 | +**Start development dependencies:** |
| 70 | +```bash |
| 71 | +# Create required directories |
| 72 | +mkdir -p $HOME/.roda/data/{storage,staging-storage} |
| 73 | + |
| 74 | +# Start Solr, Zookeeper, PostgreSQL, ClamAV, etc. |
| 75 | +docker compose -f deploys/standalone/docker-compose-dev.yaml up -d |
| 76 | +``` |
| 77 | + |
| 78 | +**Debug Web UI with GWT:** |
| 79 | +```bash |
| 80 | +# First-time GWT compile |
| 81 | +mvn -pl roda-ui/roda-wui -am gwt:compile -Pdebug-main -Dscope.gwt-dev=compile |
| 82 | + |
| 83 | +# Install core modules |
| 84 | +mvn install -Pcore -DskipTests |
| 85 | + |
| 86 | +# Start Spring Boot application |
| 87 | +mvn -pl roda-ui/roda-wui -am spring-boot:run -Pdebug-main |
| 88 | + |
| 89 | +# In another terminal, start GWT codeserver for hot reload |
| 90 | +mvn -f dev/codeserver gwt:codeserver -DrodaPath=$(pwd) |
| 91 | +``` |
| 92 | + |
| 93 | +The application will be available at http://localhost:8080 |
| 94 | + |
| 95 | +### Common Build Issues & Solutions |
| 96 | + |
| 97 | +1. **GitHub Packages authentication failure:** |
| 98 | + - Ensure `~/.m2/settings.xml` is properly configured with GitHub token |
| 99 | + - Token must have `read:packages` permission |
| 100 | + |
| 101 | +2. **Test failures:** |
| 102 | + - Ensure Docker services are running: `docker compose -f deploys/standalone/docker-compose-dev.yaml up -d` |
| 103 | + - Check that ports 2181 (ZooKeeper), 8983 (Solr), 5432 (PostgreSQL), 1389 (LDAP) are available |
| 104 | + |
| 105 | +3. **GWT compilation issues:** |
| 106 | + - Use profile `-Pdebug-main` for development |
| 107 | + - Clean GWT cache if needed: `rm -rf ~/.gwt` |
| 108 | + |
| 109 | +4. **Build timing:** |
| 110 | + - Full build with tests: ~10-15 minutes |
| 111 | + - Build without tests: ~5-8 minutes |
| 112 | + - Running tests only: ~8-12 minutes |
| 113 | + |
| 114 | +## Project Structure |
| 115 | + |
| 116 | +### Module Layout |
| 117 | + |
| 118 | +``` |
| 119 | +/ |
| 120 | +├── pom.xml # Root Maven POM with dependency management |
| 121 | +├── code-style/ # Checkstyle & Eclipse formatter configurations |
| 122 | +│ ├── checkstyle.xml |
| 123 | +│ └── eclipse_formatter.xml |
| 124 | +├── roda-common/ # Common components used across modules |
| 125 | +│ ├── roda-common-data/ # Model objects (POJOs) |
| 126 | +│ └── roda-common-utils/ # Shared utilities |
| 127 | +├── roda-core/ # Core business logic |
| 128 | +│ ├── roda-core/ # Storage, indexing, model services |
| 129 | +│ └── roda-core-tests/ # Test helpers and core tests |
| 130 | +├── roda-ui/ # Web User Interface |
| 131 | +│ └── roda-wui/ # GWT-based web application + REST API |
| 132 | +├── scripts/ # Build and release scripts |
| 133 | +├── deploys/ # Deployment configurations |
| 134 | +│ └── standalone/ # Docker Compose files |
| 135 | +├── docker/ # Docker image build scripts |
| 136 | +└── documentation/ # User and developer documentation |
| 137 | +``` |
| 138 | + |
| 139 | +### Key Directories |
| 140 | + |
| 141 | +- **Source code:** `*/src/main/java/org/roda/` |
| 142 | +- **Tests:** `*/src/test/java/org/roda/` |
| 143 | +- **Resources/Config:** `*/src/main/resources/` |
| 144 | +- **Web UI assets:** `roda-ui/roda-wui/src/main/resources/config/` |
| 145 | +- **i18n translations:** `roda-ui/roda-wui/src/main/resources/config/i18n/` |
| 146 | + |
| 147 | +### Important Configuration Files |
| 148 | + |
| 149 | +- `pom.xml` - Maven project configuration (dependencies, plugins, profiles) |
| 150 | +- `code-style/checkstyle.xml` - Java code style rules |
| 151 | +- `code-style/eclipse_formatter.xml` - Java formatter configuration |
| 152 | +- `.github/workflows/CI.yml` - CI test configuration |
| 153 | +- `deploys/standalone/docker-compose-dev.yaml` - Development environment setup |
| 154 | + |
| 155 | +## Code Style & Linting |
| 156 | + |
| 157 | +### Java Code Style |
| 158 | + |
| 159 | +RODA uses **Checkstyle** for code quality enforcement and **Eclipse formatter** for consistent formatting. |
| 160 | + |
| 161 | +**Checkstyle configuration:** `code-style/checkstyle.xml` |
| 162 | +**Eclipse formatter:** `code-style/eclipse_formatter.xml` |
| 163 | + |
| 164 | +### IDE Configuration (IntelliJ IDEA) |
| 165 | + |
| 166 | +1. Install "Adapter for Eclipse Code Formatter" plugin |
| 167 | +2. Configure formatter to use `code-style/eclipse_formatter.xml` |
| 168 | +3. Set import order: `java;javax;org;com;` |
| 169 | +4. Set class count for wildcard imports: 9999 |
| 170 | +5. Set static import count for wildcard: 9999 |
| 171 | + |
| 172 | +### Code Formatting Rules |
| 173 | + |
| 174 | +- Use Eclipse formatter configuration |
| 175 | +- Imports: No wildcard imports unless >9999 classes |
| 176 | +- Line length: Follow Eclipse formatter settings |
| 177 | +- Indentation: Spaces (configured in formatter) |
| 178 | + |
| 179 | +**To format code:** |
| 180 | +In IntelliJ: `Code > Reformat File...` with scope "Only VCS changed text" |
| 181 | + |
| 182 | +## CI/CD & GitHub Workflows |
| 183 | + |
| 184 | +### Continuous Integration |
| 185 | + |
| 186 | +**Main CI workflow:** `.github/workflows/CI.yml` |
| 187 | +- Triggered on: All pushes to any branch |
| 188 | +- Java version: 21 |
| 189 | +- Maven version: 3.9.9 |
| 190 | +- Services: ZooKeeper, Solr, PostgreSQL, MailHog, OpenLDAP |
| 191 | +- Test command: `mvn -Dtestng.groups="travis" -Denforcer.skip=true clean org.jacoco:jacoco-maven-plugin:prepare-agent test` |
| 192 | +- Package command: `mvn -Dmaven.test.skip=true package` |
| 193 | + |
| 194 | +### Other Workflows |
| 195 | + |
| 196 | +- `codeql-analysis.yml` - Security scanning |
| 197 | +- `development.yml` - Development deployment |
| 198 | +- `staging.yml` - Staging deployment |
| 199 | +- `release.yml` - Production release |
| 200 | +- `latest.yml` - Latest version deployment |
| 201 | + |
| 202 | +### Pre-commit Validation |
| 203 | + |
| 204 | +Before committing changes: |
| 205 | +1. Run tests: `mvn clean test` |
| 206 | +2. Build successfully: `mvn clean package` |
| 207 | +3. Check code style (automatically via Checkstyle during build) |
| 208 | +4. Ensure Docker services are running for integration tests |
| 209 | + |
| 210 | +## Testing Strategy |
| 211 | + |
| 212 | +### Test Framework |
| 213 | + |
| 214 | +- **TestNG** for Java unit/integration tests |
| 215 | +- Test groups: Use `@Test(groups = "travis")` for CI tests |
| 216 | + |
| 217 | +### Test Execution |
| 218 | + |
| 219 | +**All tests:** |
| 220 | +```bash |
| 221 | +mvn clean test |
| 222 | +``` |
| 223 | + |
| 224 | +**CI test group only:** |
| 225 | +```bash |
| 226 | +mvn -Dtestng.groups="travis" clean test |
| 227 | +``` |
| 228 | + |
| 229 | +**Skip tests:** |
| 230 | +```bash |
| 231 | +mvn clean package -Dmaven.test.skip=true |
| 232 | +``` |
| 233 | + |
| 234 | +### Test Environment Requirements |
| 235 | + |
| 236 | +Tests require these services running (via Docker Compose): |
| 237 | +- Apache Solr (Cloud mode on ZooKeeper) |
| 238 | +- PostgreSQL database |
| 239 | +- OpenLDAP server |
| 240 | +- MailHog (email testing) |
| 241 | + |
| 242 | +Start services: `docker compose -f deploys/standalone/docker-compose-dev.yaml up -d` |
| 243 | + |
| 244 | +### Test Helper Classes |
| 245 | + |
| 246 | +- `org.roda.core.TestsHelper` - Common test utilities |
| 247 | +- `org.roda.core.CorporaConstants` - Test data constants |
| 248 | +- `roda-core-tests` module - Provides test infrastructure for all modules |
| 249 | + |
| 250 | +## Dependencies & Package Management |
| 251 | + |
| 252 | +### Maven Dependency Resolution |
| 253 | + |
| 254 | +Dependencies are resolved from: |
| 255 | +1. **GitHub Packages** - `https://maven.pkg.github.com/keeps/*` (requires authentication) |
| 256 | +2. **Maven Central** - Default repository |
| 257 | +3. **Maven Restlet** - `https://maven.restlet.talend.com/` |
| 258 | + |
| 259 | +### Adding Dependencies |
| 260 | + |
| 261 | +When adding new dependencies: |
| 262 | +1. Add to root `pom.xml` in `<dependencyManagement>` section (defines version) |
| 263 | +2. Add to module `pom.xml` in `<dependencies>` section (without version) |
| 264 | +3. Always check for security vulnerabilities before adding |
| 265 | +4. Use properties for version numbers (defined in root POM `<properties>`) |
| 266 | + |
| 267 | +### Common Dependencies |
| 268 | + |
| 269 | +- Spring Framework: `${spring.version}` (6.2.11) |
| 270 | +- Apache Solr: `${solr.version}` (9.10.0) |
| 271 | +- Jackson: `${jackson.version}` (2.20.1) |
| 272 | +- GWT: `${gwt.version}` (2.12.2) |
| 273 | + |
| 274 | +## Common Tasks |
| 275 | + |
| 276 | +### Building Docker Image |
| 277 | + |
| 278 | +```bash |
| 279 | +cd docker |
| 280 | +./build.sh |
| 281 | +``` |
| 282 | + |
| 283 | +### Updating Version |
| 284 | + |
| 285 | +See `DEV_NOTES.md` for release process using scripts: |
| 286 | +- `./scripts/release.sh VERSION` |
| 287 | +- `./scripts/prepare_next_version.sh VERSION` |
| 288 | + |
| 289 | +### Running RODA Locally |
| 290 | + |
| 291 | +```bash |
| 292 | +# Start dependencies |
| 293 | +docker compose -f deploys/standalone/docker-compose-dev.yaml up -d |
| 294 | + |
| 295 | +# Build and run |
| 296 | +mvn -pl roda-ui/roda-wui -am spring-boot:run -Pdebug-main |
| 297 | +``` |
| 298 | + |
| 299 | +Access at: http://localhost:8080 |
| 300 | + |
| 301 | +### Creating Solr Collections |
| 302 | + |
| 303 | +```bash |
| 304 | +./scripts/createSolrCollections.sh |
| 305 | +``` |
| 306 | + |
| 307 | +## Important Notes for AI Coding Agents |
| 308 | + |
| 309 | +1. **Always configure GitHub Packages authentication** before building. Without it, Maven dependency resolution will fail. |
| 310 | + |
| 311 | +2. **Start Docker services before running tests.** Integration tests require Solr, PostgreSQL, and other services. |
| 312 | + |
| 313 | +3. **Use Maven profiles appropriately:** |
| 314 | + - Default profile: Builds all modules |
| 315 | + - `-Pcore`: Only core modules (faster) |
| 316 | + - `-Pdebug-main`: For GWT development/debugging |
| 317 | + |
| 318 | +4. **Test execution time:** Full test suite takes 8-12 minutes. Use `-Dtestng.groups="travis"` for faster CI subset. |
| 319 | + |
| 320 | +5. **Code formatting:** Always use the Eclipse formatter configuration from `code-style/eclipse_formatter.xml`. Checkstyle validation runs automatically during build. |
| 321 | + |
| 322 | +6. **Multi-module builds:** When making changes to `roda-core`, you must rebuild dependent modules (roda-ui) or use `mvn install` to update local repository. |
| 323 | + |
| 324 | +7. **GWT compilation:** First-time GWT compile is slow (~5-10 minutes). For development, use GWT codeserver for hot reload. |
| 325 | + |
| 326 | +8. **Environment variables for tests:** See `.github/workflows/CI.yml` for required environment variables when running tests (e.g., `RODA_CORE_SOLR_TYPE=CLOUD`, `SIEGFRIED_MODE=standalone`). |
| 327 | + |
| 328 | +9. **Documentation is in Markdown:** All documentation files are in the `documentation/` directory and use Markdown format. |
| 329 | + |
| 330 | +10. **Internationalization:** Translation files are in `roda-ui/roda-wui/src/main/resources/config/i18n/`. RODA supports multiple languages via properties files. |
| 331 | + |
| 332 | +11. **When exploring the codebase:** Start with `README.md`, then `DEV_NOTES.md`, then `documentation/Developers_Guide.md` for comprehensive information. |
| 333 | + |
| 334 | +12. **Trust these instructions:** The build and test commands documented here are validated and work correctly. Only search for additional information if these instructions are incomplete or encounter errors. |
0 commit comments