From 16107430c57b84909e05a240794930f0f7bffcba Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Wed, 23 Sep 2020 23:58:54 +0200 Subject: [PATCH] Project lombok --- pom.xml | 34 ++++++++++++++++ src/main/lombok/module-info.java | 5 +++ .../org/warp/filesponge/App.java | 0 .../org/warp/filesponge/api/FileAccessor.java | 27 +++++++++++++ .../org/warp/filesponge/api/FileContent.java | 21 ++++++++++ .../org/warp/filesponge/api/FileStatus.java | 40 +++++++++++++++++++ .../org/warp/filesponge/api/FileURI.java | 21 ++++++++++ .../org/warp/filesponge/AppTest.java | 0 8 files changed, 148 insertions(+) create mode 100644 src/main/lombok/module-info.java rename src/main/{java => lombok}/org/warp/filesponge/App.java (100%) create mode 100644 src/main/lombok/org/warp/filesponge/api/FileAccessor.java create mode 100644 src/main/lombok/org/warp/filesponge/api/FileContent.java create mode 100644 src/main/lombok/org/warp/filesponge/api/FileStatus.java create mode 100644 src/main/lombok/org/warp/filesponge/api/FileURI.java rename src/test/{java => lombok}/org/warp/filesponge/AppTest.java (100%) diff --git a/pom.xml b/pom.xml index f09c3cd..9d4b05d 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ UTF-8 11 + 11 @@ -40,9 +41,42 @@ 5.7.0-M1 test + + org.projectlombok + lombok + 1.18.12 + + + org.jetbrains + annotations + RELEASE + compile + + src/main/lombok + src/main/lombok + + + org.apache.maven.plugins + maven-compiler-plugin + + + maven-compiler-plugin + 3.8.0 + + + + + org.projectlombok + lombok + 1.18.12 + + + + + diff --git a/src/main/lombok/module-info.java b/src/main/lombok/module-info.java new file mode 100644 index 0000000..bea3e58 --- /dev/null +++ b/src/main/lombok/module-info.java @@ -0,0 +1,5 @@ +module org.warp.filesponge { + exports org.warp.filesponge.api; + requires lombok; + requires org.jetbrains.annotations; +} \ No newline at end of file diff --git a/src/main/java/org/warp/filesponge/App.java b/src/main/lombok/org/warp/filesponge/App.java similarity index 100% rename from src/main/java/org/warp/filesponge/App.java rename to src/main/lombok/org/warp/filesponge/App.java diff --git a/src/main/lombok/org/warp/filesponge/api/FileAccessor.java b/src/main/lombok/org/warp/filesponge/api/FileAccessor.java new file mode 100644 index 0000000..1669878 --- /dev/null +++ b/src/main/lombok/org/warp/filesponge/api/FileAccessor.java @@ -0,0 +1,27 @@ +/* + * FileSponge + * Copyright (C) 2020 Andrea Cavalli + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.warp.filesponge.api; + +import java.util.Optional; + +public interface FileAccessor { + void delete(FileURI fileURI); + Optional getContent(FileURI fileURI, boolean offlineOnly); + FileStatus getStatus(FileURI fileURI); +} diff --git a/src/main/lombok/org/warp/filesponge/api/FileContent.java b/src/main/lombok/org/warp/filesponge/api/FileContent.java new file mode 100644 index 0000000..af0c871 --- /dev/null +++ b/src/main/lombok/org/warp/filesponge/api/FileContent.java @@ -0,0 +1,21 @@ +/* + * FileSponge + * Copyright (C) 2020 Andrea Cavalli + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.warp.filesponge.api; + +public interface FileContent {} diff --git a/src/main/lombok/org/warp/filesponge/api/FileStatus.java b/src/main/lombok/org/warp/filesponge/api/FileStatus.java new file mode 100644 index 0000000..8d47c80 --- /dev/null +++ b/src/main/lombok/org/warp/filesponge/api/FileStatus.java @@ -0,0 +1,40 @@ +/* + * FileSponge + * Copyright (C) 2020 Andrea Cavalli + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.warp.filesponge.api; + +import java.util.Optional; +import lombok.Value; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +@Value +public class FileStatus { + @NotNull FileAvailability availability; + @NotNull FileDataAvailability dataAvailability; + @Nullable Integer totalSize; + @Nullable Integer downloadedSize; + + public Optional getTotalSize() { + return Optional.ofNullable(totalSize); + } + + public Optional getDownloadedSize() { + return Optional.ofNullable(downloadedSize); + } +} diff --git a/src/main/lombok/org/warp/filesponge/api/FileURI.java b/src/main/lombok/org/warp/filesponge/api/FileURI.java new file mode 100644 index 0000000..ae458bb --- /dev/null +++ b/src/main/lombok/org/warp/filesponge/api/FileURI.java @@ -0,0 +1,21 @@ +/* + * FileSponge + * Copyright (C) 2020 Andrea Cavalli + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.warp.filesponge.api; + +public interface FileURI {} diff --git a/src/test/java/org/warp/filesponge/AppTest.java b/src/test/lombok/org/warp/filesponge/AppTest.java similarity index 100% rename from src/test/java/org/warp/filesponge/AppTest.java rename to src/test/lombok/org/warp/filesponge/AppTest.java