Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • db2-praktikum/base-project
  • s.ruehl/base-project
  • istasseit/base-project
  • istthweig/base-project
  • istmebici/base-project
5 results
Select Git revision
Show changes
Commits on Source (18)
Showing
with 385 additions and 244 deletions
image: openjdk:11 image: registry.code.fbi.h-da.de/db2-praktikum/base-project/dependency_image:latest
before_script: before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
- chmod +x ./gradlew - chmod +x ./gradlew
- cp -r /dependencies/.gradle ./
- cp -r /dependencies/build ./
stages: stages:
- create_dependency_image
- build - build
- check - check
...@@ -53,3 +55,21 @@ spotbugs_test: ...@@ -53,3 +55,21 @@ spotbugs_test:
paths: paths:
- spotbugsTest.html - spotbugsTest.html
expire_in: 1 week expire_in: 1 week
test:
stage: check
script:
- ./gradlew test -Dci-server=true
# create_dependency_image:
# stage: create_dependency_image
# image:
# name: gcr.io/kaniko-project/executor:debug
# entrypoint: [""]
# script:
# - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/docker/dependencyImage/Dockerfile --destination $CI_REGISTRY_IMAGE/dependency_image:latest
# when: manual
# only:
# - dependencyImage
\ No newline at end of file
# Wissenstest (Praktikum zur Lehrveranstaltung Datenbanken 2) # Wissenstest (Praktikum zur Lehrveranstaltung Datenbanken 2)
Diese Repository bildet die Grundlage für Ihr Praktikum in Datenbanken 2. Sie werden auf seiner Basis über das gesamte Semester verteilt in mehreren Schritten ein Wissensquiz entwickeln. Dieses Repository bildet die Grundlage für Ihr Praktikum in Datenbanken 2. Sie werden auf seiner Basis über das gesamte Semester verteilt in mehreren Schritten ein Wissensquiz entwickeln.
Zu diesem Zweck werden wir Git und GitLab einsetzten. Sollten Sie mehr informationen und Hilfe zu den beiden Tools benötigen, klicken Sie bitte [hier](readme/gitandgitlab.md). Zu diesem Zweck werden wir Git und GitLab einsetzten. Sollten Sie mehr Informationen und Hilfe zu den beiden Tools benötigen, klicken Sie bitte [hier](readme/gitandgitlab.md).
in diesem Dokument finden Sie die folgenden Informationen: In diesem Dokument finden Sie die folgenden Informationen:
- [Fachliche Projektbeschreibung](#fachliche-projectbeschreibung) - [Fachliche Projektbeschreibung](#fachliche-projektbeschreibung)
- [Technische Projektbeschreibung](#technische-projektbeschreibung) - [Technische Projektbeschreibung](#technische-projektbeschreibung)
- [Hinweis zur Autorenschaft](#hinweis-zur-autorenschaft) - [Hinweis zur Autorenschaft](#hinweis-zur-autorenschaft)
Hier finden Sie nun eine fachliche Projektbeschreibung des zu Implementierende Spiels Hier finden Sie nun eine fachliche Projektbeschreibung des zu Implementierenden Spiels
# Fachliche Projektbeschreibung # Fachliche Projektbeschreibung
...@@ -48,52 +48,52 @@ Haben mehrere Spieler das Spiel gespielt, so gibt es die Möglichkeit, Analysen ...@@ -48,52 +48,52 @@ Haben mehrere Spieler das Spiel gespielt, so gibt es die Möglichkeit, Analysen
## Projektrahmen ## Projektrahmen
Im diesem Repository finden Sie einen Projektrahmen, den Sie für die Implementierung des gesamten Projektes verwenden sollen. Unter anderem bringt er eine Package-Struktur mit, in die Sie Ihren Code einfügen sollen. Konkret heißt dies, dass alle von Ihnen erzeugten Klassen in `de.hda.fbi.db2.stud` oder von ihnen erstellte Unterordner in dem Package zu erstellen sind. In diesem Repository finden Sie einen Projektrahmen, den Sie für die Implementierung des gesamten Projektes verwenden sollen. Unter anderem bringt er eine Package-Struktur mit, in die Sie Ihren Code einfügen sollen. Konkret heißt dies, dass alle von Ihnen erzeugten Klassen in `de.hda.fbi.db2.stud` oder von ihnen erstellte Unterordner in dem Package zu erstellen sind.
Viele Teile des eigentlichen Wissenstests als Spiel sind bereits vorgegeben, beziehungsweise implementiert. Schauen Sie sich die abstrakten Klassen in dem Package `de.hda.fbi.db2.api` an. Ihre Aufgabe besteht darin für jedes Praktikum eine Implementierung (Unterklasse) für diese zur Verfügung zu stellen. Ihre Implementierung muss innerhalb oder unterhalb des Packages `de.hda.fbi.db2.stud` sein. Lesen Sie sich genaustens die JavaDoc Kommentare in den abstrakten Klassen durch. Viele Teile des eigentlichen Wissenstests als Spiel sind bereits vorgegeben, beziehungsweise implementiert. Schauen Sie sich die abstrakten Klassen in dem Package `de.hda.fbi.db2.api` an. Ihre Aufgabe besteht darin für jedes Praktikum eine Implementierung (Unterklasse) für diese zur Verfügung zu stellen. Ihre Implementierung muss innerhalb oder unterhalb des Packages `de.hda.fbi.db2.stud` sein. Lesen Sie sich genaustens die JavaDoc Kommentare in den abstrakten Klassen durch.
In der Klasse `Main`, müssen Sie für jeweilige Praktika gegebenenfalls Codezeilen aus- beziehungsweise einkommentieren. In der Klasse `Main`, müssen Sie für jeweilige Praktika gegebenenfalls Codezeilen aus- beziehungsweise einkommentieren.
Darüber hinaus, bringt der Projektrahmen noch die folgenden Dinge mit: Darüber hinaus, bringt der Projektrahmen noch die folgenden Dinge mit:
- Gradle Projekt: fertiges Projekt, damit Sie direkt mit der Entwicklung anfangen können. Weitere Informationen zu Gradle finden Sie [hier](https://gradle.org/) - Gradle Projekt: Fertiges Projekt, damit Sie direkt mit der Entwicklung anfangen können. Weitere Informationen zu Gradle finden Sie [hier](https://gradle.org/)
- Vorbereitete JPA Ressourcen (z.B. `persistance.xml`) - Vorbereitete JPA Ressourcen (z.B. `persistence.xml`)
- Datenbasis als `csv`-Datei. Die Datei finden Sie im Unterordner `/src/main/resources/Wissenstest_sample200.csv` - Datenbasis als `csv`-Datei. Die Datei finden Sie im Unterordner `/src/main/resources/Wissenstest_sample200.csv`
- Parser für die Datenbasis. Sie finden diesen im Package: `de.hda.fbi.db2.controller.CsvDataReader` - Parser für die Datenbasis. Der Klassenname ist: `de.hda.fbi.db2.controller.CsvDataReader`
- CI/CD Pipeline (details siehe unten) zum Bauen und Testen Ihres Projektes auf dem GitLab Server - CI/CD Pipeline (details siehe unten) zum Bauen und Testen Ihres Projektes auf dem GitLab Server
Weiter Hinweise wie sie das Projekt bei sich Lokal clonen und in IntelliJ verwenden finden sie [hier](readme/gitandgitlab.md) Weitere Hinweise wie sie das Projekt bei sich Lokal clonen und in IntelliJ verwenden finden sie [hier](readme/gitandgitlab.md)
## Benötigte Software für die Arbeit mit Git bzw. GitLab ## Benötigte Software für die Arbeit mit Git bzw. GitLab
Sie benötigen für dieses Praktikum die [IDE IntelliJ](https://www.jetbrains.com/idea/) IDE mit [Gradle-Plugin](https://docs.gradle.org/current/userguide/idea_plugin.html) (automatisch Teil von IntelliJ) und JDK11 Sie benötigen für dieses Praktikum die [IDE IntelliJ](https://www.jetbrains.com/idea/) mit [Gradle-Plugin](https://docs.gradle.org/current/userguide/idea_plugin.html) (automatisch Teil von IntelliJ) und JDK11
- Für IntelliJ ist **vorab** eine kostenlose Registrierung als Student notwendig. - Für IntelliJ ist **vorab** eine kostenlose Registrierung als Student notwendig.
- Andere IDEs sind möglich, werden im Praktikum aber nicht unterstützt. - Andere IDEs sind möglich, werden im Praktikum aber nicht unterstützt.
Wir empfehlen, zusätzlich zum in IntelliJ integrierten Git-Client die Software TortoiseGIT zu installieren: Wir empfehlen, zusätzlich zum in IntelliJ integrierten Git-Client die Software TortoiseGIT zu installieren:
- Unter Windows: [TortoiseGIT](https://tortoisegit.org/) integriert sich in den Windows-Explorer, sodass alle Funktionen im Explorer über das Kontextmenü (rechte Maustaste) aufrufbar sind. Zur Nutzung von TortoiseGIT benötigen Sie außerdem GitForWindows. - Unter Windows: [TortoiseGIT](https://tortoisegit.org/) integriert sich in den Windows-Explorer, sodass alle Funktionen im Explorer über das Kontextmenü (rechte Maustaste) aufrufbar sind. Zur Nutzung von TortoiseGIT benötigen Sie außerdem [GitForWindows](https://gitforwindows.org/).
- Falls Sie Linux verwenden, installieren Sie ein git package Ihrer Wahl. Aber, ganz ehrlich, wenn Sie Linux verwenden, wissen Sie genau was zu tun ist. - Falls Sie Linux verwenden, installieren Sie ein git package Ihrer Wahl. Aber, ganz ehrlich, wenn Sie Linux verwenden, wissen Sie genau was zu tun ist.
## Continuous Integration Pipeline ## Continuous Integration Pipeline
Der GitLab Server führt automatisch Builds und Tests Ihrer Commits durch. Damit können Sie und wir schon im Vorfeld prüfen, ob Ihr aktueller Stand den Anforderungen entspricht. Der GitLab-Server führt automatisch Builds und Tests Ihrer Commits durch. Damit können Sie und wir schon im Vorfeld prüfen, ob Ihr aktueller Stand den Anforderungen entspricht. Die existierenden Unit-Tests werden automatisch übersprungen wenn Sie die entsprechende Praktikumsaufgabe noch nicht implementiert haben.
Wie oben beschrieben, setzen wir dabei voraus, dass Sie Ihr Projekt in dem von uns vorgesehenem Package entwickeln: `de.hda.fbi.db2.stud`. Wenn Sie sich nicht an diese Anforderung halten, erhalten Sie kein Testat! Den Stand Ihrer Builds und Tests können Sie links in Ihrem Repository über das Menu "CI/CD" → "Pipelines" abrufen. Wie oben beschrieben, setzen wir dabei voraus, dass Sie Ihr Projekt in dem von uns vorgesehenem Package entwickeln: `de.hda.fbi.db2.stud`. Wenn Sie sich nicht an diese Anforderung halten, erhalten Sie kein Testat! Den Stand Ihrer Builds und Tests können Sie links in Ihrem Repository über das Menu "CI/CD" → "Pipelines" abrufen.
Die Pipeline verwendet die folgenden zwei Tools: Die Pipeline verwendet die folgenden zwei Tools:
- [Checkstyle](http://checkstyle.sourceforge.net/) ist ein Werkzeug zur statischen Code-Analyse zur Prüfung des Programmierstils von Java-Sourcecode. Konkret verwenden wir im Praktikum Google's Java Code Style. Eine Beschreibung können Sie [hier](https://google.github.io/styleguide/javaguide.html) bzw. [hier](http://checkstyle.sourceforge.net/google_style.html) finden. - [Checkstyle](https://checkstyle.sourceforge.io/) ist ein Werkzeug zur statischen Code-Analyse zur Prüfung des Programmierstils von Java-Sourcecode. Konkret verwenden wir im Praktikum Google's Java Code Style. Eine Beschreibung können Sie [hier](https://google.github.io/styleguide/javaguide.html) bzw. [hier](https://checkstyle.sourceforge.io/google_style.html) finden.
- [Spotbugs](https://spotbugs.github.io/) such in Java-Programmen nach Fehlermustern. Solche Fehlermuster deuten oft auf tatsächliche Fehler hin. - [Spotbugs](https://spotbugs.github.io/) such in Java-Programmen nach Fehlermustern. Solche Fehlermuster deuten oft auf tatsächliche Fehler hin.
## Nutzen der Checkstyle und Spotbugs in IntelliJ ## Nutzen der Checkstyle und Spotbugs in IntelliJ
Bevor Sie ihren Code zum GitLab Server pushen, sollten Sie local mit Hilfe von Spotbugs und Checkstyle überprüfen lassen ob die Pipeline Fehler finden wird. Dafür rufen Sie einfach in IntelliJ den Gradle task `build` auf. In der Konsolenausgabe werden entsprechende Fehler angezeigt. Bevor Sie ihren Code zum GitLab-Server pushen, sollten Sie local mit Hilfe von Spotbugs und Checkstyle überprüfen lassen, ob die Pipeline Fehler finden wird. Dafür rufen Sie einfach in IntelliJ den Gradle task `build` auf. In der Konsolenausgabe werden entsprechende Fehler angezeigt.
Erzeugte Reports finden Sie local im Projekt unter `/build/reports/`. Erzeugte Reports finden Sie lokal im Projekt unter `/build/reports/`.
## Konfiguration von IntelliJ zur Verwendung des Google Style Checker ## Konfiguration von IntelliJ zur Verwendung des Google Style Checker
IntelliJ verwendet standardmäßig im Editor für Style Checking **nicht** Google's Java Code Style. Dies sollten Sie manuell konfigurieren. Sie tun dies indem Sie die Einstellungen von IntelliJ öffnen (File → Settings → Editor → Code Style) und wählen bei Import Schema (siehe Screenshot) IntelliJ verwendet standardmäßig im Editor für Style Checking **nicht** Google's Java Code Style. Dies sollten Sie manuell konfigurieren. Sie tun dies, indem Sie die Einstellungen von IntelliJ öffnen (File → Settings → Editor → Code Style) und wählen bei Import Schema (siehe Screenshot)
Sie finden die nötige Datei im Projektordner unter: `/readme/intellij-java-google-style.xml` Sie finden die nötige Datei im Projektordner unter: `/readme/intellij-java-google-style.xml`
![IntelliJ Änderung Coding Style](readme/intellij-googlestyleplugin.png) ![IntelliJ Änderung Coding Style](readme/intellij-googlestyleplugin.png)
......
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.7/userguide/tutorial_java_projects.html
*/
plugins { plugins {
// Apply the java plugin to add support for Java // Apply the java plugin to add support for Java
id 'java' id 'java'
...@@ -13,88 +5,112 @@ plugins { ...@@ -13,88 +5,112 @@ plugins {
// Apply the application plugin to add support for building an application // Apply the application plugin to add support for building an application
id 'application' id 'application'
id 'com.github.spotbugs' version "2.0.0" id 'com.github.spotbugs' version '4.7.9'
id 'checkstyle' id 'checkstyle'
id "de.undercouch.download" version "4.0.0" // Used by 'downloadTests' task below
id 'de.undercouch.download' version '4.1.2'
id 'groovy'
} }
// Define the main class for the application application {
mainClassName = 'de.hda.fbi.db2.Main' // Define the main class for the application
mainClass.set('de.hda.fbi.db2.Main')
}
tasks.withType(com.github.spotbugs.SpotBugsTask) { spotbugs {
ignoreFailures = false
// Only cause failure for high priority issues
// Note: Currently this excludes all lower priority issues from report, see
// https://github.com/spotbugs/spotbugs-gradle-plugin/issues/14
reportLevel = 'high'
showStackTraces = false
}
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
reports { reports {
xml.enabled = false xml.required = false
html.enabled = true html.required = true
} }
} }
checkstyle { checkstyle {
toolVersion "8.29" toolVersion '8.29'
//configFile file("config/checkstyle/wso2_checks.xml") //configFile file('config/checkstyle/wso2_checks.xml')
//configFile file("config/checkstyle/sun_checks.xml") //configFile file('config/checkstyle/sun_checks.xml')
configFile file("config/checkstyle/google_checks.xml") configFile file('config/checkstyle/google_checks.xml')
} }
tasks.withType(Checkstyle) { tasks.withType(Checkstyle) {
reports { reports {
xml.enabled = false xml.required = false
html.enabled = true html.required = true
} }
} }
/* tasks.register('downloadTestClasses') {
task downloadTests() { description('Replaces the local test classes with the test classes from the remote base '
def unzipDir = new File('src/test/java/de/hda/fbi/db2/test') + 'project. WARNING: This overwrites local changes!')
def gitURL = 'https://code.fbi.h-da.de/db2-praktikum/base-project/-/archive/master/base-project-master.zip?path=src%2Ftest%2Fjava%2Fde%2Fhda%2Ffbi%2Fdb2%2Ftest'
download { doLast {
src gitURL def unzipDir = new File('src/test/java/de/hda/fbi/db2/test')
dest 'tests.zip' def gitURL = 'https://code.fbi.h-da.de/db2-praktikum/base-project/-/archive/master/base-project-master.zip?path=src%2Ftest%2Fjava%2Fde%2Fhda%2Ffbi%2Fdb2%2Ftest'
}
copy { download {
from zipTree('tests.zip').getFiles() src gitURL
into unzipDir dest 'tests.zip'
} }
delete 'tests.zip' copy {
} from zipTree('tests.zip').getFiles()
*/ into unzipDir
}
delete 'tests.zip'
}
}
// Specify Java version used to build this project
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
dependencies { dependencies {
// This dependency is found on compile classpath of this component and consumers.
compile 'com.google.guava:guava:23.0'
compile group: 'org.eclipse.persistence', name: 'javax.persistence', version: '2.2.1'
// Use eclipselink JPA Implementation // Use eclipselink JPA Implementation
compile('org.eclipse.persistence:eclipselink:2.7.4') { implementation 'org.eclipse.persistence:eclipselink:2.7.9'
exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence'
}
//Oracle JDBC Driver and any other libraries from 'libs' folder since not available in public maven
compile fileTree(dir: 'libs', include: ['*.jar'])
// https://mvnrepository.com/artifact/org.postgresql/postgresql // https://mvnrepository.com/artifact/org.postgresql/postgresql
compile group: 'org.postgresql', name: 'postgresql', version: '42.2.1' implementation 'org.postgresql:postgresql:42.3.1'
def spotBugsAnnotationsVersion = '4.5.0'
// SpotBugs annotations to suppress warnings about false positives
compileOnly "com.github.spotbugs:spotbugs-annotations:$spotBugsAnnotationsVersion"
testCompileOnly "com.github.spotbugs:spotbugs-annotations:$spotBugsAnnotationsVersion"
// Use JUnit test framework // Use JUnit test framework
testCompile 'junit:junit:4.12' testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1'
} }
test {
// Use JUnit 5 for tests
useJUnitPlatform()
// Pass system property to test JVM, see https://stackoverflow.com/a/21406600
systemProperty 'ci-server', System.getProperty('ci-server')
// Log information while running tests
testLogging {
events 'passed', 'skipped', 'failed'
showExceptions true
exceptionFormat 'full'
}
}
// In this section you declare where to find the dependencies of your project // In this section you declare where to find the dependencies of your project
repositories { repositories {
// Use jcenter for resolving your dependencies. mavenCentral()
// You can declare any Maven/Ivy/file repository here.
jcenter()
} }
// Attach stdin to gradle run // Attach stdin to gradle run
......
FROM openjdk:11
ENV GRADLE_USER_HOME=/workspace/.gradle
COPY ./ /workspace
WORKDIR /workspace
RUN ls -la && \
chmod +x ./gradlew && \
./gradlew assemble && \
ls -la && \
mkdir /dependencies && \
cp -r build /dependencies && \
cp -r .gradle /dependencies && \
cd / && rm -r workspace
File moved
No preview for this file type
#Sat Mar 09 13:39:39 CET 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5-all.zip
#!/usr/bin/env sh #!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
############################################################################## ##############################################################################
## #
## Gradle start up script for UN*X # Gradle start up script for POSIX generated by Gradle.
## #
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
############################################################################## ##############################################################################
# Attempt to set APP_HOME # Attempt to set APP_HOME
# Resolve links: $0 may be a link # Resolve links: $0 may be a link
PRG="$0" app_path=$0
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do # Need this for daisy-chained symlinks.
ls=`ls -ld "$PRG"` while
link=`expr "$ls" : '.*-> \(.*\)$'` APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
if expr "$link" : '/.*' > /dev/null; then [ -h "$app_path" ]
PRG="$link" do
else ls=$( ls -ld "$app_path" )
PRG=`dirname "$PRG"`"/$link" link=${ls#*' -> '}
fi case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle" APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS="" DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD=maximum
warn () { warn () {
echo "$*" echo "$*"
} } >&2
die () { die () {
echo echo
echo "$*" echo "$*"
echo echo
exit 1 exit 1
} } >&2
# OS specific support (must be 'true' or 'false'). # OS specific support (must be 'true' or 'false').
cygwin=false cygwin=false
msys=false msys=false
darwin=false darwin=false
nonstop=false nonstop=false
case "`uname`" in case "$( uname )" in #(
CYGWIN* ) CYGWIN* ) cygwin=true ;; #(
cygwin=true Darwin* ) darwin=true ;; #(
;; MSYS* | MINGW* ) msys=true ;; #(
Darwin* ) NONSTOP* ) nonstop=true ;;
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables # IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java" JAVACMD=$JAVA_HOME/jre/sh/java
else else
JAVACMD="$JAVA_HOME/bin/java" JAVACMD=$JAVA_HOME/bin/java
fi fi
if [ ! -x "$JAVACMD" ] ; then if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
...@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the ...@@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi fi
else else
JAVACMD="java" JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the Please set the JAVA_HOME variable in your environment to match the
...@@ -89,84 +140,95 @@ location of your Java installation." ...@@ -89,84 +140,95 @@ location of your Java installation."
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
MAX_FD_LIMIT=`ulimit -H -n` case $MAX_FD in #(
if [ $? -eq 0 ] ; then max*)
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD=$( ulimit -H -n ) ||
MAX_FD="$MAX_FD_LIMIT" warn "Could not query maximum file descriptor limit"
fi esac
ulimit -n $MAX_FD case $MAX_FD in #(
if [ $? -ne 0 ] ; then '' | soft) :;; #(
warn "Could not set maximum file descriptor limit: $MAX_FD" *)
fi ulimit -n "$MAX_FD" ||
else warn "Could not set maximum file descriptor limit to $MAX_FD"
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" esac
fi
fi fi
# For Darwin, add options to specify how the application appears in the dock # Collect all arguments for the java command, stacking in reverse order:
if $darwin; then # * args from the command line
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" # * the main class name
fi # * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh # Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0 for arg do
for arg in "$@" ; do if
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` case $arg in #(
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option -*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition [ -e "$t" ] ;; #(
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` *) false ;;
else esac
eval `echo args$i`="\"$arg\"" then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi fi
i=$((i+1)) # Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi fi
# Escape application args # Collect all arguments for the java command;
save () { # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done # shell script including quotes and variable substitutions, so put them in
echo " " # double quotes to make sure that they get re-expanded; and
} # * put everything else in single quotes, so that it's not re-expanded.
APP_ARGS=$(save "$@")
set -- \
# Collect all arguments for the java command, following the shell quoting and substitution rules "-Dorg.gradle.appname=$APP_BASE_NAME" \
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong "$@"
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")" # Use "xargs" to parse quoted args.
fi #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@" exec "$JAVACMD" "$@"
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
...@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. ...@@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS= set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
...@@ -35,7 +54,7 @@ goto fail ...@@ -35,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
...@@ -45,28 +64,14 @@ echo location of your Java installation. ...@@ -45,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
......
# Einführung in Git und GitLab # Einführung in Git und GitLab
## Ziel ## Ziel
[Git](https://git-scm.com/) ist eine populäre Software zur (verteilten) Versionsverwaltung von Dateien. Sie wurde initial von [Linux Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds) für den [Linux Kernel](https://en.wikipedia.org/wiki/Linux_kernel) enwickelt und gilt heute als Standard in der Software Entwicklung. [Git](https://git-scm.com/) ist eine populäre Software zur (verteilten) Versionsverwaltung von Dateien. Sie wurde initial von [Linux Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds) für den [Linux Kernel](https://en.wikipedia.org/wiki/Linux_kernel) entwickelt und gilt heute als Standard in der Software Entwicklung.
[GitLab](https://about.gitlab.com/) ist, ähnlich wie [GitHub](https://github.com/), eine Weboberfläche zum Verwalten von Git-Repositories. Das folgende Dokument führt in die für dieses Praktikum benötigte Infrastruktur und Software ein. [GitLab](https://about.gitlab.com/) ist, ähnlich wie [GitHub](https://github.com/), eine Weboberfläche zum Verwalten von Git-Repositories. Das folgende Dokument führt in die für dieses Praktikum benötigte Infrastruktur und Software ein.
## Clonen eines Projekts von Gitlab ## Clonen eines Projekts von Gitlab
Um die Arbeit zu erleichtern, finden Sie in diesem Repository einen vorbereiteten Projektrahmen. Als erstes müssen Sie sich eine lokale Kopie des Projektes erzeugen – dieser Schritt heißt bei Git clonen. Sie können das Clonen mit den installierten Git-Tools (vgl. „Benötigte Software für die Arbeit mit Git“) über das Dateisystem (git clone) oder über **IntelliJ** ausführen: Um die Arbeit zu erleichtern, finden Sie in diesem Repository einen vorbereiteten Projektrahmen. Als Erstes müssen Sie sich eine lokale Kopie des Projektes erzeugen – dieser Schritt heißt bei Git clonen. Sie können das Clonen mit den installierten Git-Tools (vgl. „Benötigte Software für die Arbeit mit Git“) über das Dateisystem (`git clone`) oder über **IntelliJ** ausführen:
- VCS &rarr; Git &rarr; Clone - VCS &rarr; Git &rarr; Clone
- Im Feld URL die URL Ihres Repositorys eintragen. - Im Feld URL die URL Ihres Repositorys eintragen.
- Unter Directory ein geeignetes Verzeichnis auf Ihrem Rechner auswählen. - Unter Directory ein geeignetes Verzeichnis auf Ihrem Rechner auswählen.
- Alle weiteren Angaben im IntelliJ-Dialog können Sie unverändert übernehmen. - Alle weiteren Angaben im IntelliJ-Dialog können Sie unverändert übernehmen.
Das vorbereitete Projekt kann in IntelliJ direkt und ohne weitere Anpassungen verwendet werden. Das eingesetzte Build-Automatisierungssystem heißt Gradle und muss von Ihnen in der Regel nicht angepasst werden, da bereits alles lauffähig konfiguriert ist und stelle eine Menge vorbereiteter Tasks, wie check, build, run, etc., zur Verfügung. Das vorbereitete Projekt kann in IntelliJ direkt und ohne weitere Anpassungen verwendet werden. Das eingesetzte Build-Automatisierungssystem heißt Gradle und muss von Ihnen in der Regel nicht angepasst werden, da bereits alles lauffähig konfiguriert ist und stellt eine Menge vorbereiteter Tasks, wie check, build, run, etc., zur Verfügung.
Der Projektrahmen ist in folgende Bereiche aufgeteilt: Der Projektrahmen ist in folgende Bereiche aufgeteilt:
- In src &rarr; main &rarr; java werden die Java-Sources abgespeichert. Das Package de.hda.fbi.db2 ist bereits eingerichtet. - In src &rarr; main &rarr; java werden die Java-Sources abgespeichert. Das Package `de.hda.fbi.db2` ist bereits eingerichtet.
- In src &rarr; main &rarr; resources werden die zum Projekt gehörenden Ressource-Dateien abgespeichert. - In src &rarr; main &rarr; resources werden die zum Projekt gehörenden Ressource-Dateien abgespeichert.
**Hinweis**: Alle von Ihnen entwickelten Java-Klassen und -Packages müssen als Unter-Packages von de.hda.fbi.db2.stud abgelegt werden, damit der automatisierte Build-Prozess (vgl. „Weitere Hinweise zur Arbeit mit GitLab“) funktioniert! **Hinweis**: Alle von Ihnen entwickelten Java-Klassen und -Packages müssen als Unter-Packages von `de.hda.fbi.db2.stud` abgelegt werden, damit der automatisierte Build-Prozess (vgl. „Weitere Hinweise zur Arbeit mit GitLab“) funktioniert!
**Beispiel**: de.hda.fbi.db2.stud.entity **Beispiel**: `de.hda.fbi.db2.stud.entity`
### Wichtige Git-Kommandos ### Wichtige Git-Kommandos
**Add** *(Selektieren Ihrer Änderungen zum Commit)*: `git add`<br/> **Add** *(Selektieren Ihrer Änderungen zum Commit)*: `git add`<br/>
...@@ -42,7 +42,7 @@ Lädt Änderungen vom Server herunter. Ggf. müssen diese Änderungen mit den lo ...@@ -42,7 +42,7 @@ Lädt Änderungen vom Server herunter. Ggf. müssen diese Änderungen mit den lo
Für Studierende, die über keine Erfahrung mit Git verfügen, empfehlen wir, nicht gleichzeitig an mehreren Rechnern zu arbeiten, und jeweils unmittelbar *vor* der Arbeit ein Pull und unmittelbar *nach* der Arbeit ein Push zu machen (Commit vor dem Push nicht vergessen!). Für Studierende, die über keine Erfahrung mit Git verfügen, empfehlen wir, nicht gleichzeitig an mehreren Rechnern zu arbeiten, und jeweils unmittelbar *vor* der Arbeit ein Pull und unmittelbar *nach* der Arbeit ein Push zu machen (Commit vor dem Push nicht vergessen!).
Des weitern empfehlen wir unerfahrenen Studierenden folgende Links: Des Weiteren empfehlen wir unerfahrenen Studierenden folgende Links:
- [Buch: *Git Pro*](https://git-scm.com/book/en/v2) (verfügbar in verschiedenen Sprachen)Gutes Buch zu Git, mit vielen (sehr vielen) Beispielen. Das Buch steht unter Creative Commons Attribution Non Commercial Share Alike 3.0 license. Es ist in verschiedenen Sprachen und Formaten verfügbar. - [Buch: *Git Pro*](https://git-scm.com/book/en/v2) (verfügbar in verschiedenen Sprachen)Gutes Buch zu Git, mit vielen (sehr vielen) Beispielen. Das Buch steht unter Creative Commons Attribution Non Commercial Share Alike 3.0 license. Es ist in verschiedenen Sprachen und Formaten verfügbar.
- [Comparing Workflows](https://www.atlassian.com/git/tutorials/comparing-workflows) eine gute Einführung in die Git-Workflows. - [Comparing Workflows](https://www.atlassian.com/git/tutorials/comparing-workflows) eine gute Einführung in die Git-Workflows.
- [learngitbranching.js.org](https://learngitbranching.js.org/) Tutorial zum Thema Git Branching - [learngitbranching.js.org](https://learngitbranching.js.org/) Tutorial zum Thema Git Branching
......
...@@ -18,7 +18,7 @@ public class Main { ...@@ -18,7 +18,7 @@ public class Main {
Controller controller = Controller.getInstance(); Controller controller = Controller.getInstance();
//TODO(stud): uncomment for lab01 //TODO(stud): uncomment for lab01
controller.readCsv(); //controller.readCsv();
//TODO(stud): uncomment for lab02 //TODO(stud): uncomment for lab02
//controller.persistData(); //controller.persistData();
......
...@@ -7,6 +7,9 @@ import java.util.List; ...@@ -7,6 +7,9 @@ import java.util.List;
*/ */
public abstract class Lab01Data { public abstract class Lab01Data {
/**
* Can be overridden to perform additional initialization tasks.
*/
public void init() { public void init() {
} }
...@@ -25,9 +28,10 @@ public abstract class Lab01Data { ...@@ -25,9 +28,10 @@ public abstract class Lab01Data {
public abstract List<?> getCategories(); public abstract List<?> getCategories();
/** /**
* Save the csv data in appropriate objects. * Save the CSV data in appropriate objects.
* *
* @param additionalCsvLines is the csv data * @param csvLines CSV lines, each line is a String array consisting of the columns of the line.
* The first line consists of the headers of the CSV columns.
*/ */
public abstract void loadCsvFile(List<String[]> additionalCsvLines); public abstract void loadCsvFile(List<String[]> csvLines);
} }
package de.hda.fbi.db2.api; package de.hda.fbi.db2.api;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
/** /**
* API Class for lab02 Created by l.koehler on 05.08.2019. * API Class for lab02 Created by l.koehler on 05.08.2019.
*/ */
public abstract class Lab02EntityManager { public abstract class Lab02EntityManager {
public void init() { /**
} * Creates the {@link EntityManagerFactory} and stores it in a field. {@link #destroy()} should
* then clean up the factory later again.
*/
public abstract void init();
/**
* {@linkplain EntityManagerFactory#close() Closes} the {@code EntityManagerFactory} created by
* {@link #init()}.
*/
public abstract void destroy();
/** /**
* You can use the data from lab01, this variable will be automatically set. * You can use the data from lab01, this variable will be automatically set.
...@@ -16,23 +26,23 @@ public abstract class Lab02EntityManager { ...@@ -16,23 +26,23 @@ public abstract class Lab02EntityManager {
protected Lab01Data lab01Data; protected Lab01Data lab01Data;
/** /**
* Setter for Lab01Data; Don't overwrite, you will break the automation. * Setter for Lab01Data. Do not touch this method.
* *
* @param lab01Data lab01Data * @param lab01Data lab01Data
*/ */
public void setLab01Data(Lab01Data lab01Data) { public final void setLab01Data(Lab01Data lab01Data) {
this.lab01Data = lab01Data; this.lab01Data = lab01Data;
} }
/** /**
* There you have to persist the data in the database. * Here you have to persist the data in the database.
*/ */
public abstract void persistData(); public abstract void persistData();
/** /**
* Return a valid EntityManager. * Creates a new {@code EntityManager}.
* *
* @return EntityManager * @return new EntityManager
*/ */
public abstract EntityManager getEntityManager(); public abstract EntityManager getEntityManager();
} }
package de.hda.fbi.db2.api; package de.hda.fbi.db2.api;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.List; import java.util.List;
/** /**
...@@ -7,6 +8,9 @@ import java.util.List; ...@@ -7,6 +8,9 @@ import java.util.List;
*/ */
public abstract class Lab03Game { public abstract class Lab03Game {
/**
* Can be overridden to perform additional initialization tasks.
*/
public void init() { public void init() {
} }
...@@ -26,16 +30,17 @@ public abstract class Lab03Game { ...@@ -26,16 +30,17 @@ public abstract class Lab03Game {
* *
* @param lab01Data lab01Data * @param lab01Data lab01Data
*/ */
public void setLab01Data(Lab01Data lab01Data) { public final void setLab01Data(Lab01Data lab01Data) {
this.lab01Data = lab01Data; this.lab01Data = lab01Data;
} }
/** /**
* Setter fro Lab02EntityManager. Do not touch this method. * Setter for Lab02EntityManager. Do not touch this method.
* *
* @param lab02EntityManager lab02EntityManager * @param lab02EntityManager lab02EntityManager
*/ */
public void setLab02EntityManager(Lab02EntityManager lab02EntityManager) { @SuppressFBWarnings("EI_EXPOSE_REP2")
public final void setLab02EntityManager(Lab02EntityManager lab02EntityManager) {
this.lab02EntityManager = lab02EntityManager; this.lab02EntityManager = lab02EntityManager;
} }
...@@ -48,7 +53,7 @@ public abstract class Lab03Game { ...@@ -48,7 +53,7 @@ public abstract class Lab03Game {
* </p> * </p>
* *
* <p>This function is primarily used for testing. There exists a version with user interaction * <p>This function is primarily used for testing. There exists a version with user interaction
* which shall be used from the menu * which shall be used from the menu.
* </p> * </p>
* *
* @param playerName The name for the new Player. * @param playerName The name for the new Player.
...@@ -67,7 +72,7 @@ public abstract class Lab03Game { ...@@ -67,7 +72,7 @@ public abstract class Lab03Game {
* </p> * </p>
* *
* <p>This function is primarily used for user interaction. There exists a version used for * <p>This function is primarily used for user interaction. There exists a version used for
* testing, @see getOrCreatePlayer</p> * testing, {@link #getOrCreatePlayer(String)}.</p>
* *
* @return Player object which was created or retrieved. * @return Player object which was created or retrieved.
* @see Lab03Game#getOrCreatePlayer(String) * @see Lab03Game#getOrCreatePlayer(String)
...@@ -116,8 +121,8 @@ public abstract class Lab03Game { ...@@ -116,8 +121,8 @@ public abstract class Lab03Game {
* *
* @param player The Player which shall play the game. * @param player The Player which shall play the game.
* @param questions The Questions which shall be asked during the game. * @param questions The Questions which shall be asked during the game.
* @return A Game Object which contains an unplayed game * @return A Game object which contains an unplayed game for the given player
* for the given player with the given questions. * with the given questions.
*/ */
public abstract Object createGame(Object player, List<?> questions); public abstract Object createGame(Object player, List<?> questions);
...@@ -127,7 +132,7 @@ public abstract class Lab03Game { ...@@ -127,7 +132,7 @@ public abstract class Lab03Game {
* <p>There is also an interactive version of this function which shall be called from the menu. * <p>There is also an interactive version of this function which shall be called from the menu.
* </p> * </p>
* *
* @param game The Game Object which shall be played. * @param game The Game object which shall be played.
* @see Lab03Game#interactivePlayGame(Object) * @see Lab03Game#interactivePlayGame(Object)
*/ */
public abstract void playGame(Object game); public abstract void playGame(Object game);
...@@ -138,15 +143,15 @@ public abstract class Lab03Game { ...@@ -138,15 +143,15 @@ public abstract class Lab03Game {
* <p>This is the function that should be called from the menu. Here you can implement the * <p>This is the function that should be called from the menu. Here you can implement the
* necessary user interaction for the playing of the game.</p> * necessary user interaction for the playing of the game.</p>
* *
* @param game The Game Object which shall be played. * @param game The Game object which shall be played.
* @see Lab03Game#playGame(Object) * @see Lab03Game#playGame(Object)
*/ */
public abstract void interactivePlayGame(Object game); public abstract void interactivePlayGame(Object game);
/** /**
* Persists a played game, including the player which played it. * Persists a played game, including the player who played it.
* *
* @param game The Game Object to be persisted. * @param game The Game object to be persisted.
*/ */
public abstract void persistGame(Object game); public abstract void persistGame(Object game);
} }
package de.hda.fbi.db2.api; package de.hda.fbi.db2.api;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/** /**
* Api for MassData. * Api for MassData.
*/ */
public abstract class Lab04MassData { public abstract class Lab04MassData {
/**
* Can be overridden to perform additional initialization tasks.
*/
public void init() { public void init() {
} }
...@@ -25,29 +30,31 @@ public abstract class Lab04MassData { ...@@ -25,29 +30,31 @@ public abstract class Lab04MassData {
protected Lab03Game lab03Game; protected Lab03Game lab03Game;
/** /**
* Setter for Lab01Data. * Setter for Lab01Data. Do not touch this method.
* *
* @param lab01Data lab01Data * @param lab01Data lab01Data
*/ */
public void setLab01Data(Lab01Data lab01Data) { public final void setLab01Data(Lab01Data lab01Data) {
this.lab01Data = lab01Data; this.lab01Data = lab01Data;
} }
/** /**
* Setter fro Lab02EntityManager. * Setter for Lab02EntityManager.
* *
* @param lab02EntityManager lab02EntityManager * @param lab02EntityManager lab02EntityManager
*/ */
public void setLab02EntityManager(Lab02EntityManager lab02EntityManager) { @SuppressFBWarnings("EI_EXPOSE_REP2")
public final void setLab02EntityManager(Lab02EntityManager lab02EntityManager) {
this.lab02EntityManager = lab02EntityManager; this.lab02EntityManager = lab02EntityManager;
} }
/** /**
* Setter fro lab03Game. * Setter for lab03Game.
* *
* @param lab03Game lab03Game * @param lab03Game lab03Game
*/ */
public void setLab03Game(Lab03Game lab03Game) { @SuppressFBWarnings("EI_EXPOSE_REP2")
public final void setLab03Game(Lab03Game lab03Game) {
this.lab03Game = lab03Game; this.lab03Game = lab03Game;
} }
......
/** /**
* To change this license header, choose License Headers in Project Properties. * Package containing abstract classes to be implemented by students.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/ */
package de.hda.fbi.db2.api; package de.hda.fbi.db2.api;