From 684a2a6bfcc716cc06f08d3fa180ae404dc7ce87 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 4 Jun 2008 08:33:08 +0200 Subject: [PATCH] some basic stuff --- src/net/pterodactylus/fac/core/Core.java | 67 ++++++++++ src/net/pterodactylus/fac/core/Insert.java | 145 ++++++++++++++++++++++ src/net/pterodactylus/fac/core/InsertManager.java | 31 +++++ src/net/pterodactylus/fac/main/Main.java | 43 +++++++ 4 files changed, 286 insertions(+) create mode 100644 src/net/pterodactylus/fac/core/Core.java create mode 100644 src/net/pterodactylus/fac/core/Insert.java create mode 100644 src/net/pterodactylus/fac/core/InsertManager.java create mode 100644 src/net/pterodactylus/fac/main/Main.java diff --git a/src/net/pterodactylus/fac/core/Core.java b/src/net/pterodactylus/fac/core/Core.java new file mode 100644 index 0000000..25312aa --- /dev/null +++ b/src/net/pterodactylus/fac/core/Core.java @@ -0,0 +1,67 @@ +/* + * fac - Core.java - + * Copyright © 2008 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fac.core; + +/** + * TODO + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +public class Core { + + /** The shutdown hook. */ + @SuppressWarnings("synthetic-access") + private final Runnable shutdownHook = new ShutdownHook(); + + /** + * Constructor. + */ + public Core() { + Runtime.getRuntime().addShutdownHook(new Thread(shutdownHook)); + } + + // + // ACTIONS + // + + /** + * Starts the core. + */ + public void start() { + /* TODO */ + } + + /** + * Shutdown hook. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ + private class ShutdownHook implements Runnable { + + /** + * {@inheritDoc} + */ + public void run() { + /* TODO */ + } + + } + +} diff --git a/src/net/pterodactylus/fac/core/Insert.java b/src/net/pterodactylus/fac/core/Insert.java new file mode 100644 index 0000000..2482717 --- /dev/null +++ b/src/net/pterodactylus/fac/core/Insert.java @@ -0,0 +1,145 @@ +/* + * fac - Insert.java - + * Copyright © 2008 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fac.core; + +/** + * Data container that keeps statistics of an insert. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +public class Insert { + + /** The time the data was inserted. */ + private long insertTime; + + /** The URI the data generated. */ + private String uri; + + /** The time the data should be retrieved. */ + private long checkTime; + + /** Whether the data was already checked. */ + private boolean checked; + + /** Whether the data was successfully downloaded. */ + private boolean successful; + + /** + * Returns the time the data was inserted. + * + * @return The time the data was inserted + */ + public long getInsertTime() { + return insertTime; + } + + /** + * Sets the time the data was inserted. + * + * @param insertTime + * The time the data was inserted + */ + public void setInsertTime(long insertTime) { + this.insertTime = insertTime; + } + + /** + * Returns the URI generated by the data. + * + * @return The URI of the data + */ + public String getURI() { + return uri; + } + + /** + * Sets the URI generated by the data + * + * @param uri + * The URI of the data + */ + public void setURI(String uri) { + this.uri = uri; + } + + /** + * Returns the time the data should be checked. + * + * @return The time the data should be checked + */ + public long getCheckTime() { + return checkTime; + } + + /** + * Sets the time the data should be checked. + * + * @param checkTime + * The time the data should be checked + */ + public void setCheckTime(long checkTime) { + this.checkTime = checkTime; + } + + /** + * Returns whether the data has already been checked, i.e. a check already + * returned a result. + * + * @return true if the data was already checked, + * false otherwise + */ + public boolean isChecked() { + return checked; + } + + /** + * Sets whether the data has already been checked, i.e. a check already + * returned a result. + * + * @param checked + * true if the data was already checked, + * false otherwise + */ + public void setChecked(boolean checked) { + this.checked = checked; + } + + /** + * Returns whether the data was checked successfully. + * + * @return true if the data was checked successfully, + * false otherwise + */ + public boolean isSuccessful() { + return successful; + } + + /** + * Sets whether the data was checked successfully. + * + * @param successful + * true if the data was checked successfully, + * false otherwise + */ + public void setSuccessful(boolean successful) { + this.successful = successful; + } + +} diff --git a/src/net/pterodactylus/fac/core/InsertManager.java b/src/net/pterodactylus/fac/core/InsertManager.java new file mode 100644 index 0000000..92062a5 --- /dev/null +++ b/src/net/pterodactylus/fac/core/InsertManager.java @@ -0,0 +1,31 @@ +/* + * fac - InsertManager.java - + * Copyright © 2008 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fac.core; + + +/** + * TODO + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +public class InsertManager { + + /* TODO */ + +} diff --git a/src/net/pterodactylus/fac/main/Main.java b/src/net/pterodactylus/fac/main/Main.java new file mode 100644 index 0000000..f522b83 --- /dev/null +++ b/src/net/pterodactylus/fac/main/Main.java @@ -0,0 +1,43 @@ +/* + * fac - Main.java - + * Copyright © 2008 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package net.pterodactylus.fac.main; + +import net.pterodactylus.fac.core.Core; + +/** + * Main class. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +public class Main { + + /** + * Starts the core. + * + * @param commandLine + * Command-line parameters (ignored) + */ + public static void main(String[] commandLine) { + Core core = new Core(); + + core.start(); + } + +} -- 2.7.4