From: David ‘Bombe’ Roden Date: Tue, 3 Feb 2015 17:58:50 +0000 (+0100) Subject: Merge branch 'release-0.12' X-Git-Tag: 0.12 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=refs%2Ftags%2F0.12;hp=7e470976ab9d4d7430e43ba96c9c100f799240ed;p=jSite.git Merge branch 'release-0.12' --- diff --git a/pom.xml b/pom.xml index 7302bb8..88db65b 100644 --- a/pom.xml +++ b/pom.xml @@ -2,13 +2,22 @@ 4.0.0 net.pterodactylus jSite - 0.11.1 + ${version} + + 0.12 + UTF-8 + net.pterodactylus utils 0.12.1 + + com.google.guava + guava + 14.0.1 + @@ -16,9 +25,6 @@ http://maven.pterodactylus.net/ - - UTF-8 - @@ -27,6 +33,7 @@ 1.6 1.6 + UTF-8 @@ -75,6 +82,48 @@ de.todesbaum.jsite.main.Main + + org.jacoco + jacoco-maven-plugin + 0.7.1.201405082137 + + + default-prepare-agent + + prepare-agent + + + + default-report + prepare-package + + report + + + + default-check + + check + + + + + + BUNDLE + + + + COMPLEXITY + COVEREDRATIO + 0.60 + + + + + + + + diff --git a/src/main/java/de/todesbaum/jsite/application/AbortedException.java b/src/main/java/de/todesbaum/jsite/application/AbortedException.java index 0dfd8c7..f399575 100644 --- a/src/main/java/de/todesbaum/jsite/application/AbortedException.java +++ b/src/main/java/de/todesbaum/jsite/application/AbortedException.java @@ -1,5 +1,5 @@ /* - * jSite - AbortedException.java - Copyright © 2010–2012 David Roden + * jSite - AbortedException.java - Copyright © 2010–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/application/FileOption.java b/src/main/java/de/todesbaum/jsite/application/FileOption.java index c8824de..4c38286 100644 --- a/src/main/java/de/todesbaum/jsite/application/FileOption.java +++ b/src/main/java/de/todesbaum/jsite/application/FileOption.java @@ -1,5 +1,5 @@ /* - * jSite - FileOption.java - Copyright © 2006–2012 David Roden + * jSite - FileOption.java - Copyright © 2006–2014 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 @@ -18,6 +18,11 @@ package de.todesbaum.jsite.application; +import static com.google.common.base.Optional.absent; +import static com.google.common.base.Optional.of; + +import com.google.common.base.Optional; + /** * Container for various file options. * @@ -34,9 +39,6 @@ public class FileOption { /** The default for the custom key. */ private static final String DEFAULT_CUSTOM_KEY = "CHK@"; - /** The default changed name. */ - private static final String DEFAULT_CHANGED_NAME = null; - /** The insert state. */ private boolean insert; @@ -62,7 +64,7 @@ public class FileOption { private String customKey; /** The changed name. */ - private String changedName; + private Optional changedName = absent(); /** The default MIME type. */ private final String defaultMimeType; @@ -80,7 +82,6 @@ public class FileOption { insert = DEFAULT_INSERT; insertRedirect = DEFAULT_INSERT_REDIRECT; customKey = DEFAULT_CUSTOM_KEY; - changedName = DEFAULT_CHANGED_NAME; this.defaultMimeType = defaultMimeType; mimeType = defaultMimeType; } @@ -278,24 +279,13 @@ public class FileOption { } /** - * Returns whether this file has a changed name. Use - * {@link #getChangedName()} is this method returns {@code true}. - * - * @return {@code true} if this file has a changed name, {@code false} - * otherwise - */ - public boolean hasChangedName() { - return (changedName != null) && (changedName.length() > 0); - } - - /** * Returns the changed name for this file. This method will return {@code * null} or an empty {@link String} if this file should not be renamed. * * @return The changed name, or {@code null} if this file should not be * renamed */ - public String getChangedName() { + public Optional getChangedName() { return changedName; } @@ -307,7 +297,7 @@ public class FileOption { * The new changed name for this file */ public void setChangedName(String changedName) { - this.changedName = changedName; + this.changedName = ((changedName != null) && (changedName.length() > 0)) ? of(changedName) : Optional.absent(); } /** @@ -349,7 +339,7 @@ public class FileOption { if (!customKey.equals(DEFAULT_CUSTOM_KEY)) { return true; } - if (((changedName != null) && !changedName.equals(DEFAULT_CHANGED_NAME)) || ((DEFAULT_CHANGED_NAME != null) && !DEFAULT_CHANGED_NAME.equals(changedName))) { + if (changedName.isPresent()) { return true; } if (!defaultMimeType.equals(mimeType)) { diff --git a/src/main/java/de/todesbaum/jsite/application/Freenet7Interface.java b/src/main/java/de/todesbaum/jsite/application/Freenet7Interface.java index 78250b2..657adfe 100644 --- a/src/main/java/de/todesbaum/jsite/application/Freenet7Interface.java +++ b/src/main/java/de/todesbaum/jsite/application/Freenet7Interface.java @@ -1,5 +1,5 @@ /* - * jSite - Freenet7Interface.java - Copyright © 2006–2012 David Roden + * jSite - Freenet7Interface.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/application/InsertListener.java b/src/main/java/de/todesbaum/jsite/application/InsertListener.java index 9b6b332..8d6eba0 100644 --- a/src/main/java/de/todesbaum/jsite/application/InsertListener.java +++ b/src/main/java/de/todesbaum/jsite/application/InsertListener.java @@ -1,5 +1,5 @@ /* - * jSite - InsertListener.java - Copyright © 2006–2012 David Roden + * jSite - InsertListener.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/application/Node.java b/src/main/java/de/todesbaum/jsite/application/Node.java index df7492f..2851e89 100644 --- a/src/main/java/de/todesbaum/jsite/application/Node.java +++ b/src/main/java/de/todesbaum/jsite/application/Node.java @@ -1,5 +1,5 @@ /* - * jSite - Node.java - Copyright © 2006–2012 David Roden + * jSite - Node.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/application/Project.java b/src/main/java/de/todesbaum/jsite/application/Project.java index 484de85..836a2cd 100644 --- a/src/main/java/de/todesbaum/jsite/application/Project.java +++ b/src/main/java/de/todesbaum/jsite/application/Project.java @@ -1,5 +1,5 @@ /* - * jSite - Project.java - Copyright © 2006–2012 David Roden + * jSite - Project.java - Copyright © 2006–2014 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 @@ -460,7 +460,7 @@ public class Project implements Comparable { if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && (!fileOption.getCurrentHash().equals(fileOption.getLastInsertHash()) || fileOption.isForceInsert())) { fileOption.setLastInsertEdition(edition); fileOption.setLastInsertHash(fileOption.getCurrentHash()); - fileOption.setLastInsertFilename(fileOption.hasChangedName() ? fileOption.getChangedName() : fileOptionEntry.getKey()); + fileOption.setLastInsertFilename(fileOption.getChangedName().or(fileOptionEntry.getKey())); } fileOption.setForceInsert(false); } diff --git a/src/main/java/de/todesbaum/jsite/application/ProjectInsertListeners.java b/src/main/java/de/todesbaum/jsite/application/ProjectInsertListeners.java new file mode 100644 index 0000000..2bccf31 --- /dev/null +++ b/src/main/java/de/todesbaum/jsite/application/ProjectInsertListeners.java @@ -0,0 +1,133 @@ +/* + * jSite - ProjectInsertListeners.java - Copyright © 2013–2014 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 de.todesbaum.jsite.application; + +import java.util.ArrayList; +import java.util.List; + +/** + * Manages {@link InsertListener}s for the {@link ProjectInserter}. + * + * @author David ‘Bombe’ Roden <bombe@freenetproject.org> + */ +class ProjectInsertListeners { + + /** The list of insert listeners. */ + private final List insertListeners = new ArrayList(); + + /** + * Adds a listener to the list of registered listeners. + * + * @param insertListener + * The listener to add + */ + void addInsertListener(InsertListener insertListener) { + insertListeners.add(insertListener); + } + + /** + * Removes a listener from the list of registered listeners. + * + * @param insertListener + * The listener to remove + */ + void removeInsertListener(InsertListener insertListener) { + insertListeners.remove(insertListener); + } + + /** + * Notifies all listeners that the project insert has started. + * + * @param project + * @see InsertListener#projectInsertStarted(Project) + */ + void fireProjectInsertStarted(Project project) { + for (InsertListener insertListener : insertListeners) { + insertListener.projectInsertStarted(project); + } + } + + /** + * Notifies all listeners that the insert has generated a URI. + * + * @param project + * @param uri + * The generated URI + * @see InsertListener#projectURIGenerated(Project, String) + */ + void fireProjectURIGenerated(Project project, String uri) { + for (InsertListener insertListener : insertListeners) { + insertListener.projectURIGenerated(project, uri); + } + } + + /** + * Notifies all listeners that the insert has made some progress. + * + * @param project + * @see InsertListener#projectUploadFinished(Project) + */ + void fireProjectUploadFinished(Project project) { + for (InsertListener insertListener : insertListeners) { + insertListener.projectUploadFinished(project); + } + } + + /** + * Notifies all listeners that the insert has made some progress. + * + * @param project + * @param succeeded + * The number of succeeded blocks + * @param failed + * The number of failed blocks + * @param fatal + * The number of fatally failed blocks + * @param total + * The total number of blocks + * @param finalized + * true if the total number of blocks has already been + * finalized, false otherwise + * @see InsertListener#projectInsertProgress(Project, int, int, int, int, + * boolean) + */ + void fireProjectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) { + for (InsertListener insertListener : insertListeners) { + insertListener.projectInsertProgress(project, succeeded, failed, fatal, total, finalized); + } + } + + /** + * Notifies all listeners the project insert has finished. + * + * @param project + * @param success + * true if the project was inserted successfully, + * false if it failed + * @param cause + * The cause of the failure, if any + * @see InsertListener#projectInsertFinished(Project, boolean, Throwable) + */ + void fireProjectInsertFinished(Project project, boolean success, Throwable cause) { + for (InsertListener insertListener : insertListeners) { + insertListener.projectInsertFinished(project, success, cause); + } + } + +} diff --git a/src/main/java/de/todesbaum/jsite/application/ProjectInserter.java b/src/main/java/de/todesbaum/jsite/application/ProjectInserter.java index 30d4d7a..35a2452 100644 --- a/src/main/java/de/todesbaum/jsite/application/ProjectInserter.java +++ b/src/main/java/de/todesbaum/jsite/application/ProjectInserter.java @@ -1,5 +1,5 @@ /* - * jSite - ProjectInserter.java - Copyright © 2006–2012 David Roden + * jSite - ProjectInserter.java - Copyright © 2006–2014 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 @@ -20,6 +20,7 @@ package de.todesbaum.jsite.application; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; @@ -35,6 +36,8 @@ import java.util.logging.Level; import java.util.logging.Logger; import net.pterodactylus.util.io.StreamCopier.ProgressListener; + +import com.google.common.base.Optional; import de.todesbaum.jsite.gui.FileScanner; import de.todesbaum.jsite.gui.FileScanner.ScannedFile; import de.todesbaum.jsite.gui.FileScannerListener; @@ -65,20 +68,19 @@ public class ProjectInserter implements FileScannerListener, Runnable { /** Counter for FCP connection identifier. */ private static int counter = 0; - /** The list of insert listeners. */ - private List insertListeners = new ArrayList(); + private final ProjectInsertListeners projectInsertListeners = new ProjectInsertListeners(); /** The freenet interface. */ - protected Freenet7Interface freenetInterface; + private Freenet7Interface freenetInterface; /** The project to insert. */ - protected Project project; + private Project project; /** The file scanner. */ private FileScanner fileScanner; /** Object used for synchronization. */ - protected final Object lockObject = new Object(); + private final Object lockObject = new Object(); /** The temp directory. */ private String tempDirectory; @@ -108,91 +110,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { * The listener to add */ public void addInsertListener(InsertListener insertListener) { - insertListeners.add(insertListener); - } - - /** - * Removes a listener from the list of registered listeners. - * - * @param insertListener - * The listener to remove - */ - public void removeInsertListener(InsertListener insertListener) { - insertListeners.remove(insertListener); - } - - /** - * Notifies all listeners that the project insert has started. - * - * @see InsertListener#projectInsertStarted(Project) - */ - protected void fireProjectInsertStarted() { - for (InsertListener insertListener : insertListeners) { - insertListener.projectInsertStarted(project); - } - } - - /** - * Notifies all listeners that the insert has generated a URI. - * - * @see InsertListener#projectURIGenerated(Project, String) - * @param uri - * The generated URI - */ - protected void fireProjectURIGenerated(String uri) { - for (InsertListener insertListener : insertListeners) { - insertListener.projectURIGenerated(project, uri); - } - } - - /** - * Notifies all listeners that the insert has made some progress. - * - * @see InsertListener#projectUploadFinished(Project) - */ - protected void fireProjectUploadFinished() { - for (InsertListener insertListener : insertListeners) { - insertListener.projectUploadFinished(project); - } - } - - /** - * Notifies all listeners that the insert has made some progress. - * - * @see InsertListener#projectInsertProgress(Project, int, int, int, int, - * boolean) - * @param succeeded - * The number of succeeded blocks - * @param failed - * The number of failed blocks - * @param fatal - * The number of fatally failed blocks - * @param total - * The total number of blocks - * @param finalized - * true if the total number of blocks has already - * been finalized, false otherwise - */ - protected void fireProjectInsertProgress(int succeeded, int failed, int fatal, int total, boolean finalized) { - for (InsertListener insertListener : insertListeners) { - insertListener.projectInsertProgress(project, succeeded, failed, fatal, total, finalized); - } - } - - /** - * Notifies all listeners the project insert has finished. - * - * @see InsertListener#projectInsertFinished(Project, boolean, Throwable) - * @param success - * true if the project was inserted successfully, - * false if it failed - * @param cause - * The cause of the failure, if any - */ - protected void fireProjectInsertFinished(boolean success, Throwable cause) { - for (InsertListener insertListener : insertListeners) { - insertListener.projectInsertFinished(project, success, cause); - } + projectInsertListeners.addInsertListener(insertListener); } /** @@ -284,41 +202,14 @@ public class ProjectInserter implements FileScannerListener, Runnable { } /** - * Creates an input stream that delivers the given file, replacing edition - * tokens in the file’s content, if necessary. - * - * @param filename - * The name of the file - * @param fileOption - * The file options - * @param edition - * The current edition - * @param length - * An array containing a single long which is used to - * return the final length of the file, after all - * replacements - * @return The input stream for the file - * @throws IOException - * if an I/O error occurs - */ - private InputStream createFileInputStream(String filename, FileOption fileOption, int edition, long[] length) throws IOException { - File file = new File(project.getLocalPath(), filename); - length[0] = file.length(); - return new FileInputStream(file); - } - - /** * Creates a file entry suitable for handing in to * {@link ClientPutComplexDir#addFileEntry(FileEntry)}. * * @param file - * The name and hash of the file to insert - * @param edition - * The current edition + * The name and hash of the file to insert * @return A file entry for the given file */ - private FileEntry createFileEntry(ScannedFile file, int edition) { - FileEntry fileEntry = null; + private FileEntry createFileEntry(ScannedFile file) { String filename = file.getFilename(); FileOption fileOption = project.getFileOption(filename); if (fileOption.isInsert()) { @@ -327,21 +218,25 @@ public class ProjectInserter implements FileScannerListener, Runnable { if (!project.isAlwaysForceInsert() && !fileOption.isForceInsert() && file.getHash().equals(fileOption.getLastInsertHash())) { /* only insert a redirect. */ logger.log(Level.FINE, String.format("Inserting redirect to edition %d for %s.", fileOption.getLastInsertEdition(), filename)); - return new RedirectFileEntry(fileOption.hasChangedName() ? fileOption.getChangedName() : filename, fileOption.getMimeType(), "SSK@" + project.getRequestURI() + "/" + project.getPath() + "-" + fileOption.getLastInsertEdition() + "/" + fileOption.getLastInsertFilename()); + return new RedirectFileEntry(fileOption.getChangedName().or(filename), fileOption.getMimeType(), "SSK@" + project.getRequestURI() + "/" + project.getPath() + "-" + fileOption.getLastInsertEdition() + "/" + fileOption.getLastInsertFilename()); } try { - long[] fileLength = new long[1]; - InputStream fileEntryInputStream = createFileInputStream(filename, fileOption, edition, fileLength); - fileEntry = new DirectFileEntry(fileOption.hasChangedName() ? fileOption.getChangedName() : filename, fileOption.getMimeType(), fileEntryInputStream, fileLength[0]); + return createFileEntry(filename, fileOption.getChangedName(), fileOption.getMimeType()); } catch (IOException ioe1) { /* ignore, null is returned. */ } } else { if (fileOption.isInsertRedirect()) { - fileEntry = new RedirectFileEntry(fileOption.hasChangedName() ? fileOption.getChangedName() : filename, fileOption.getMimeType(), fileOption.getCustomKey()); + return new RedirectFileEntry(fileOption.getChangedName().or(filename), fileOption.getMimeType(), fileOption.getCustomKey()); } } - return fileEntry; + return null; + } + + private FileEntry createFileEntry(String filename, Optional changedName, String mimeType) throws FileNotFoundException { + File physicalFile = new File(project.getLocalPath(), filename); + InputStream fileEntryInputStream = new FileInputStream(physicalFile); + return new DirectFileEntry(changedName.or(filename), mimeType, fileEntryInputStream, physicalFile.length()); } /** @@ -399,10 +294,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { logger.log(Level.FINEST, "Ignoring {0}.", fileOptionEntry.getKey()); continue; } - String fileName = fileOptionEntry.getKey(); - if (fileOption.hasChangedName()) { - fileName = fileOption.getChangedName(); - } + String fileName = fileOption.getChangedName().or(fileOptionEntry.getKey()); logger.log(Level.FINEST, "Adding “{0}” for {1}.", new Object[] { fileName, fileOptionEntry.getKey() }); if (!fileNames.add(fileName)) { checkReport.addIssue("error.duplicate-file", true, fileName); @@ -445,7 +337,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { */ @Override public void run() { - fireProjectInsertStarted(); + projectInsertListeners.fireProjectInsertStarted(project); List files = fileScanner.getFiles(); /* create connection to node */ @@ -462,7 +354,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { } if (!connected || cancelled) { - fireProjectInsertFinished(false, cancelled ? new AbortedException() : cause); + projectInsertListeners.fireProjectInsertFinished(project, false, cancelled ? new AbortedException() : cause); return; } @@ -473,7 +365,13 @@ public class ProjectInserter implements FileScannerListener, Runnable { String dirURI = "USK@" + project.getInsertURI() + "/" + project.getPath() + "/" + edition + "/"; ClientPutComplexDir putDir = new ClientPutComplexDir("dir-" + counter++, dirURI, tempDirectory); if ((project.getIndexFile() != null) && (project.getIndexFile().length() > 0)) { - putDir.setDefaultName(project.getIndexFile()); + FileOption indexFileOption = project.getFileOption(project.getIndexFile()); + Optional changedName = indexFileOption.getChangedName(); + if (changedName.isPresent()) { + putDir.setDefaultName(changedName.get()); + } else { + putDir.setDefaultName(project.getIndexFile()); + } } putDir.setVerbosity(Verbosity.ALL); putDir.setMaxRetries(-1); @@ -481,12 +379,12 @@ public class ProjectInserter implements FileScannerListener, Runnable { putDir.setPriorityClass(priority); putDir.setManifestPutter(manifestPutter); for (ScannedFile file : files) { - FileEntry fileEntry = createFileEntry(file, edition); + FileEntry fileEntry = createFileEntry(file); if (fileEntry != null) { try { putDir.addFileEntry(fileEntry); } catch (IOException ioe1) { - fireProjectInsertFinished(false, ioe1); + projectInsertListeners.fireProjectInsertFinished(project, false, ioe1); return; } } @@ -495,9 +393,9 @@ public class ProjectInserter implements FileScannerListener, Runnable { /* start request */ try { client.execute(putDir, progressListener); - fireProjectUploadFinished(); + projectInsertListeners.fireProjectUploadFinished(project); } catch (IOException ioe1) { - fireProjectInsertFinished(false, ioe1); + projectInsertListeners.fireProjectInsertFinished(project, false, ioe1); return; } @@ -515,7 +413,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { String messageName = message.getName(); if ("URIGenerated".equals(messageName)) { finalURI = message.get("URI"); - fireProjectURIGenerated(finalURI); + projectInsertListeners.fireProjectURIGenerated(project, finalURI); } if ("SimpleProgress".equals(messageName)) { int total = Integer.parseInt(message.get("Total")); @@ -523,7 +421,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { int fatal = Integer.parseInt(message.get("FatallyFailed")); int failed = Integer.parseInt(message.get("Failed")); boolean finalized = Boolean.parseBoolean(message.get("FinalizedTotal")); - fireProjectInsertProgress(succeeded, failed, fatal, total, finalized); + projectInsertListeners.fireProjectInsertProgress(project, succeeded, failed, fatal, total, finalized); } success |= "PutSuccessful".equals(messageName); finished = (success && (finalURI != null)) || "PutFailed".equals(messageName) || messageName.endsWith("Error"); @@ -539,7 +437,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { project.setLastInsertionTime(System.currentTimeMillis()); project.onSuccessfulInsert(); } - fireProjectInsertFinished(success, cancelled ? new AbortedException() : (disconnected ? new IOException("Connection terminated") : null)); + projectInsertListeners.fireProjectInsertFinished(project, success, cancelled ? new AbortedException() : (disconnected ? new IOException("Connection terminated") : null)); } // @@ -554,7 +452,7 @@ public class ProjectInserter implements FileScannerListener, Runnable { if (!fileScanner.isError()) { new Thread(this).start(); } else { - fireProjectInsertFinished(false, null); + projectInsertListeners.fireProjectInsertFinished(project, false, null); } fileScanner.removeFileScannerListener(this); } diff --git a/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java b/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java index 11be944..24949a9 100644 --- a/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java +++ b/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java @@ -1,5 +1,5 @@ /* - * jSite - UpdateChecker.java - Copyright © 2008–2012 David Roden + * jSite - UpdateChecker.java - Copyright © 2008–2014 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 @@ -51,10 +51,10 @@ public class UpdateChecker implements Runnable { private static int counter = 0; /** The edition for the update check URL. */ - private static final int UPDATE_EDITION = 18; + private static final int UPDATE_EDITION = 7; /** The URL for update checks. */ - private static final String UPDATE_KEY = "USK@e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE"; + private static final String UPDATE_KEY = "USK@1waTsw46L9-JEQ8yX1khjkfHcn--g0MlMsTlYHax9zQ,oYyxr5jyFnaTsVGDQWk9e3ddOWGKnqEASxAk08MHT2Y,AQACAAE"; /** Object used for synchronization. */ private final Object syncObject = new Object(); diff --git a/src/main/java/de/todesbaum/jsite/application/UpdateListener.java b/src/main/java/de/todesbaum/jsite/application/UpdateListener.java index a37440c..68ca4da 100644 --- a/src/main/java/de/todesbaum/jsite/application/UpdateListener.java +++ b/src/main/java/de/todesbaum/jsite/application/UpdateListener.java @@ -1,5 +1,5 @@ /* - * jSite - UpdateListener.java - Copyright © 2008–2012 David Roden + * jSite - UpdateListener.java - Copyright © 2008–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java b/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java index ea5c6b3..cf5435c 100644 --- a/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java +++ b/src/main/java/de/todesbaum/jsite/application/WebOfTrustInterface.java @@ -1,5 +1,5 @@ /* - * jSite - WebOfTrustInterface.java - Copyright © 2012 David Roden + * jSite - WebOfTrustInterface.java - Copyright © 2012–2014 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 @@ -18,6 +18,8 @@ package de.todesbaum.jsite.application; +import static java.util.Collections.emptyList; + import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -38,7 +40,7 @@ import de.todesbaum.util.freenet.fcp2.wot.OwnIdentity; * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> */ -public class WebOfTrustInterface implements Runnable { +public class WebOfTrustInterface { /** The logger. */ private static final Logger logger = Logging.getLogger(WebOfTrustInterface.class); @@ -46,18 +48,9 @@ public class WebOfTrustInterface implements Runnable { /** Unique ID for the command identifier. */ private static final AtomicLong commandCounter = new AtomicLong(System.nanoTime()); - /** Object used for synchronization. */ - private final Object syncObject = new Object(); - /** The freenet interface. */ private final Freenet7Interface freenetInterface; - /** Whether the interface should stop. */ - private boolean shouldStop; - - /** The own identities. */ - private final List ownIdentities = new ArrayList(); - /** * Creates a new web of trust interface. * @@ -79,47 +72,72 @@ public class WebOfTrustInterface implements Runnable { * @return The list of own identities */ public List getOwnIdentities() { - synchronized (ownIdentities) { - return new ArrayList(ownIdentities); - } - } + try { + + /* connect. */ + Connection connection = freenetInterface.getConnection("jSite-WoT-Connector"); + logger.log(Level.INFO, String.format("Trying to connect to node at %s...", freenetInterface.getNode())); + if (!connection.connect()) { + logger.log(Level.WARNING, "Connection failed."); + return emptyList(); + } + Client client = new Client(connection); - // - // ACTIONS - // + /* send FCP command to WebOfTrust plugin. */ + sendFcpCommandToWotPlugin(client); - /** - * Starts the web of trust interface. - */ - public void start() { - Thread webOfTrustThread = new Thread(this, "WebOfTrust Interface"); - webOfTrustThread.start(); - } + /* read a message. */ + Message message = null; + while (!client.isDisconnected() && (message == null)) { + message = client.readMessage(1000); + } + if (message == null) { + return emptyList(); + } - /** - * Stops the web of trust interface - */ - public void stop() { - synchronized (syncObject) { - shouldStop = true; - syncObject.notifyAll(); + /* evaluate message. */ + List ownIdentities = parseOwnIdentitiesFromMessage(message); + + /* disconnect. */ + logger.log(Level.INFO, "Disconnecting from Node."); + connection.disconnect(); + return ownIdentities; + } catch (IOException ioe1) { + logger.log(Level.WARNING, String.format("Communication with node at %s failed.", freenetInterface.getNode()), ioe1); + return emptyList(); } } - // - // PRIVATE METHODS - // + private void sendFcpCommandToWotPlugin(Client client) throws IOException { + String messageIdentifier = "jSite-WoT-Command-" + commandCounter.getAndIncrement(); + FcpPluginMessage pluginMessage = new FcpPluginMessage(messageIdentifier); + pluginMessage.setPluginName("plugins.WebOfTrust.WebOfTrust"); + pluginMessage.setParameter("Message", "GetOwnIdentities"); + client.execute(pluginMessage); + } - /** - * Returns whether the web of trust interface should stop. - * - * @return {@code true} if the web of trust interface should stop, - * {@code false} otherwise - */ - private boolean shouldStop() { - synchronized (syncObject) { - return shouldStop; + private List parseOwnIdentitiesFromMessage(Message message) { + List ownIdentities = new ArrayList(); + if (message.getName().equals("FCPPluginReply")) { + logger.log(Level.FINE, "Got matching Reply from WebOfTrust."); + /* parse identities. */ + int identityCounter = -1; + while (message.get("Replies.Identity" + ++identityCounter) != null) { + String id = message.get("Replies.Identity" + identityCounter); + String nickname = message.get("Replies.Nickname" + identityCounter); + String requestUri = shortenUri(message.get("Replies.RequestURI" + identityCounter)); + String insertUri = shortenUri(message.get("Replies.InsertURI" + identityCounter)); + DefaultOwnIdentity ownIdentity = new DefaultOwnIdentity(id, nickname, requestUri, insertUri); + logger.log(Level.FINE, String.format("Parsed Own Identity %s.", ownIdentity)); + ownIdentities.add(ownIdentity); + } + logger.log(Level.INFO, String.format("Parsed %d Own Identities.", ownIdentities.size())); + } else if ("ProtocolError".equals(message.getName())) { + logger.log(Level.WARNING, "WebOfTrust Plugin not found!"); + } else if ("Error".equals(message.getName())) { + logger.log(Level.WARNING, "WebOfTrust Plugin returned an error!"); } + return ownIdentities; } /** @@ -141,96 +159,4 @@ public class WebOfTrustInterface implements Runnable { return shortenedUri; } - // - // RUNNABLE METHODS - // - - /** - * {@inheritDoc} - */ - @Override - public void run() { - boolean waitBeforeReconnect = false; - while (!shouldStop()) { - - /* wait a minute before reconnecting for another try. */ - if (waitBeforeReconnect) { - logger.log(Level.FINE, "Waiting 60 seconds before reconnecting."); - synchronized (syncObject) { - try { - syncObject.wait(60 * 1000); - } catch (InterruptedException ie1) { - /* ignore. */ - } - } - if (shouldStop()) { - continue; - } - } else { - waitBeforeReconnect = true; - } - - try { - - /* connect. */ - Connection connection = freenetInterface.getConnection("jSite-WoT-Connector"); - logger.log(Level.INFO, String.format("Trying to connect to node at %s...", freenetInterface.getNode())); - if (!connection.connect()) { - logger.log(Level.WARNING, "Connection failed."); - continue; - } - Client client = new Client(connection); - - /* send FCP command to WebOfTrust plugin. */ - String messageIdentifier = "jSite-WoT-Command-" + commandCounter.getAndIncrement(); - FcpPluginMessage pluginMessage = new FcpPluginMessage(messageIdentifier); - pluginMessage.setPluginName("plugins.WebOfTrust.WebOfTrust"); - pluginMessage.setParameter("Message", "GetOwnIdentities"); - client.execute(pluginMessage); - - /* read a message. */ - Message message = null; - while (!client.isDisconnected() && !shouldStop() && (message == null)) { - message = client.readMessage(1000); - } - if (message == null) { - continue; - } - - /* evaluate message. */ - if (message.getName().equals("FCPPluginReply")) { - logger.log(Level.FINE, "Got matching Reply from WebOfTrust."); - /* parse identities. */ - List ownIdentities = new ArrayList(); - int identityCounter = -1; - while (message.get("Replies.Identity" + ++identityCounter) != null) { - String id = message.get("Replies.Identity" + identityCounter); - String nickname = message.get("Replies.Nickname" + identityCounter); - String requestUri = shortenUri(message.get("Replies.RequestURI" + identityCounter)); - String insertUri = shortenUri(message.get("Replies.InsertURI" + identityCounter)); - DefaultOwnIdentity ownIdentity = new DefaultOwnIdentity(id, nickname, requestUri, insertUri); - logger.log(Level.FINE, String.format("Parsed Own Identity %s.", ownIdentity)); - ownIdentities.add(ownIdentity); - } - logger.log(Level.INFO, String.format("Parsed %d Own Identities.", ownIdentities.size())); - - synchronized (this.ownIdentities) { - this.ownIdentities.clear(); - this.ownIdentities.addAll(ownIdentities); - } - } else if ("ProtocolError".equals(message.getName())) { - logger.log(Level.WARNING, "WebOfTrust Plugin not found!"); - } - - /* disconnect. */ - logger.log(Level.INFO, "Disconnecting from Node."); - connection.disconnect(); - - } catch (IOException ioe1) { - logger.log(Level.WARNING, String.format("Communication with node at %s failed.", freenetInterface.getNode()), ioe1); - } - - } - } - } diff --git a/src/main/java/de/todesbaum/jsite/gui/FileScanner.java b/src/main/java/de/todesbaum/jsite/gui/FileScanner.java index d86a6ba..eef5158 100644 --- a/src/main/java/de/todesbaum/jsite/gui/FileScanner.java +++ b/src/main/java/de/todesbaum/jsite/gui/FileScanner.java @@ -1,5 +1,5 @@ /* - * jSite - FileScanner.java - Copyright © 2006–2012 David Roden + * jSite - FileScanner.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/FileScannerListener.java b/src/main/java/de/todesbaum/jsite/gui/FileScannerListener.java index 63e2c3d..d3d5145 100644 --- a/src/main/java/de/todesbaum/jsite/gui/FileScannerListener.java +++ b/src/main/java/de/todesbaum/jsite/gui/FileScannerListener.java @@ -1,5 +1,5 @@ /* - * jSite - FileScannerListener.java - Copyright © 2006–2012 David Roden + * jSite - FileScannerListener.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java b/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java index ae8cea4..6f2c38e 100644 --- a/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java +++ b/src/main/java/de/todesbaum/jsite/gui/KeyDialog.java @@ -1,5 +1,5 @@ /* - * jSite - KeyDialog.java - Copyright © 2010–2012 David Roden + * jSite - KeyDialog.java - Copyright © 2010–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/NodeManagerListener.java b/src/main/java/de/todesbaum/jsite/gui/NodeManagerListener.java index 760c967..4eaff14 100644 --- a/src/main/java/de/todesbaum/jsite/gui/NodeManagerListener.java +++ b/src/main/java/de/todesbaum/jsite/gui/NodeManagerListener.java @@ -1,5 +1,5 @@ /* - * jSite - NodeManagerListener.java - Copyright © 2006–2012 David Roden + * jSite - NodeManagerListener.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/NodeManagerPage.java b/src/main/java/de/todesbaum/jsite/gui/NodeManagerPage.java index 49c25bc..bbb32de 100644 --- a/src/main/java/de/todesbaum/jsite/gui/NodeManagerPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/NodeManagerPage.java @@ -1,5 +1,5 @@ /* - * jSite - NodeManagerPage.java - Copyright © 2006–2012 David Roden + * jSite - NodeManagerPage.java - Copyright © 2006–2014 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 @@ -198,7 +198,6 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene nodeList.setName("node-list"); nodeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); nodeList.addListSelectionListener(this); - nodeList.setPreferredSize(new Dimension(250, -1)); nodeNameTextField = new JTextField(""); nodeNameTextField.getDocument().putProperty("Name", "node-name"); @@ -237,7 +236,9 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene nodeInformationPanel.add(nodePortSpinner, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(6, 6, 0, 0), 0, 0)); setLayout(new BorderLayout(12, 12)); - add(new JScrollPane(nodeList), BorderLayout.LINE_START); + final JScrollPane nodeListScrollPane = new JScrollPane(nodeList); + nodeListScrollPane.setPreferredSize(new Dimension(250, -1)); + add(nodeListScrollPane, BorderLayout.LINE_START); add(centerPanel, BorderLayout.CENTER); I18nContainer.getInstance().registerRunnable(new Runnable() { @@ -347,6 +348,7 @@ public class NodeManagerPage extends TWizardPage implements ListSelectionListene private void addNode() { Node node = new Node("localhost", 9481, I18n.getMessage("jsite.node-manager.new-node")); nodeListModel.addElement(node); + nodeList.setSelectedIndex(nodeListModel.size() - 1); deleteNodeAction.setEnabled(nodeListModel.size() > 1); wizard.setNextEnabled(true); fireNodesUpdated(getNodes()); diff --git a/src/main/java/de/todesbaum/jsite/gui/PreferencesPage.java b/src/main/java/de/todesbaum/jsite/gui/PreferencesPage.java index 914e74b..7cbeec6 100644 --- a/src/main/java/de/todesbaum/jsite/gui/PreferencesPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/PreferencesPage.java @@ -1,5 +1,5 @@ /* - * jSite - PreferencesPage.java - Copyright © 2009–2012 David Roden + * jSite - PreferencesPage.java - Copyright © 2009–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectFilesPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectFilesPage.java index a9c4699..0e700c9 100644 --- a/src/main/java/de/todesbaum/jsite/gui/ProjectFilesPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/ProjectFilesPage.java @@ -1,5 +1,5 @@ /* - * jSite - ProjectFilesPage.java - Copyright © 2006–2012 David Roden + * jSite - ProjectFilesPage.java - Copyright © 2006–2014 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 @@ -628,9 +628,9 @@ public class ProjectFilesPage extends TWizardPage implements ActionListener, Lis fileOptionsInsertRedirectCheckBox.setSelected(fileOption.isInsertRedirect()); fileOptionsCustomKeyTextField.setEnabled(fileOption.isInsertRedirect()); fileOptionsCustomKeyTextField.setText(fileOption.getCustomKey()); - fileOptionsRenameCheckBox.setSelected(fileOption.hasChangedName()); - fileOptionsRenameTextField.setEnabled(fileOption.hasChangedName()); - fileOptionsRenameTextField.setText(fileOption.getChangedName()); + fileOptionsRenameCheckBox.setSelected(fileOption.getChangedName().isPresent()); + fileOptionsRenameTextField.setEnabled(fileOption.getChangedName().isPresent()); + fileOptionsRenameTextField.setText(fileOption.getChangedName().or("")); fileOptionsMIMETypeComboBox.getModel().setSelectedItem(fileOption.getMimeType()); } else { defaultFileCheckBox.setSelected(false); diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectInsertPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectInsertPage.java index b73a49a..f68144d 100644 --- a/src/main/java/de/todesbaum/jsite/gui/ProjectInsertPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/ProjectInsertPage.java @@ -1,5 +1,5 @@ /* - * jSite - ProjectInsertPage.java - Copyright © 2006–2012 David Roden + * jSite - ProjectInsertPage.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java index ceee143..1da83d2 100644 --- a/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java +++ b/src/main/java/de/todesbaum/jsite/gui/ProjectPage.java @@ -1,5 +1,5 @@ /* - * jSite - ProjectPage.java - Copyright © 2006–2012 David Roden + * jSite - ProjectPage.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/i18n/I18n.java b/src/main/java/de/todesbaum/jsite/i18n/I18n.java index 4c1cceb..e2e3b3e 100644 --- a/src/main/java/de/todesbaum/jsite/i18n/I18n.java +++ b/src/main/java/de/todesbaum/jsite/i18n/I18n.java @@ -1,5 +1,5 @@ /* - * jSite - I18n.java - Copyright © 2006–2012 David Roden + * jSite - I18n.java - Copyright © 2006–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/i18n/I18nContainer.java b/src/main/java/de/todesbaum/jsite/i18n/I18nContainer.java index 9683dd3..2c2ee10 100644 --- a/src/main/java/de/todesbaum/jsite/i18n/I18nContainer.java +++ b/src/main/java/de/todesbaum/jsite/i18n/I18nContainer.java @@ -1,5 +1,5 @@ /* - * jSite - I18nContainer.java - Copyright © 2007–2012 David Roden + * jSite - I18nContainer.java - Copyright © 2007–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/main/CLI.java b/src/main/java/de/todesbaum/jsite/main/CLI.java index 9f0b2db..3280551 100644 --- a/src/main/java/de/todesbaum/jsite/main/CLI.java +++ b/src/main/java/de/todesbaum/jsite/main/CLI.java @@ -1,5 +1,5 @@ /* - * jSite - CLI.java - Copyright © 2006–2012 David Roden + * jSite - CLI.java - Copyright © 2006–2014 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 @@ -104,6 +104,7 @@ public class CLI implements InsertListener { freenetInterface.setNode(node); projectInserter.setFreenetInterface(freenetInterface); + projectInserter.setPriority(configuration.getPriority()); Project currentProject = null; for (String argument : args) { diff --git a/src/main/java/de/todesbaum/jsite/main/Configuration.java b/src/main/java/de/todesbaum/jsite/main/Configuration.java index 4b49577..2a27e89 100644 --- a/src/main/java/de/todesbaum/jsite/main/Configuration.java +++ b/src/main/java/de/todesbaum/jsite/main/Configuration.java @@ -1,5 +1,5 @@ /* - * jSite - Configuration.java - Copyright © 2006–2012 David Roden + * jSite - Configuration.java - Copyright © 2006–2014 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 @@ -430,7 +430,7 @@ public class Configuration { fileOptionNode.append("insert", String.valueOf(fileOption.isInsert())); fileOptionNode.append("insert-redirect", String.valueOf(fileOption.isInsertRedirect())); fileOptionNode.append("custom-key", fileOption.getCustomKey()); - fileOptionNode.append("changed-name", fileOption.getChangedName()); + fileOptionNode.append("changed-name", fileOption.getChangedName().orNull()); fileOptionNode.append("mime-type", fileOption.getMimeType()); } } diff --git a/src/main/java/de/todesbaum/jsite/main/ConfigurationLocator.java b/src/main/java/de/todesbaum/jsite/main/ConfigurationLocator.java index 967f936..7d0a83b 100644 --- a/src/main/java/de/todesbaum/jsite/main/ConfigurationLocator.java +++ b/src/main/java/de/todesbaum/jsite/main/ConfigurationLocator.java @@ -1,5 +1,5 @@ /* - * jSite - ConfigurationLocator.java - Copyright © 2011–2012 David Roden + * jSite - ConfigurationLocator.java - Copyright © 2011–2014 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 diff --git a/src/main/java/de/todesbaum/jsite/main/Main.java b/src/main/java/de/todesbaum/jsite/main/Main.java index 8a4f905..59a3116 100644 --- a/src/main/java/de/todesbaum/jsite/main/Main.java +++ b/src/main/java/de/todesbaum/jsite/main/Main.java @@ -1,5 +1,5 @@ /* - * jSite - Main.java - Copyright © 2006–2012 David Roden + * jSite - Main.java - Copyright © 2006–2014 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 @@ -80,7 +80,7 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen private static final Logger logger = Logger.getLogger(Main.class.getName()); /** The version. */ - private static final Version VERSION = new Version(0, 11, 1); + private static final Version VERSION = new Version(0, 12); /** The configuration. */ private Configuration configuration; @@ -122,7 +122,13 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen } /** The supported locales. */ - private static final Locale[] SUPPORTED_LOCALES = new Locale[] { Locale.ENGLISH, Locale.GERMAN, Locale.FRENCH, new Locale("pl") }; + private static final Locale[] SUPPORTED_LOCALES = new Locale[] { + Locale.ENGLISH, + Locale.GERMAN, + Locale.FRENCH, + new Locale("pl"), + new Locale("fi") + }; /** The actions that switch the language. */ private Map languageActions = new HashMap(); @@ -195,7 +201,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen updateChecker.start(); webOfTrustInterface = new WebOfTrustInterface(freenetInterface); - webOfTrustInterface.start(); initPages(); showPage(PageType.PAGE_PROJECTS); @@ -506,7 +511,6 @@ public class Main implements ActionListener, ListSelectionListener, WizardListen */ private void quit() { updateChecker.stop(); - webOfTrustInterface.stop(); System.exit(0); } diff --git a/src/main/java/de/todesbaum/jsite/main/Version.java b/src/main/java/de/todesbaum/jsite/main/Version.java index 373703c..10178c8 100644 --- a/src/main/java/de/todesbaum/jsite/main/Version.java +++ b/src/main/java/de/todesbaum/jsite/main/Version.java @@ -1,5 +1,5 @@ /* - * jSite - Version.java - Copyright © 2006–2012 David Roden + * jSite - Version.java - Copyright © 2006–2014 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 diff --git a/src/main/resources/de/todesbaum/jsite/i18n/jSite.properties b/src/main/resources/de/todesbaum/jsite/i18n/jSite.properties index 19ea78d..0257591 100644 --- a/src/main/resources/de/todesbaum/jsite/i18n/jSite.properties +++ b/src/main/resources/de/todesbaum/jsite/i18n/jSite.properties @@ -1,5 +1,5 @@ # -# jSite - jSite.properties - Copyright © 2006–2012 David Roden +# jSite - jSite.properties - Copyright © 2006–2014 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 @@ -45,6 +45,7 @@ jsite.menu.language.de=Deutsch jsite.menu.language.fr=Fran\u00e7ais jsite.menu.language.it=Italiano jsite.menu.language.pl=Polski +jsite.menu.language.fi=Suomi jsite.menu.nodes=Nodes jsite.menu.nodes.manage-nodes=Manage nodes jsite.menu.options=Options diff --git a/src/main/resources/de/todesbaum/jsite/i18n/jSite_de.properties b/src/main/resources/de/todesbaum/jsite/i18n/jSite_de.properties index 7f82138..eb67bcb 100644 --- a/src/main/resources/de/todesbaum/jsite/i18n/jSite_de.properties +++ b/src/main/resources/de/todesbaum/jsite/i18n/jSite_de.properties @@ -1,5 +1,5 @@ # -# jSite - jSite_de.properties - Copyright © 2006–2012 David Roden +# jSite - jSite_de.properties - Copyright © 2006–2014 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 @@ -45,6 +45,7 @@ jsite.menu.language.de=Deutsch jsite.menu.language.fr=Fran\u00e7ais jsite.menu.language.it=Italiano jsite.menu.language.pl=Polski +jsite.menu.language.fi=Suomi jsite.menu.nodes=Nodes jsite.menu.nodes.manage-nodes=Nodes verwalten jsite.menu.options=Optionen diff --git a/src/main/resources/de/todesbaum/jsite/i18n/jSite_fi.properties b/src/main/resources/de/todesbaum/jsite/i18n/jSite_fi.properties new file mode 100644 index 0000000..394c1b2 --- /dev/null +++ b/src/main/resources/de/todesbaum/jsite/i18n/jSite_fi.properties @@ -0,0 +1,207 @@ +# +# jSite - jSite_fi.properties - Copyright © 2006–2014 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. +# + +# Finnish language file by Samuel_Mehmke + +# Attention, translators! Most of the strings here are used directly. +# However, some of them are parsed by MessageFormat +# (http://java.sun.com/j2se/1.5.0/docs/api/java/text/MessageFormat.html) +# and thus have to adhere to some rules (check the URL above). This is the +# case when a line contains placeholders like {0} or {0,number}! In these +# lines single quotes (ASCII 39) needs to be escaped by entering them twice, +# otherwise the placeholder will not be replaced! + +jsite.general.ok=OK +jsite.general.cancel=Peruuta + +jsite.wizard.previous=Edellinen +jsite.wizard.next=Seuraava +jsite.wizard.quit=Lopeta + +jsite.quit.question=Haluatko todella lopettaa +jsite.quit.question.title=Lopeta todella? +jsite.quit.overwrite-configuration=Ylikirjoita asetukset?

Asetustiedosto on jo olemassa:
{0}

Kirjoitetaanko sen yli? +jsite.quit.overwrite-configuration.title=Ylikirjoita asetukset? +jsite.quit.config-not-saved=Asetuksia ei tallennettu

Asetuksia ei voitu tallentaa.
Haluatko lopettaa kuitenkin? + +jsite.menu.languages=Kielet +jsite.menu.language.en=English +jsite.menu.language.de=Deutsch +jsite.menu.language.fr=Fran\u00e7ais +jsite.menu.language.it=Italiano +jsite.menu.language.pl=Polski +jsite.menu.language.fi=Suomi +jsite.menu.nodes=Solmut +jsite.menu.nodes.manage-nodes=Hallitse solmuja +jsite.menu.options=Asetukset +jsite.menu.options.preferences=Asetukset +jsite.menu.help=Ohje +jsite.menu.help.check-for-updates=Tarkista Päivitykset +jsite.menu.help.about=Tietoja + +jsite.about.message=jSite {0}

Tekij\u00e4noikeus \u00a9 2006\u20132012 David Roden
Julkaistu lisenssill\u00e4 GNU General Public License + +jsite.node-manager.heading=Solmumanageri +jsite.node-manager.description=Hallitse solmujasi t\u00e4\u00e4ll\u00e4. +jsite.node-manager.node-information=Solmun tiedot +jsite.node-manager.add-node=Lis\u00e4\u00e4 Solmu +jsite.node-manager.new-node=Uusi Solmu +jsite.node-manager.delete-node=Poista Solmu +jsite.node-manager.delete-node.warning=Vahvista solmun poistaminen

Poistetaanko solmu todella? +jsite.node-manager.name=Nimi +jsite.node-manager.hostname=Is\u00e4nt\u00e4nimi +jsite.node-manager.port=Portti + +jsite.preferences.heading=Asetukset +jsite.preferences.description=K\u00e4yt\u00e4 t\u00e4t\u00e4 sivua hallitaksesi globaaleja asetuksia. +jsite.preferences.temp-directory=Hakemisto v\u00e4liaikaisille tiedostoille +jsite.preferences.temp-directory.default=Oletus (j\u00e4rjestelm\u00e4n valitsema) +jsite.preferences.temp-directory.custom=Mukautettu +jsite.preferences.temp-directory.choose=Valitse +jsite.preferences.temp-directory.choose.approve=Valitse +jsite.preferences.config-directory=Asetustiedoston sijainti +jsite.preferences.config-directory.jar=JAR-tiedoston vieress\u00e4 +jsite.preferences.config-directory.home=Kotihakemisto +jsite.preferences.config-directory.custom=Mukautettu +jsite.preferences.insert-options=Latausasetukset +jsite.preferences.insert-options.use-early-encode=Luo lopullinen URI aikaisin +jsite.preferences.insert-options.priority=Prioriteetti +jsite.preferences.insert-options.manifest-putter=Manifestin Asettaja + +jsite.insert.heading=Projektin lataaminen +jsite.insert.description=Ole hyv\u00e4 ja odota kun projektia ladataan. +jsite.insert.project-information=Projektin tiedot +jsite.insert.request-uri=Freesite +jsite.insert.start-time=Aloitusaika +jsite.insert.starting=Aloitetaan +jsite.insert.done=Valmis. +jsite.insert.done.title=Lataus valmis +jsite.insert.insert-aborted=Lataus keskeytettiin. +jsite.insert.insert-aborted.title=Lataus Keskeytetty +jsite.insert.progress=Edistys +jsite.insert.k-per-s=KB/s +jsite.insert.insert-failed=Lataus ep\u00e4onnistui

Projektin lataus ep\u00e4onnistui
joitain tiedostoja ei voitu ladata. +jsite.insert.insert-failed-with-cause=Lataus ep\u00e4onnistui

Projektin lataus ep\u00e4onnistui.
Joitain tiedostoja ei voitu ladata.
Seuraava virhe tapahtui:

{0} +jsite.insert.insert-failed.title=Lataus ep\u00e4onnistui +jsite.insert.inserted=Projekti ladattu

Projektisi ladattiin onnistuneesti. +jsite.insert.okay-copy-uri=Kopioi URI leikep\u00f6yd\u00e4lle +jsite.insert.reinserted-edition=Editio ladattu uudelleen

Editio, jota olet juuri lataamassa,
on jo ladattu aikaisemmin. +jsite.insert.reinserted-edition.title=Editio Ladattu Uudelleen + +jsite.file-scanner.can-not-read-directory=Ei voitu lukea hakemistoa + +jsite.project.heading=Valitse Projekti +jsite.project.description=Valitse projekti alla olevasta listasta, tai luo uusi projekti. +jsite.project.action.browse=Selaa +jsite.project.action.browse.choose=Valitse +jsite.project.action.browse.tooltip=Selaa hakemisto +jsite.project.action.add-project=Lis\u00e4\u00e4 projekti +jsite.project.action.add-project.tooltip=Lis\u00e4\u00e4 uusi projekti +jsite.project.new-project.name=Uusi Projekti +jsite.project.action.delete-project=Poista projekti +jsite.project.action.delete-project.tooltip=Poista projekti +jsite.project.action.delete-project.confirm=Vahvista poistaminen

Projekti \u201e{0}\u201c poistetaan!
Haluatko jatkaa? +jsite.project.action.clone-project=Kloonaa projekti +jsite.project.action.clone-project.copy=Kopio {0} +jsite.project.action.clone-project.tooltip=Kloonaa valittu projekti +jsite.project.action.copy-uri=Kopioi URI Leikep\u00f6yd\u00e4lle +jsite.project.action.copy-uri.tooltip=Kopioi projektin URI leikep\u00f6yd\u00e4lle +jsite.project.action.manage-keys=Hallitse Avaimia +jsite.project.action.manage-keys.tooltip=Hallitse t\u00e4m\u00e4n projektin avaimia +jsite.project.action.reset-edition=Alusta Editio +jsite.project.action.reset-edition.tooltip=Alustaa projektin editio-numeron +jsite.project.project.information=Projektin tiedot +jsite.project.project.name=Nimi +jsite.project.project.description=Kuvaus +jsite.project.project.local-path=Paikallinen polku +jsite.project.project.address=Osoite +jsite.project.project.path=Polku +jsite.project.project.edition=Editio +jsite.project.project.uri=URI +jsite.project.keygen.io-error=Solmuun ei saatu yhteytt\u00e4

Kommunikointi Freenet solmusi kanssa ep\u00e4onnistui
seuraavan viestin kanssa:

{0}

Ole hyv\u00e4 ja varmista, ett\u00e4 olet asettannut
oikean is\u00e4nt\u00e4nimen ja portin numeron
”Solmun Hallinta” sivulla. +jsite.project.warning.generate-new-key=Luo uusi avain?

Jos luot uuden avaimen, sivustosi julkaistaan
kyseisell\u00e4 avaimella. Muiden k\u00e4ytt\u00e4jien
luottamus vanhaan avaimeen menetet\u00e4\u00e4n!
Editio my\u00f6s alustetaan. +jsite.project.warning.reset-edition=Alusta editio?

Edition alustaminen voi johtaa latausvirheisiin
ja sekaannukseen, ellet ole muuttannut
projektin polkua tai avainta! +jsite.project.warning.use-clipboard-now=URI kopioitu

Huomaa, ett\u00e4 jSite:n lopettaminen voi aiheuttaa
leikep\u00f6yd\u00e4n tyhjenemisen
K\u00e4yt\u00e4 URI:a v\u00e4litt\u00f6m\u00e4sti toisessa ikkunassa! + +jsite.project-files.heading=Projektin Tiedostot +jsite.project-files.description=T\u00e4ll\u00e4 sivulla voit asettaa parametrej\u00e4 projektin tiedostoille, kuten
ulkoisesti luodut avaimet tai MIME-tyypit, jos automaattinen tunnistus ep\u00e4onnistui. +jsite.project-files.action.rescan=Skannaa uudelleen +jsite.project-files.action.rescan.tooltip=Skannaa projektin hakemisto uusien tiedostojen varalta +jsite.project-files.always-force-insert=Pakota aina lataaminen +jsite.project-files.always-force-insert.tooltip=Ladataanko kaikki projektin tiedostot, vaikka ne eiv\u00e4t olisi muuttuneet +jsite.project-files.ignore-hidden-files=Ohita piilotetut tiedostot +jsite.project-files.ignore-hidden-files.tooltip=Piilotettuja tiedostoja ei ladata +jsite.project-files.file-options=Tiedostoasetukset +jsite.project-files.default=Oletustiedosto +jsite.project-files.default.tooltip=Aseta t\u00e4m\u00e4 tiedosto projektin indeksiksi +jsite.project-files.insert=Lataa +jsite.project-files.insert.tooltip=Poista valinta, jos et halua ladata t\u00e4t\u00e4 tiedostoa +jsite.project-files.force-insert=Pakota lataaminen +jsite.project-files.force-insert.tooltip=Lataa tiedosto vaikka se ei olisi muuttunut +jsite.project-files.insert-redirect=Uudelleenohjaa +jsite.project-files.insert-redirect.tooltip=Haluatko asettaa uudelleenohjauksen t\u00e4lle tiedostolle +jsite.project-files.custom-key=Mukautettu avain +jsite.project-files.custom-key.tooltip=Ulkoisesti luotu avain t\u00e4lle tiedostolle +jsite.project-files.rename=Nime\u00e4 uudelleen +jsite.project-files.rename.tooltip=Nime\u00e4 tiedosto uudelleen ladatulla sivustolla +jsite.project-files.mime-type=MIME-Tyyppi +jsite.project-files.mime-type.tooltip=Valitse oikea MIME-tyyppi t\u00e4ss\u00e4, jos automaattinen tunnistus ep\u00e4onnistui +jsite.project-files.container=S\u00e4ili\u00f6 +jsite.project-files.container.tooltip=Valitse s\u00e4ili\u00f6 t\u00e4lle tiedostolle +jsite.project-files.scan-error=Virhe tiedostoja skannatessa

Joko projektin hakemistoa ei ole olemassa,
tai jotkin tiedostot/hakemistot eiv\u00e4t ole k\u00e4ytett\u00e4viss\u00e4!
Ole hyv\u00e4 ja mene takaisin ja valitse oikea hakemisto! +jsite.project-files.insert-now=Lataa nyt +jsite.project-files.invalid-default-file=Vain hakemiston juuressa oleva tiedosto voidaan valita oletustiedostoksi. +jsite.project-files.scanning=Skannataan + +jsite.update-checker.found-version.title=Uusi versio l\u00f6ytyi +jsite.update-checker.found-version.message=Uusi versio l\u00f6ytyi.

Versio {0} (julkaistu {1,date}) +jsite.update-checker.latest-version.title=Tarkista p\u00e4ivitykset +jsite.update-checker.latest-version.newer.message=K\u00e4yt\u00e4t versiota {0}, mutta uudempi
versio ({1}) l\u00f6ytyi! +jsite.update-checker.latest-version.older.message=K\u00e4yt\u00e4t versiota {0}, mutta uusin
versio on {1}. +jsite.update-checker.latest-version.okay.message=K\u00e4yt\u00e4t versiota {0},
joka on uusin versio. + +jsite.key-dialog.title=Hallitse Projektin Avaimia +jsite.key-dialog.button.ok.tooltip=Hyv\u00e4ksy muutokset +jsite.key-dialog.button.cancel.tooltip=Hylk\u00e4\u00e4 muutokset +jsite.key-dialog.button.copy-from-project=Kopioi Projektista +jsite.key-dialog.button.copy-from-project.tooltip=Kopioi avaimet valitusta projektista +jsite.key-dialog.button.copy-from-identity=Kopioi Identiteetilt\u00e4 +jsite.key-dialog.button.copy-from-identity.tooltip=Kopioi avaimet valitulta identiteetilt\u00e4 +jsite.key-dialog.button.generate=Luo avaimet uudelleen +jsite.key-dialog.button.generate.tooltip=Luo uusi avainpari +jsite.key-dialog.label.keys=Avaimet +jsite.key-dialog.label.private-key=Yksityinen Avain +jsite.key-dialog.label.public-key=Julkinen Avain +jsite.key-dialog.label.copy-keys=Kopioi Avaimet +jsite.key-dialog.label.project=Projekti +jsite.key-dialog.label.identity=Identiteetti +jsite.key-dialog.label.actions=Toiminnot + +jsite.warning.empty-index=Ei oletustiedostoa

Et ole m\u00e4\u00e4ritellyt oletustiedostoa t\u00e4lle projektille.
Vaikka onkin mahdollista ladata projekti ilman oletustiedostoa,
sinun tulisi m\u00e4\u00e4ritell\u00e4 se selaamisen helpottamiseksi. +jsite.warning.index-not-html=Oletustiedosto ei ole HTML:\u00e4\u00e4

Oletustiedostosi MIME-tyyppi ei ole ”text/html”!
Sivuston katsominen selaimella voi tuottaa
odottamattomie tuloksia. +jsite.warning.site-larger-than-2-mib=Sivustosi on yli 2 MiB!

Sivustosi sis\u00e4lt\u00e4\u00e4 enemm\u00e4n kuin 2 megatavua.
Johtuen bugeista Freenetiss\u00e4, se ei luultavasti lataudu kunnolla.
Yrit\u00e4 pienent\u00e4\u00e4 sivuston kokoa, tai jatka omalla vastuullasi. + +jsite.error.no-node-selected=Solmua ei ole valittu

Ole hyv\u00e4 ja valitse solmu valikosta! +jsite.error.no-node-running=Solmu ei ole k\u00e4ynniss\u00e4

Et voi ladata projektia jos solmusi ei ole k\u00e4ynniss\u00e4.
Ole hyv\u00e4 ja k\u00e4ynnist\u00e4 solmusi ja yrit\u00e4
sitten uudestaan. +jsite.error.no-local-path=Ei paikallista polkua

Et m\u00e4\u00e4ritellyt paikallista polkua ladattaville tiedostoille.
Et voi jatkaa ilman polkua. +jsite.error.no-path=Ei Freesite-polkua

Et m\u00e4\u00e4ritellyt freesite-polkua.
Et voi jatkaa ilman freesite-polkua. +jsite.error.index-missing=Oletustiedostosi puuttuu

Oletustiedosto on m\u00e4\u00e4ritelty aikaisemmin,
mutta sit\u00e4 ei en\u00e4\u00e4 ole olemassa!
Ole hyv\u00e4 ja valitse uusi oletustiedosto. +jsite.error.index-not-inserted=Oletustiedostoa ei ladattu

Valitsit, ett\u00e4 oletustiedostoa ei ladata!
Sinun täytyy joko ladata se tai valita toinen oletustiedosto. +jsite.error.no-custom-key=Ei mukautettua avainta tiedostolle

P\u00e4\u00e4tit olla lataamatta {0},
mutta et antanut avainta uudelleenohjaukseen! +jsite.error.no-files-to-insert=Ei tiedostoja ladattavaksi

Et valinnut yht\u00e4\u00e4n tiedostoa ladattavaksi. Valitse
ainakin yksi tiedosto ladattavaksi! +jsite.error.duplicate-file=Duplikaattitiedosto

Tiedosto {0} on ladattu kahdesti!
Tarkista tiedostojesi nimet ja uudelleenohjaukset! diff --git a/src/main/resources/de/todesbaum/jsite/i18n/jSite_fr.properties b/src/main/resources/de/todesbaum/jsite/i18n/jSite_fr.properties index 39beff1..eda11c6 100644 --- a/src/main/resources/de/todesbaum/jsite/i18n/jSite_fr.properties +++ b/src/main/resources/de/todesbaum/jsite/i18n/jSite_fr.properties @@ -1,5 +1,5 @@ # -# jSite - jSite_fr.properties - Copyright © 2006–2012 David Roden +# jSite - jSite_fr.properties - Copyright © 2006–2014 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 @@ -45,6 +45,7 @@ jsite.menu.language.de=Deutsch jsite.menu.language.fr=Fran\u00e7ais jsite.menu.language.it=Italiano jsite.menu.language.pl=Polski +jsite.menu.language.fi=Suomi jsite.menu.nodes=Noeud jsite.menu.nodes.manage-nodes=G\u00e9rer les noeuds jsite.menu.options=Options @@ -204,4 +205,4 @@ jsite.error.index-not-inserted=Fichier par d\u00e9faut non ins\u00e9r\u jsite.error.no-custom-key=Pas de clef existante sp\u00e9cifi\u00e9e pour ce fichier

Vous avez sp\u00e9cifier de ne pas ins\u00e9rer {0}
mais n'avez pas sp\u00e9cifier de clef ou rediriger! jsite.error.no-files-to-insert=Aucun fichier \u00e0 ins\u00e9rer

Vous n'avez s\u00e9lectionn\u00e9 aucun fichier pour l'insertion !
Veuillez s\u00e9lectionner au moins un fichier \u00e0 ins\u00e9rer. jsite.error.duplicate-file=Fichier dupliqu\u00e9

Le fichier {0} est ins\u00e9r\u00e9 deux fois !
Veuillez v\u00e9rifier les noms de fichier et les redirections. -# to update: 144, 145, 180-183, 189-192, 196 \ No newline at end of file +# to update: 145, 146, 181-184, 190-193, 197 diff --git a/src/main/resources/de/todesbaum/jsite/i18n/jSite_pl.properties b/src/main/resources/de/todesbaum/jsite/i18n/jSite_pl.properties index 454510b..4bb32b7 100644 --- a/src/main/resources/de/todesbaum/jsite/i18n/jSite_pl.properties +++ b/src/main/resources/de/todesbaum/jsite/i18n/jSite_pl.properties @@ -1,5 +1,5 @@ # -# jSite - jSite_pl.properties - Copyright © 2006–2012 David Roden +# jSite - jSite_pl.properties - Copyright © 2006–2014 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 @@ -45,6 +45,7 @@ jsite.menu.language.de=Deutsch jsite.menu.language.fr=Fran\u00e7ais jsite.menu.language.it=Italiano jsite.menu.language.pl=Polski +jsite.menu.language.fi=Suomi jsite.menu.nodes=W\u0119z\u0142y jsite.menu.nodes.manage-nodes=Zarz\u0105dzaj w\u0119z\u0142ami jsite.menu.options=Opcje diff --git a/src/main/resources/flag-fi.png b/src/main/resources/flag-fi.png new file mode 100644 index 0000000..b3518c1 Binary files /dev/null and b/src/main/resources/flag-fi.png differ