From 34a6a72ca76ae5e8ea3d02160b4163baa9912ceb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 13 Oct 2013 18:15:45 +0200 Subject: [PATCH] Add Sone database interface. --- .../pterodactylus/sone/database/SoneBuilder.java | 35 ++++++++++++++++++++++ .../sone/database/SoneBuilderFactory.java | 29 ++++++++++++++++++ .../pterodactylus/sone/database/SoneDatabase.java | 28 +++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 src/main/java/net/pterodactylus/sone/database/SoneBuilder.java create mode 100644 src/main/java/net/pterodactylus/sone/database/SoneBuilderFactory.java create mode 100644 src/main/java/net/pterodactylus/sone/database/SoneDatabase.java diff --git a/src/main/java/net/pterodactylus/sone/database/SoneBuilder.java b/src/main/java/net/pterodactylus/sone/database/SoneBuilder.java new file mode 100644 index 0000000..2aca8b9 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/database/SoneBuilder.java @@ -0,0 +1,35 @@ +/* + * Sone - SoneBuilder.java - Copyright © 2013 David Roden + * + * 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 net.pterodactylus.sone.database; + +import net.pterodactylus.sone.data.Sone; +import net.pterodactylus.sone.freenet.wot.Identity; + +/** + * Builder for {@link Sone} objects. + * + * @author David ‘Bombe’ Roden + */ +public interface SoneBuilder { + + SoneBuilder by(Identity identity); + SoneBuilder local(); + + Sone build() throws IllegalStateException; + +} diff --git a/src/main/java/net/pterodactylus/sone/database/SoneBuilderFactory.java b/src/main/java/net/pterodactylus/sone/database/SoneBuilderFactory.java new file mode 100644 index 0000000..672fdd8 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/database/SoneBuilderFactory.java @@ -0,0 +1,29 @@ +/* + * Sone - SoneBuilderFactory.java - Copyright © 2013 David Roden + * + * 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 net.pterodactylus.sone.database; + +/** + * Factory for {@link SoneBuilder} objects. + * + * @author David ‘Bombe’ Roden + */ +public interface SoneBuilderFactory { + + SoneBuilder newSoneBuilder(); + +} diff --git a/src/main/java/net/pterodactylus/sone/database/SoneDatabase.java b/src/main/java/net/pterodactylus/sone/database/SoneDatabase.java new file mode 100644 index 0000000..825be32 --- /dev/null +++ b/src/main/java/net/pterodactylus/sone/database/SoneDatabase.java @@ -0,0 +1,28 @@ +/* + * Sone - SoneDatabase.java - Copyright © 2013 David Roden + * + * 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 net.pterodactylus.sone.database; + +/** + * Combines a {@link SoneProvider} and a {@link SoneBuilderFactory} into a Sone + * database. + * + * @author David ‘Bombe’ Roden + */ +public interface SoneDatabase extends SoneProvider, SoneBuilderFactory { + +} -- 2.7.4