About BPSE-Basic

The basic sample application shows how to create a simple application that fulfills the following functional requirements :

This table gives an short description about the different use cases.
Create Student Create and add new students to the system
Delete Student Remove a selected student from the system
Edit Student Data Edit and update a selected student
Show Students Show a list of students available in the system
Show Student Data Show the data of a selected student
Sort Sort the list of students by a given sort order
Change SortOrder Change the order of the list to matrikel number or last name
Export students The generated list can be exported in different formats, including HTML and XML
  • Create a simple Graphical User Interface (GUI) that interacts with a relational database to read and write data.
  • Display the data as table (Java Swing JTable ) in your GUI.
  • The user must be able to choose a field to sort the rows in the table.
  • The user must be allowed to export the data in two formats (XML and HTML).
  • While exporting, the user can use standard dialogs to choose the file to export the data to.
  • After exporting, the status of the export should be shown to the user by dialog.
  • The user can create new rows, edit existing rows and remove rows from the table.

The user interface looks somewhat like this:

Technical features:

  • Lifecycle Management with Maven
  • Relational database HSqlDB
  • Full inline documentation (Javadoc)
  • Unittesting with JUnit
  • Logging via Log4J Framework
  • Persistence Layer utilizing Data Access Object Pattern in combination with JDBC Templates of the Spring framework and Dependency Injection
  • Modular Export/Import capabilities (it is possible to add a new export or import filter without modifying the existing code)
  • User Interface using Java Swing (coded manually without using a graphical UI builder!)
  • Full I18n to support multiple languages and string externalization

Documentation requirements:

  • The Java API documentation must be created using the Maven Javadoc plugin and the mvn site task
  • All classes, variables and methods have to be documented in English
  • Each package has to be documented. A package-info.java file has to be delivered for every package directory containing information what the package is used for.
Your programed basic sample should later be used as a foundation for further development.


The above illustration shows the two building blocks of the basic example: The core package and the basic package. The core package consits of several interfaces that define the behaviour/functionality of a couple of services (they act as "contract"). These interfaces are implemented by the the services of the basic package. If you use this services in your code, they can be exchanged through any other package which implements the interfaces of the core package.

The core package also contains the data objects (often refered to as model , transfer objects or value objects ). The data objects do nothing but hold the data; they represent the entities in the system. They are read from the database, modified in the business layer and sent to the presentation layer to be shown to the user. They are common to all the examples (basic, medium and advanced).

To separate the concerns, this sample uses the MVC (ModelViewController) pattern. In the MVC, our data objects are the model, the (Spring) services are the controller and the Swing presentation layer is the view. If you are unfamiliar with the MVC pattern, this page might give you a short introduction: http://java.sun.com/blueprints/patterns/MVC.html . For in-depth discussions, check out: http://c2.com/cgi/wiki?ModelViewController .

The code is heavily documented and also containts Javadoc comments. It makes sense to read the code or look at the Javadoc.

Used technology

This example uses the following technologies:

  • Swing for the presentation layer
  • Springs JDBC Templates for simplified DAOs and reuse of service code
  • jUnit for automated tests
  • Log4J as logging framework
  • HSQLdb as a lightweight in-memory database
  • Maven and its practices for code organization and lifecycle management (building, testing, packaging, documenting)

Used patterns

Patterns are essential for any architecture in terms of understanding and extending source code. Basically you should get familiar with every pattern described in the Software Patterns section. In general, the basic example makes use of these Patterns:

Build and run the Application

The following steps must be taken to run the Basic Sample.

  1. Prerequisits:
    • Java, Eclipse and Maven downloaded and installed
    • Basic Sample downloaded and unzipped
  2. Open a command line window and change to the folder where you unzipped the sample (contains at least a pom.xml ).
  3. Create the necessary Eclipse project files by typing and running mvn eclipse:eclipse within that folder.
  4. Start Eclipse and choose a workspace if you use it for the first time.
  5. Setup Maven repository variable:
  6. Import Basic Sample to Eclipse:
    • Right-click into the package explorer on the left side and choose New - Java Project .
    • Enter a project name (e.g. bpse-sample-basic) and choose the path to the directory of your prior unzipped project.
  7. Run tests and application:
    • Choose package at.ac.tuwien.ifs.bpse.basic.test from the src/test/java folder.
    • Right-click on AllTests.java and Run as - JUnit Test .
    • Choose package at.ac.tuwien.ifs.bpse.basic from the src/main/java folder.
    • Right-click on Basis.java and Run as - Java Application .