|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +OneBusAway Application Modules - a multi-module Maven project providing real-time public transit information. The suite powers REST APIs, web interfaces, and integrations for transit agencies worldwide. |
| 8 | + |
| 9 | +**Version:** 2.7.0 |
| 10 | +**Java:** 11 |
| 11 | +**Framework:** Spring 5.2.24 (not Spring Boot), Struts 2.5.33, Hibernate 5.4.24 |
| 12 | + |
| 13 | +## Build Commands |
| 14 | + |
| 15 | +```bash |
| 16 | +# Full build (skip tests for speed) |
| 17 | +mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true |
| 18 | + |
| 19 | +# Build with tests |
| 20 | +mvn clean install |
| 21 | + |
| 22 | +# Build single module with dependencies |
| 23 | +mvn clean package -pl onebusaway-api-key-cli -am |
| 24 | + |
| 25 | +# Run tests for a single module |
| 26 | +mvn test -pl onebusaway-api-webapp |
| 27 | + |
| 28 | +# Run a single test |
| 29 | +mvn test -Dtest=ConfigActionTest |
| 30 | + |
| 31 | +# Run a single test method |
| 32 | +mvn test -Dtest=ConfigActionTest#testIndex |
| 33 | + |
| 34 | +# Verify build (includes license checks) |
| 35 | +mvn verify |
| 36 | +``` |
| 37 | + |
| 38 | +### Docker Development (Recommended) |
| 39 | + |
| 40 | +```bash |
| 41 | +docker compose up builder # Start build container + MySQL |
| 42 | + |
| 43 | +# In another terminal: |
| 44 | +bin/make # Full Maven build |
| 45 | +bin/make --test # Build with tests |
| 46 | +bin/build_bundle # Create GTFS data bundle |
| 47 | +bin/copy_and_relaunch # Deploy WARs to Tomcat |
| 48 | +bin/shell # Shell into container |
| 49 | +``` |
| 50 | + |
| 51 | +**Access points when running:** |
| 52 | +- API: http://localhost:8080/onebusaway-api-webapp/api/where/config.json?key=test |
| 53 | +- Tomcat Manager: http://localhost:8080/manager/html (admin/admin) |
| 54 | +- Debug port: 5005 |
| 55 | + |
| 56 | +## Module Architecture |
| 57 | + |
| 58 | +### Core Layers (bottom-up) |
| 59 | + |
| 60 | +**Infrastructure:** |
| 61 | +- `onebusaway-core` - Base classes, constants |
| 62 | +- `onebusaway-util` - General utilities |
| 63 | +- `onebusaway-container` - Spring context bootstrap |
| 64 | +- `onebusaway-geospatial` - GIS utilities |
| 65 | + |
| 66 | +**Data Layer:** |
| 67 | +- `onebusaway-transit-data` - Domain models (stops, routes, trips) |
| 68 | +- `onebusaway-gtfs-hibernate-spring` - GTFS database ORM |
| 69 | +- `onebusaway-gtfs-realtime-model` - GTFS-realtime parsing |
| 70 | +- `onebusaway-transit-data-federation` - Core data aggregation engine |
| 71 | +- `onebusaway-transit-data-federation-builder` - Builds data bundles from GTFS |
| 72 | + |
| 73 | +**Service Layer:** |
| 74 | +- `onebusaway-api-core` - REST API implementation logic |
| 75 | +- `onebusaway-realtime-api` - Real-time data interfaces |
| 76 | +- `onebusaway-users` - User management, API keys |
| 77 | +- `onebusaway-alerts-persistence` - Service alerts storage |
| 78 | + |
| 79 | +**Web Applications (WAR):** |
| 80 | +- `onebusaway-api-webapp` - Main REST API (most commonly modified) |
| 81 | +- `onebusaway-transit-data-federation-webapp` - Admin/federation UI |
| 82 | +- `onebusaway-gtfs-realtime-archiver` - Archives realtime data |
| 83 | +- `onebusaway-watchdog-webapp` - Monitoring endpoints |
| 84 | + |
| 85 | +**CLI Tools:** |
| 86 | +- `onebusaway-api-key-cli` - Command-line API key management |
| 87 | + |
| 88 | +### Data Flow |
| 89 | + |
| 90 | +1. GTFS static data → `federation-builder` → MySQL database |
| 91 | +2. GTFS-realtime feeds → `gtfs-realtime-model` → merged with static data |
| 92 | +3. API requests → `api-webapp` (Struts actions) → `api-core` → `transit-data-federation` → response |
| 93 | + |
| 94 | +## Key Configuration Files |
| 95 | + |
| 96 | +**GTFS Realtime sources:** |
| 97 | +`docker_app_server/config/onebusaway-transit-data-federation-webapp-data-sources.xml` |
| 98 | +- Configure `tripUpdatesUrl`, `vehiclePositionsUrl`, `alertsUrl`, `agencyId` |
| 99 | + |
| 100 | +**Docker environment:** |
| 101 | +`docker-compose.yml` |
| 102 | +- `GTFS_URL` - Static GTFS download URL |
| 103 | +- `TZ` - Timezone matching GTFS data |
| 104 | + |
| 105 | +## Testing |
| 106 | + |
| 107 | +- Unit tests: `src/test/java/` |
| 108 | +- Integration tests: `org.onebusaway.integration.*` (excluded by default) |
| 109 | +- Test database: HSQLDB (in-memory) |
| 110 | +- Test ports: 9900 (main), 9901 (AJP), 9902 (RMI) |
| 111 | + |
| 112 | +## Contributing Notes |
| 113 | + |
| 114 | +- Fork the repo and submit Pull Requests |
| 115 | +- Reference GitHub issue numbers in commits: `Issue #5: Description` |
| 116 | +- Run `mvn verify` before submitting to ensure license headers and tests pass |
| 117 | +- Code style: https://github.com/OneBusAway/onebusaway/wiki/Code-Style |
| 118 | +- License: Apache 2.0 (ICLA required for contributions) |
0 commit comments