Skip to content
itsminniPublic

About

Java app for managing a library with a CLI, a Swing GUI and SQLite storage.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library

Library is a small Java application for keeping track of books, members, cards, and loans. It was built as a school project.

What it does

  • Adds and updates books and members.
  • Issues and regenerates library cards.
  • Creates and returns loans while enforcing availability and loan limits.
  • Keeps archived books in loan history without making them borrowable.
  • Shows basic lending statistics.
  • Stores related changes in SQLite transactions.

Design

CLI and Swing are adapters around the same manager. A single application context owns database access and is passed to every GUI window, so opening two windows does not create two independent copies of the data. Each snapshot is rebuilt as one complete users → cards → loans object graph.

SQLite assigns record IDs. Loan creation, return, card regeneration, and user registration each run as one transaction: either every related change is committed or none is. Books have an explicit archived state, independent from their available-copy count.

Deactivating a lost card does not remove or rewrite its loans. Regeneration is a separate operation. It replaces the active card and moves open loans to the replacement in the same transaction.

The project rule allows at most three active loans per member. That limit, the 60-day default loan period, and the one-year card validity are named in LibraryRules.

Requirements

  • JDK 17 or newer
  • Apache Maven 3.9 or newer

Build and test

Run the complete verification pipeline:

mvn clean verify

This compiles the project, runs the JUnit regression suite, packages both applications, and starts each packaged JAR in non-interactive smoke-test mode. The regressions include failed writes, restarts, stale windows, ID continuity, and concurrent loan attempts. The resulting executable files are:

  • target/library-cli.jar
  • target/library-gui.jar

Run

Start the terminal interface:

java -jar target/library-cli.jar

Start the Swing interface:

java -jar target/library-gui.jar

Data

By default, the application creates data/library.db. To keep the data directory elsewhere, set library.data.dir:

java -Dlibrary.data.dir=/path/to/data -jar target/library-cli.jar

Project structure

  • src/main/java/model: domain objects and lending rules
  • src/main/java/service: operations shared by CLI and GUI
  • src/main/java/storage: SQLite schema and transaction handling
  • src/main/java/app: terminal interface
  • src/main/java/ui: Swing interface
  • src/test/java/tests: regression, persistence, concurrency, and packaged-JAR tests
  • data: default location for the local database

About

Java app for managing a library with a CLI, a Swing GUI and SQLite storage.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages