/SWE_Projekt

SWT-Project of 6870655, 4810277, 2746235 Sem 4 DHBW IT-Automotive 2021

Primary LanguageJava

SWE_Projekt

Requirements / Prerequisites

Run Application

  • Make sure, that within the same directory of SWT.jar, there exists a folder called Output_Modules/ and Aggregation_Modules/ each containing jar-modules (e.g. AGGREGATE_Ger_Satellite.jar). Optionally the input file called data.json can be placed in this directory. A zip-file representing this required folder-architecture is provided in the moodle-filing.

  • Run the application by choosing one command
  • java -jar SWT.jar (if the data.json is not placed in the directory of the SWT.jar, you'll be greeted with a file-dialog)

  • java -jar SWT.jar [PATH_TO_data.json]

Then you should see a GUI like this.

Description of the modules are shown by hovering over the combobox.

  • Make a suitable draft for the program as well as the configurable modules.
    The draft is visible in the attached class diagram. A lot of design principles and design patterns are implemented in this draft, which are listed here.
  • Create a program to connect the described module types.
    This requirement is satisfied by the ModuleLoader Class. At runtime, jar modules can be copied in either Output_Modules/ or Aggregation_Modules/ and can be loaded dynamically into the program by clicking the Reload Modules button.
    (Deleting modules is complicated, because the files are in use while the program is running.)
  • Create at least two aggregation modules.
Class Description
AGGREGATE_Ger_Satellite Aggregates all Satellites that have german channels implements IAggregate.
AGGREGATE_Radio_Channels Aggregates all Satellites with radio channels implements IAggregate.
AGGREGATE_Satellite_Channels_HD Aggregates all Satellites with HD channels implements IAggregate.
AGGREGATE_Satellite_Eng_Channel Aggregates all Satellites with english channels implements IAggregate.
AGGREGATE_Satellite_Ger_Channel Aggregates all Satellites with german channels implements IAggregate.
AGGREGATE_Satellite_Transponder_Count_Channels Aggregates all Satellites with their respective count of radio and TV channels implements IAggregate.
  • Create at least two output modules screen.
Class Description
JSONFileWriter JSONFileWriter class implements IOutput.
SimpleFileWriter SimpleFileWriter class implements IOutput.
TextBoxWriter TextBoxWriter class inherits JFrame implements IOutput.

Software-Design

Interface Aggregation-Modules

IAggregate Interface

public interface IAggregate extends IDescriptor {

 /**
  * Creates composite structure to store the aggregate.
  * 
  * @param satellitesList list of all Satellite objects
  * @return CompositeContainer Root composite container
  */
 public CompositeContainer aggregate(ArrayList<Satellite> satellitesList);
}

This interface needs to be implemented in any further aggregation-module, written by any developer. The Input of any aggregation is a list, containing all satellite data, including their transponders and channels. Any aggregation-module must return a compositum-instance (can be hierarchically indefinitely deep) containing the results of the particular aggregation.


Interface Output-Modules

IOutput Interface

public interface IOutput extends IDescriptor {

 /**
  * Outputs the contents of the composite structure
  * 
  * @param container Root composite container
  */
 public void output(CompositeContainer container);

 /**
  * Resets the Output module object to its initial state.
  * 
  */
 public void reset();
}

This interface needs to be implemented in any further output-module, written by any developer. Input of any output is a head-container of a compositum-structure, containing all aggregated key-value-data. Furthermore, the method void reset() needs to be implemented to make sure, the state of any output module can be set to its initial state afterwards.

Implemented design-patterns, Design-Principles


How to write an additional aggregation/output module

  1. Create a project for your module and include SWT.jar as external dependency.

  1. Create a class within the default package implementing IAggregate or IOutput as interface.
  2. Export the module as jar-file, where the name of your jar file e.g. MyModule.jar must match the class (e.g. MyModule.java) implementing the interface

Template for writing an aggregation-module

import java.util.ArrayList;

import model.Satellite;
import model.aggregations.IAggregate;
import model.container.CompositeContainer;

public class AGGREGATE_Template_Module implements IAggregate {

  private static final String NAME = "Decent Name of Class";
  private static final String DESCRIPTION = "<HTML><pre width=220px>"
      + "- Description: A\n"
      + "	- of: i\n"
      + "	- implemented: ii\n"
      + "	- Module: iii\n"
      + "</pre></HTML>";

  @Override
  public String getName() {
    return NAME;
  }

  @Override
  public String getDescription() {
    return DESCRIPTION;
  }

  @Override
  public CompositeContainer aggregate(ArrayList<Satellite> satellites) {
    // TODO Auto-generated method stub
    return null;
  }

}

Template for writing an output-module

import model.container.CompositeContainer;
import view.output.IOutput;

public class OUTPUT_Template_Module implements IOutput {

  private static final String NAME = "Decent Name of Class";
  private static final String DESCRIPTION = "<HTML><pre width=300px>Description of implemented module.</pre></HTML>";

  @Override
  public String getDescription() {
    return DESCRIPTION;
  }

  @Override
  public String getName() {
    return NAME;
  }

  @Override
  public void output(CompositeContainer root) {
    // TODO Auto-generated method stub

  }

  @Override
  public void reset() {
    // TODO Auto-generated method stub
  }

}

Appenxix

UML-Class-Diagram

UML_Classes

Code-Coverage

References