A multi-module Maven project that ingests music data from iTunes and Spotify APIs, serves it via REST APIs, and generates static websites.
This project follows a multi-module Maven architecture:
project-model- Shared data models (POJOs) and SQL schema definitionsphase1-ingestor- Data ingestion applications for iTunes and Spotifyphase2-api-server- REST API servers to expose music dataphase3-site-generator- Static site generator using APISIX routes
- JDK 11+ (Java Development Kit)
- Apache Maven 3.6+
- SQLite (bundled via JDBC driver)
- Docker (optional, for APISIX setup)
From the repository root, run:
mvn clean packageTo skip tests during build:
mvn -DskipTests packageThis compiles all modules and creates executable JAR files in each module's target/ directory.
The ingestor applications fetch music data from iTunes and Spotify APIs and store them in a SQLite database (spotify.db).
cd phase1-ingestor
java -cp target/phase1-ingestor-1.0-SNAPSHOT.jar com.wcupa.csc240.ingestor.ItunesAppAvailable Commands:
Build- Create/recreate theitunes_trackstableLoad- Fetch data from iTunes API and insert into databaseStatus- Show current row countDump- Display all recordsSet- Change search query (e.g.,set query bruno mars)Help- Show command listExit- Quit application
cd phase1-ingestor
java -cp target/phase1-ingestor-1.0-SNAPSHOT.jar com.wcupa.csc240.ingestor.SpotifyAppAvailable Commands:
Build- Create/recreate thetrackstableLoad- Fetch data from Spotify API and insert into databaseStatus- Show current row countDump- Display all recordsSet- Change search parameters (artist, album, limit)Help- Show command listExit- Quit application
Note: The database file spotify.db will be created in the working directory.
The API server provides REST endpoints to query the music data.
Serves JSON data from the database:
cd phase2-api-server
java -cp target/phase2-api-server-1.0-SNAPSHOT.jar com.wcupa.csc240.api.DataApiEndpoints:
GET http://localhost:9001/tracks- List all Spotify tracksGET http://localhost:9001/tracks/{id}- Get specific Spotify trackGET http://localhost:9001/itunes- List all iTunes tracksGET http://localhost:9001/itunes/{id}- Get specific iTunes track
Object-oriented API endpoint:
java -cp target/phase2-api-server-1.0-SNAPSHOT.jar com.wcupa.csc240.api.ClassApiHTML interface for browsing data:
java -cp target/phase2-api-server-1.0-SNAPSHOT.jar com.wcupa.csc240.api.UiApiAccess: Open http://localhost:9003 in your browser
Generates static HTML pages from APISIX route configurations.
If using APISIX for routing:
cd project-model/apisix
docker-compose up -dcd phase3-site-generator
java -cp target/phase3-site-generator-1.0-SNAPSHOT.jar com.wcupa.csc240.generator.SiteGeneratorThe generator creates HTML files in target/site/:
index.html- Main page listing all routesdetails_{id}.html- Individual route detail pages
Custom APISIX URL:
java -cp target/phase3-site-generator-1.0-SNAPSHOT.jar com.wcupa.csc240.generator.SiteGenerator http://your-apisix-url:9180CREATE TABLE itunes_tracks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
track_id TEXT NOT NULL,
track_name TEXT NOT NULL,
artist_name TEXT,
collection_name TEXT,
release_date TEXT,
track_time_ms INTEGER,
preview_url TEXT,
UNIQUE(track_id)
);Similar structure - see project-model/sql/create_spotify_table.sql
-
Build the project:
mvn clean package -
Ingest data:
- Run
ItunesAppand execute:build,load,status - Run
SpotifyAppand execute:build,load,status
- Run
-
Start API servers:
- Run
DataApion port 9001 - Run
UiApion port 9003 (optional)
- Run
-
Test APIs:
curl http://localhost:9001/tracks
-
Generate site (if using APISIX):
- Start APISIX:
docker-compose up -d - Run
SiteGenerator - View generated pages in
target/site/
- Start APISIX:
Database file not found:
- Make sure you run the ingestor apps from the correct directory or specify the full path to
spotify.db
Port already in use:
- Change the port in the Java code or stop the conflicting service
Maven build fails:
- Ensure JDK 11+ is installed:
java -version - Verify Maven is installed:
mvn -version
Key dependencies (managed via Maven):
org.xerial:sqlite-jdbc- SQLite database driverorg.json:json- JSON parsing- Java 11+ built-in HTTP client