X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FProject.java;h=bf891b16bf8b3bac077fdcb19c5df76d2d0f8360;hb=86c3491e023e510be02b3dd91df7c040cf110d30;hp=3768d062699225e5095549182e16e283e62b12ef;hpb=06b7eb1d2c0499330f495125708ea20d17ca788f;p=jSite.git diff --git a/src/de/todesbaum/jsite/application/Project.java b/src/de/todesbaum/jsite/application/Project.java index 3768d06..bf891b1 100644 --- a/src/de/todesbaum/jsite/application/Project.java +++ b/src/de/todesbaum/jsite/application/Project.java @@ -1,6 +1,5 @@ /* - * jSite - a tool for uploading websites into Freenet Copyright (C) 2006 David - * Roden + * jSite - Project.java - Copyright © 2006–2011 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 @@ -60,6 +59,9 @@ public class Project implements Comparable { /** The edition to insert to. */ protected int edition; + /** Whether to ignore hidden directory. */ + private boolean ignoreHiddenFiles; + /** Options for files. */ protected Map fileOptions = new HashMap(); @@ -86,6 +88,7 @@ public class Project implements Comparable { localPath = project.localPath; indexFile = project.indexFile; lastInsertionTime = project.lastInsertionTime; + ignoreHiddenFiles = project.ignoreHiddenFiles; fileOptions = new HashMap(project.fileOptions); } @@ -248,6 +251,27 @@ public class Project implements Comparable { } /** + * Returns whether hidden files are ignored, i.e. not inserted. + * + * @return {@code true} if hidden files are not inserted, {@code false} + * otherwise + */ + public boolean isIgnoreHiddenFiles() { + return ignoreHiddenFiles; + } + + /** + * Sets whether hidden files are ignored, i.e. not inserted. + * + * @param ignoreHiddenFiles + * {@code true} if hidden files are not inserted, {@code false} + * otherwise + */ + public void setIgnoreHiddenFiles(boolean ignoreHiddenFiles) { + this.ignoreHiddenFiles = ignoreHiddenFiles; + } + + /** * {@inheritDoc} *

* This method returns the name of the project. @@ -395,4 +419,20 @@ public class Project implements Comparable { return "USK@" + requestURI + "/" + path + "/" + (edition + offset) + "/"; } + /** + * Performs some post-processing on the project after it was inserted + * successfully. At the moment it copies the current hashes of all file + * options to the last insert hashes, updating the hashes for the next + * insert. + */ + public void onSuccessfulInsert() { + for (FileOption fileOption : fileOptions.values()) { + if ((fileOption.getCurrentHash() != null) && (fileOption.getCurrentHash().length() > 0) && !fileOption.getCurrentHash().equals(fileOption.getLastInsertHash())) { + fileOption.setLastInsertEdition(edition); + fileOption.setLastInsertHash(fileOption.getCurrentHash()); + } + fileOption.setForceInsert(false); + } + } + }