From 8eb306139956fa840a8422d3ad679dfa033ebe99 Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed> Date: Wed, 29 Mar 2017 08:58:13 +0000 Subject: [PATCH] FileRef nach lib verschoben --- /dev/null | 206 --------------------------------------------------- src/java/de/uhilger/filecms/web/UploadServlet.java | 2 src/java/de/uhilger/filecms/api/FileMgr.java | 2 src/java/de/uhilger/filecms/api/Api.java | 2 4 files changed, 3 insertions(+), 209 deletions(-) diff --git a/src/java/de/uhilger/filecms/api/Api.java b/src/java/de/uhilger/filecms/api/Api.java index 7a07223..bd52f22 100644 --- a/src/java/de/uhilger/filecms/api/Api.java +++ b/src/java/de/uhilger/filecms/api/Api.java @@ -20,8 +20,8 @@ package de.uhilger.filecms.api; -import de.uhilger.filecms.data.FileRef; import de.uhilger.wbx.api.ApiBase; +import de.uhilger.wbx.data.FileRef; import java.io.File; import java.util.logging.Logger; diff --git a/src/java/de/uhilger/filecms/api/FileMgr.java b/src/java/de/uhilger/filecms/api/FileMgr.java index 5937daa..3836e69 100644 --- a/src/java/de/uhilger/filecms/api/FileMgr.java +++ b/src/java/de/uhilger/filecms/api/FileMgr.java @@ -18,8 +18,8 @@ package de.uhilger.filecms.api; -import de.uhilger.filecms.data.FileRef; import de.uhilger.wbx.Bild; +import de.uhilger.wbx.data.FileRef; import java.awt.Container; import java.awt.Image; import java.awt.MediaTracker; diff --git a/src/java/de/uhilger/filecms/data/FileRef.java b/src/java/de/uhilger/filecms/data/FileRef.java deleted file mode 100644 index 735d014..0000000 --- a/src/java/de/uhilger/filecms/data/FileRef.java +++ /dev/null @@ -1,206 +0,0 @@ -/* - Dateiverwaltung - File management in your browser - Copyright (C) 2017 Ulrich Hilger, http://uhilger.de - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero 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 Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -package de.uhilger.filecms.data; - -import java.io.Serializable; - -/** - * A reference to a file consisting of the file's absolute path and additional - * information about whether or not the referenced file is a directory, is hidden, etc. - * Note that FileRef only references a file, the file itself and its contents are not - * modelled by this class. - * - * @author Ulrich Hilger, http://uhilger.de - * @author Bereitgestellt unter den Bedingungen der - * <a href="http://www.gnu.org/licenses/agpl-3.0" target="_blank">GNU Affero - * General Public License</a> - * - * @version 2, 12.01.2008 - */ -public class FileRef implements Serializable { - - public static final long serialVersionUID = 42L; - private String absolutePath; - private Boolean isDirectory; - private Boolean isHidden; - private Long lastModified; - private Long length; - private String mimetype; - - /** - * create a new instance of <code>FileRef</code>. Note that the created FileRef is - * only a reference to a file, the file itself will not be created. - * - * @param absolutePath the absolute path that denotes this instance of <code>FileRef</code> - * @param isDirectory whether or not this file is a directory - * @param isHidden whether or not this file is a hidden file - * @param lastModified the date/time this file was last modified measured in milliseconds - * since the epoch (00:00:00 GMT, January 1, 1970) - * @param length the length of this file in bytes - */ - public FileRef(String absolutePath, boolean isDirectory, boolean isHidden, - long lastModified, long length) - { - super(); - this.absolutePath = absolutePath; - this.isDirectory = isDirectory; - this.isHidden = isHidden; - this.lastModified = lastModified; - this.length = length; - } - - /** - * Create a new instance of class <code>FileRef</code> with a given absolute path. - * Other characteristics of the file are created with default settings - * (i.e. not a directory, not hidden, unknown modification date - * and length). Note that the created FileRef is only a reference to a file, the file - * itself will not be created. - * - * @param absolutePath the absolute path that denotes this instance - * of <code>FileRef</code> - */ - public FileRef(String absolutePath) { - this(absolutePath, false, false, 0, 0); - } - - /** - * Create a new instance of class <code>FileRef</code> with a given absolute path - * and an indicator whether or not the new FileRef denotes a directory. - * Other characteristics of the file are created with default settings - * (i.e. not hidden, unknown modification date and length). Note that the created - * FileRef is only a reference to a file, the file itself will not be created. - * - * @param absolutePath the absolute path that denotes this instance - * of <code>FileRef</code> - * @param isDirectory true, if the file to create should denote a directory - */ - public FileRef(String absolutePath, boolean isDirectory) { - this(absolutePath, isDirectory, false, 0, 0); - } - - public String getMimetype() { - return mimetype; - } - - public void setMimetype(String mimetype) { - this.mimetype = mimetype; - } - - /** - * get the absolute path that denotes this file - * @return the path - */ - public String getAbsolutePath() { - return absolutePath; - } - - /** - * Tests whether the file denoted by this abstract pathname is a - * directory. - * - * @return <code>true</code> if this file is a directory, - * <code>false</code> otherwise - */ - public boolean isDirectory() { - return isDirectory; - } - - /** - * Tests whether the file denoted by this abstract pathname is a - * file. - * - * @return <code>true</code> if this file is a file, - * <code>false</code> otherwise - */ - public boolean isFile() { - return !isDirectory; - } - - /** - * Tests whether the file denoted by this abstract pathname is a - * hidden file. - * - * @return <code>true</code> if this file is a hidden file, - * <code>false</code> otherwise - */ - public boolean isHidden() { - return isHidden; - } - - /** - * Returns the time that this file was - * last modified. - * - * @return A <code>long</code> value representing the time the file was - * last modified, measured in milliseconds since the epoch - * (00:00:00 GMT, January 1, 1970) - */ - public long getLastModified() { - return lastModified; - } - - /** - * Returns the length of this file. - * The return value is unspecified if this file denotes a directory. - * - * @return The length, in bytes, of this file - */ - public long getLength() { - return length; - } - - /** - * get the name of this file without path - * @param separatorChar the string that is used to separate directories and file names in - * path expressions - * @return the name of this file without path - */ - public String getName(String separatorChar) { - String path = getAbsolutePath(); - String name = path.substring(path.lastIndexOf(separatorChar) + 1); - if(name == null || name.length() < 1) { - name = path; - } - return name; - } - - /** - * get a string representation of this instance of FileRef - * @return the string representation of this FileRef object - */ - public String toString() { - return getAbsolutePath(); - } - - /** - * Indicates whether some object is equal to this instance of class FileRef. Two - * GenericFiles are regarded as equal when their absolute paths are equal case independently. - * - * @param obj the object to compare with this instance of FileRef - * @return true, if obj is equal to this instance of FileRef, false if not - */ - public boolean equals(Object obj) { - boolean isEqual = false; - if(obj != null && obj instanceof FileRef) { - isEqual = ((FileRef) obj).getAbsolutePath().toLowerCase().equals( - this.getAbsolutePath().toLowerCase()); - } - return isEqual; - } -} diff --git a/src/java/de/uhilger/filecms/web/UploadServlet.java b/src/java/de/uhilger/filecms/web/UploadServlet.java index 5ed25fb..94e22ca 100644 --- a/src/java/de/uhilger/filecms/web/UploadServlet.java +++ b/src/java/de/uhilger/filecms/web/UploadServlet.java @@ -22,7 +22,7 @@ import static de.uhilger.filecms.api.FileMgr.HOME_DIR_PATH; import static de.uhilger.filecms.api.FileMgr.PUB_DIR_NAME; import static de.uhilger.filecms.api.FileMgr.PUB_DIR_PATH; -import de.uhilger.filecms.data.FileRef; +import de.uhilger.wbx.data.FileRef; import de.uhilger.wbx.web.Initialiser; import java.io.File; import java.io.IOException; -- Gitblit v1.9.3