/*
- * jSite - a tool for uploading websites into Freenet Copyright (C) 2006 David
- * Roden
+ * jSite - Project.java - Copyright © 2006–2012 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
/** The edition to insert to. */
protected int edition;
+ /** Whether to ignore hidden directory. */
+ private boolean ignoreHiddenFiles;
+
/** Options for files. */
protected Map<String, FileOption> fileOptions = new HashMap<String, FileOption>();
localPath = project.localPath;
indexFile = project.indexFile;
lastInsertionTime = project.lastInsertionTime;
+ ignoreHiddenFiles = project.ignoreHiddenFiles;
fileOptions = new HashMap<String, FileOption>(project.fileOptions);
}
}
/**
+ * 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}
* <p>
* This method returns the name of the project.
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);
+ }
+ }
+
}