Introduction
Emotional Songs is a software for recording the emotions perceived while listening to songs or music. It allows you to create playlists of songs and, for each of them, register perceived emotions. It is also possible to display, for each song, a statistical report of the emotions experienced on average by registered users, with some summarizing charts.
Emotional Songs was developed using the NetBeans IDE, and the JDK 17 version.
The software Emotional Songs was developed following the RMI (Remote Method Invocation) Java’s API, with which it’s easier to manage concurrent access to the software and its database.
RMI – Remote Method Invocation
RMI (Remote Method Invocations) introduces the possibility of requiring remote methods in Java, integrating everything with the Object Oriented paradigm.
In particular, RMI is a set of policies and mechanisms that allow a Java application, running on a machine, to invoke the methods of an object of another Java application running on a remote machine. Only the reference to a remote object, which is actually active on a remote node, is created locally. A client program invokes methods through this local reference.
The RMI paradigm is implemented in Java with the java.rmi
library. For further information about the RMI programming paradigm and its implementation in Java, visit the Oracle website.
General structure of the class system
Emotional Songs is structured in two distinct packages. ClientES
is the program that each user of the software have to install on his PC to use all the features offered. ServerES
is the backend of the software and needs to be installed on the server machine.
ClientES
emotionalsongs
Contains the main
class of the program, in addition to the methods that indicate which user has accessed the program and the display language for a given moment.
emotionalsongs.clientES
Set of classes that allows to connect to the services offered by the database and initialize the software for the client.
emotionalsongs.clientES.client_internal_services
Set of classes that manages the window construction for the client-side program. In particular, it deals with displaying icons and buttons, managing the display of playlists and the displayed songs data.
emotionalsongs.clientES.dialogs
Set of classes that deals with the internationalization of the interface. Currently there are Italian and English languages.
emotionalsongs.clientES.gui
Set of classes that deals with building the graphic elements that make up the windows of the client-side software.
emotionalsongs.clientES.wrappers
Group of wrapper classes, whose purpose is the construction of objects representing the fundamental elements of Emotional Songs: emotions, playlists, songs and users.
emotionalsongs.serverES.server_services_commons_interfaces
These are two packages that recall functions common to the server. This kind of implementation is required by RMI.
ServerES
emotionalsongs.serverES
Group of classes that manages the connection between the software and the DBMS. In particular, there are classes that:
- establish the link to the DBMS.
- create tables and reports, if not present.
- verify the correctness of the submitted data before they are forwarded to the DBMS.
These classes are further divided according to the elements handled:
- songs
- emotions
- playlist
- registered users
serverES.welcome_email_sender
Structure of classes used to send a welcome email, every time a new user registers to the system.
Graphical interface
The graphical interface of Emotional Songs is made with the IDE Apache netbeans, used to build windows and individual GUI elements.
The library used for the GUI is Java Swing, one of the most famous and widely used.
Third-party libraries
Emotional Songs uses some third-party libraries, listed below.
postgresql-42.6.0
The PostgreSQL JDBC driver allows Java programs to connect to a PostgreSQL database using standard database-independent Java code. pgJDBC
is an open source JDBC driver written in Pure Java (Type 4), and communicates in the native network protocol PostgreSQL.
In Emotional Songs, this library is used to communicate between the software and the DB, created using the PostgreSQL DBMS.
jfreechart
JFreeChart is a 100% free Java library that makes it easy for developers to display charts in their applications.
In Emotional Songs it is used for the construction of the summary charts in the emotional report for each song.
jsoup
jsoup is a Java library for working with HTML. It provides a very convenient API to retrieve URLs and extract and manipulate data, using the best HTML5 DOM methods and CSS selectors.
javax.mail
The JavaMail API provides a platform and protocol independent framework for creating email and messaging applications.
In Emotional Songs, the library javax.mail
is used to automatically send a confirmation email upon registration, with a summary of the data provided.
Other third-party libraries
AbsoluteLayout-RELEASE130
commons-lang3-3.1
commons-validator
javaee-api-8.0.1
activation-1.1
commons-beanutils-1.9.4
commons-collections-3.2.2
commons-digester-2.1
commons-logging-1.2
jcommon-1.0.16
Database
UML – ER diagram
Click here for the SQL queries used to create the database with PostgreSQL
.
Notes about database design
We listed below some design choices were made during the database design phase.
In the table
UTENTI_REGISTRATI
aBOOL
-typeLOGGED
column has been added, in order to let the server check that each user hasn’t logged in from several terminals at the same time. This value is set by default toFALSE
.Due to issues of managing songs displaying in the repository, we decided to assign to each tuple of the table
CANZONI
a unique index, represented by the columnREPO_INDEX
numerical type,UNIQUE
.Since:
- a playlist may contain several songs,
- each playlist is assigned to a single user,
- each user can have multiple playlists,
the representation of playlists within the database was divided into two separate tables:
PLAYLIST
- Contains the unique playlist ID (generated by the software that interfaces with the database), its name (chosen by the user when creating the playlist) and the owner ID.
- Basically represents the user - playlist association.
CONTENUTO_PLAYLIST
- Contains, for each tuple, the playlist ID and the ID of one of the songs contained in it.
- Each playlist is represented by a set of tuples from the table
CANZONI
, having in common the value of the columnPLAYLIST_ID
.
Since the software was not required to carry out any sampling by geographical area, it was decided to represent the user’s address in the column
INDIRIZZO
ofUTENTI_REGISTRATI
table as a simple generic literal value, whose validity checks are referred to the database management softwareServerES
.
Complexity of sorting algorithms
The sorting and searching algorithms are contained in the PostgreSQL DBMS, and are the merge sort and heap sort, which have complexity n log n.
JavaDoc
Click on the following buttons to visualize the JavaDoc: it is useful to explore classes and methods implemented in Emotional Songs.