ABOUT THIS MODULE: This repository contains the final evolution (Module 3) of our Distributed Spotify architecture. It builds upon the Hybrid Streaming System from Module 2 by introducing End-to-End Encryption (SSL/TLS) for all RMI Control Plane communications and Callbacks. It also implements a Persistent Auditing System to log TCP streaming events.
⚠️ Note: If you want to test the streaming architecture without generating SSL certificates, please switch to themodule-2branch.
- Secure RMI (SSL/TLS): The entire control plane (metadata fetching, playlist management, and remote triggers) is secured using
SslRMIClientSocketFactoryandSslRMIServerSocketFactory. - Encrypted Callbacks: The server securely invokes methods on the client (like launching the media player) using bi-directional SSL handshakes.
- Persistent Event Logging: Implements a robust
Utilslogger that records stream connections, TCP client IPs, and total transmitted bytes to a physicalstreams.txtfile for server auditing. - Auto-Discovery & Preloading (Bonus): The server dynamically scans the
mp3files/originandjpgfiles/directories on startup, automatically preloading all available media files and their respective covers without manual client population. - Network-Ready: The system explicitly defines the
java.rmi.server.hostnameproperty, preventingBindExceptionsand allowing deployment across different physical machines on the same LAN.
Distributed-Spotify-Java-RMI
┣ 📂 jpgfiles/
┣ 📂 logs/
┃ ┗ 📜 streams.txt
┣ 📂 mp3files/
┃ ┣ 📂 destination/
┃ ┗ 📂 origin/
┗ 📂 src/spotify/
┣ 📂 media/
┃ ┣ 📜 Globals.java
┃ ┣ 📜 Media.java
┃ ┗ 📜 MediaPlayer.java
┣ 📂 rmi/
┃ ┣ 📂 client/
┃ ┃ ┣ 📜 SpotifyClientImpl.java
┃ ┃ ┗ 📜 SpotifyStreamingClient.java
┃ ┣ 📂 common/
┃ ┃ ┣ 📜 ServerMessages.java
┃ ┃ ┣ 📜 Spotify.java
┃ ┃ ┣ 📜 SpotifyClient.java
┃ ┃ ┗ 📜 SpotifyServer.java
┃ ┗ 📂 server/
┃ ┣ 📜 SpotifyLauncher.java
┃ ┗ 📜 SpotifyServerImpl.java
┣ 📂 stream/
┃ ┣ 📜 ClientStream.java
┃ ┗ 📜 ServerStream.java
┗ 📂 utils/
┣ 📜 ConcurrentMultiMap.java
┣ 📜 MediaDirectory.java
┗ 📜 Utils.java
Before compiling or running, you must generate a dummy Keystore for the SSL Handshake. Open a terminal in the root directory and run:
keytool -genkey -noprompt -alias spotify -dname "CN=localhost" -keyalg RSA -keystore keystore.jks -storepass 123456 -keypass 123456
(Ensure the keystore.jks file is present in the execution directory for both Server and Client).Compile the entire project from your src directory:
javac spotify/common/*.java spotify/media/*.java spotify/utils/*.java spotify/server/*.java spotify/client/*.java spotify/stream/*.javaStart the Secure Server: The server will bind the secure registry and start logging to ./logs/streams.txt.
java spotify.server.SpotifyLauncherStart the Secure Client:
java spotify.client.SpotifyStreamingClientInteraction Example (Server Auditing) When a client streams a song, the server console and the logs/streams.txt file will register:
📝 DEBUG LOGS: Escrito registro en -> .../logs/streams.txt
[2024-05-20 18:30:15] [STREAM] Streaming to: /127.0.0.1
[2024-05-20 18:30:16] [STREAM] Stream finished. Tx Bytes: 242449Iván Moro Cienfuegos, David Martín Sebastián, Eric Soto San José y Héctor
