Initial commit
This commit is contained in:
31
assignment/pom.xml
Normal file
31
assignment/pom.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>io.github.fontysvenlo</groupId>
|
||||
<artifactId>informaticspom</artifactId>
|
||||
<version>1.7</version>
|
||||
</parent>
|
||||
<groupId>io.github.fontysvenlo.alda</groupId>
|
||||
<artifactId>appointmentplanner</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>appointmentplanner</name>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<surefire.timeout>200</surefire.timeout>
|
||||
<surefire.opens>
|
||||
--add-reads appointmentplanner=java.logging
|
||||
--add-opens appointmentplanner/appointmentplanner=ALL-UNNAMED
|
||||
</surefire.opens>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.github.fontysvenlo</groupId>
|
||||
<artifactId>alda_appointmentplanner_api</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
46
assignment/src/main/java/appointmentplanner/APFactory.java
Normal file
46
assignment/src/main/java/appointmentplanner/APFactory.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package appointmentplanner;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2019 Informatics Fontys FHTenL University of Applied Science Venlo
|
||||
*/
|
||||
|
||||
import appointmentplanner.api.*;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* Abstract factory to separate student implementations from teachers tests. The
|
||||
* instance created by this factory will be black-box tested by the teachers
|
||||
* tests.
|
||||
*
|
||||
* Richard van den Ham {@code r.vandenham@fontys.nl}
|
||||
* Pieter van den Hombergh {@code p.vandenhombergh@fontys.nl}
|
||||
*/
|
||||
public class APFactory implements AbstractAPFactory {
|
||||
|
||||
/**
|
||||
* Creates a factory.
|
||||
*/
|
||||
public APFactory() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDayPlan createLocalDayPlan(LocalDay day, Instant start, Instant end) {
|
||||
//TODO Return an instance of your class that implements LocalDayPlan
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppointmentData createAppointmentData(String description, Duration duration) {
|
||||
//TODO Return an instance of your class that implements AppointmentData
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppointmentRequest createAppointmentRequest(AppointmentData appData, LocalTime prefStart, TimePreference fallBack) {
|
||||
//TODO Return an instance of your class that implements AppointmentRequest
|
||||
return null;
|
||||
}
|
||||
}
|
||||
9
assignment/src/main/java/module-info.java
Normal file
9
assignment/src/main/java/module-info.java
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Module containing the appointment planner
|
||||
* Provides the API with the concrete factory
|
||||
*/
|
||||
module appointmentplanner {
|
||||
requires appointmenplanner.api;
|
||||
provides appointmentplanner.api.AbstractAPFactory with appointmentplanner.APFactory;
|
||||
uses appointmentplanner.api.AbstractAPFactory; // in tests
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
appointmentplanner.APFactory
|
||||
@@ -0,0 +1,22 @@
|
||||
package appointmentplanner;
|
||||
|
||||
import appointmentplanner.api.AbstractAPFactory;
|
||||
import java.util.Optional;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
/**
|
||||
* Simplest service finder returns null when nothing found.
|
||||
*/
|
||||
public class ServiceFinder {
|
||||
|
||||
public static AbstractAPFactory getFactory() {
|
||||
Optional<AbstractAPFactory> fac = ServiceLoader.load(AbstractAPFactory.class)
|
||||
.findFirst();
|
||||
if (fac.isPresent()) {
|
||||
return fac.get();
|
||||
}
|
||||
|
||||
System.err.println("Could not load AbstractAPFactory");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user