Mercurial > hg > digilib-old
changeset 573:beeedf90cb81 stream
Merge from HEAD
fd2ef7e461198ef4a9d9a02459be2057038d600d
author | robcast |
---|---|
date | Wed, 22 Dec 2010 09:54:34 +0100 |
parents | 34701340922e (diff) fd2ef7e46119 (current diff) |
children | 790cbfb58b52 |
files | client/digitallibrary/WEB-INF/classes/info.txt client/digitallibrary/contexto/contexto.jsp client/digitallibrary/digilib-new.html client/digitallibrary/modules/cm_separator.gif client/digitallibrary/modules/imago.js client/digitallibrary/modules/newReferences.js client/digitallibrary/relato/astro.xml client/digitallibrary/relato/blank.html client/digitallibrary/relato/compare.xml client/digitallibrary/relato/digicat-digilib.xml client/digitallibrary/relato/digilib-digilib.xml client/digitallibrary/relato/neugebauer.xml client/digitallibrary/relato/picture.xml client/digitallibrary/relato/relato.js client/digitallibrary/relato/relato.xsl client/digitallibrary/relato/type.xml client/digitallibrary/relato/work.xml client/digitallibrary/xul/alcatraz.xpi client/digitallibrary/xul/install.html servlet/src/digilib/image/DocuImage.java servlet/src/digilib/image/DocuImageImpl.java servlet/src/digilib/image/ImageLoaderDocuImage.java servlet/src/digilib/image/JAIDocuImage.java servlet/src/digilib/servlet/Scaler.java |
diffstat | 9 files changed, 146 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/servlet/src/digilib/image/DocuImage.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/image/DocuImage.java Wed Dec 22 09:54:34 2010 +0100 @@ -29,6 +29,7 @@ import digilib.io.ImageFile; import digilib.io.FileOpException; +import digilib.io.ImageInput; /** The basic class for the representation of a digilib image. * @@ -46,7 +47,7 @@ */ public void loadImage(ImageFile f) throws FileOpException; - /** This DocuImage support the loadSubImage operation. + /** This DocuImage supports the loadSubImage operation. * * @return boolean */ @@ -223,7 +224,7 @@ /** * Check image size and type and store in ImageFile f */ - public ImageFile identify(ImageFile imgf) throws IOException; + public ImageInput identify(ImageFile imgf) throws IOException; /** * Returns a list of supported image formats
--- a/servlet/src/digilib/image/DocuImageImpl.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/image/DocuImageImpl.java Wed Dec 22 09:54:34 2010 +0100 @@ -34,6 +34,7 @@ import digilib.io.FileOpException; import digilib.io.ImageFile; +import digilib.io.ImageInput; /** Simple abstract implementation of the <code>DocuImage</code> interface. * @@ -106,7 +107,7 @@ /* (non-Javadoc) * @see digilib.image.DocuImage#identify(digilib.io.ImageFile) */ - public ImageFile identify(ImageFile imgf) throws IOException { + public ImageInput identify(ImageFile imgf) throws IOException { // just a do-nothing implementation return null; }
--- a/servlet/src/digilib/image/ImageInfoDocuImage.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/image/ImageInfoDocuImage.java Wed Dec 22 09:54:34 2010 +0100 @@ -10,6 +10,7 @@ import org.marcoschmidt.image.ImageInfo; import digilib.io.ImageFile; +import digilib.io.ImageInput; /** Simple abstract implementation of the <code>DocuImage</code> interface. * Implements only the identify method using the ImageInfo class. @@ -19,7 +20,7 @@ public abstract class ImageInfoDocuImage extends DocuImageImpl { /** Check image size and type and store in ImageFile f */ - public ImageFile identify(ImageFile imgf) throws IOException { + public ImageInput identify(ImageFile imgf) throws IOException { // fileset to store the information File f = imgf.getFile(); if (f == null) {
--- a/servlet/src/digilib/image/ImageLoaderDocuImage.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/image/ImageLoaderDocuImage.java Wed Dec 22 09:54:34 2010 +0100 @@ -51,6 +51,7 @@ import digilib.io.FileOps; import digilib.io.ImageFile; import digilib.io.ImageFileset; +import digilib.io.ImageInput; /** Implementation of DocuImage using the ImageLoader API of Java 1.4 and Java2D. */ public class ImageLoaderDocuImage extends ImageInfoDocuImage { @@ -119,9 +120,9 @@ } /** Check image size and type and store in ImageFile f */ - public ImageFile identify(ImageFile imageFile) throws IOException { + public ImageInput identify(ImageFile imageFile) throws IOException { // try parent method first - ImageFile imf = super.identify(imageFile); + ImageInput imf = super.identify(imageFile); if (imf != null) { return imf; }
--- a/servlet/src/digilib/image/JAIDocuImage.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/image/JAIDocuImage.java Wed Dec 22 09:54:34 2010 +0100 @@ -48,6 +48,7 @@ import digilib.io.FileOps; import digilib.io.ImageFile; import digilib.io.ImageFileset; +import digilib.io.ImageInput; /** A DocuImage implementation using Java Advanced Imaging Library. */ /** @@ -104,9 +105,9 @@ } /* Check image size and type and store in ImageFile f */ - public ImageFile identify(ImageFile imageFile) throws IOException { + public ImageInput identify(ImageFile imageFile) throws IOException { // try parent method first - ImageFile imf = super.identify(imageFile); + ImageInput imf = super.identify(imageFile); if (imf != null) { return imf; }
--- a/servlet/src/digilib/io/ImageFile.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/io/ImageFile.java Wed Dec 22 09:54:34 2010 +0100 @@ -22,13 +22,14 @@ package digilib.io; import java.io.File; +import java.io.InputStream; import digilib.image.ImageSize; /** * @author casties */ -public class ImageFile { +public class ImageFile extends ImageInput { // file name private String filename = null; @@ -36,10 +37,6 @@ private ImageFileset parent = null; // parent directory private Directory dir = null; - // mime file type - private String mimetype = null; - // image size in pixels - private ImageSize pixelSize = null; public ImageFile(String fn, ImageFileset parent, Directory dir) { this.filename = fn; @@ -53,6 +50,13 @@ this.filename = f.getName(); } + + @Override + public boolean hasFile() { + // this is File-based + return true; + } + /** Returns the file name (without path). * * @return @@ -65,6 +69,7 @@ /** * @return File */ + @Override public File getFile() { if (dir == null) { return null; @@ -74,40 +79,6 @@ } /** - * @return ImageSize - */ - public ImageSize getSize() { - return pixelSize; - } - - /** - * @return String - */ - public String getMimetype() { - return mimetype; - } - - /** - * Sets the imageSize. - * @param imageSize The imageSize to set - */ - public void setSize(ImageSize imageSize) { - this.pixelSize = imageSize; - // pass on to parent - if (this.parent != null) { - this.parent.setAspect(imageSize); - } - } - - /** - * Sets the mimetype. - * @param mimetype The mimetype to set - */ - public void setMimetype(String filetype) { - this.mimetype = filetype; - } - - /** * @return ImageFileset */ public ImageFileset getParent() { @@ -122,19 +93,15 @@ this.parent = parent; } - /** - * @return boolean + /* (non-Javadoc) + * @see digilib.io.ImageInput#setSize(digilib.image.ImageSize) */ - public boolean isChecked() { - return (pixelSize != null); - } - - /** Returns the aspect ratio of the image (width/height). - * - * @return - */ - public float getAspect() { - return (pixelSize != null) ? pixelSize.getAspect() : 0; + public void setSize(ImageSize imageSize) { + this.pixelSize = imageSize; + // pass on to parent + if (this.parent != null) { + this.parent.setAspect(imageSize); + } } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/servlet/src/digilib/io/ImageInput.java Wed Dec 22 09:54:34 2010 +0100 @@ -0,0 +1,112 @@ +/* ImageInput-- digilib image input interface. + + Digital Image Library servlet components + + Copyright (C) 2010 Robert Casties (robcast@mail.berlios.de) + + 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. + + Please read license.txt for the full details. A copy of the GPL + may be found at http://www.gnu.org/copyleft/lgpl.html + + 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 + + * Created on 20.12.2010 + */ + +package digilib.io; + +import java.io.File; +import java.io.InputStream; + +import digilib.image.ImageSize; + +public abstract class ImageInput { + + // mime file type + protected String mimetype = null; + // image size in pixels + protected ImageSize pixelSize = null; + + /** Returns if this ImageInput is File-based. + * @return + */ + public boolean hasFile() { + return false; + } + + /** Returns the underlying File (if applicable) + * + * @return + */ + public File getFile() { + return null; + } + + /** Returns if this ImageInput is Stream-based. + * @return + */ + public boolean hasStream() { + return false; + } + + /** Returns the underlying Stream (if applicable) + * + * @return + */ + public InputStream getStream() { + return null; + } + + /** + * @return ImageSize + */ + public ImageSize getSize() { + return pixelSize; + } + + /** + * Sets the imageSize. + * @param imageSize The imageSize to set + */ + public void setSize(ImageSize imageSize) { + this.pixelSize = imageSize; + } + + /** + * @return String + */ + public String getMimetype() { + return mimetype; + } + + /** + * Sets the mimetype. + * @param mimetype The mimetype to set + */ + public void setMimetype(String filetype) { + this.mimetype = filetype; + } + + /** returns if this image has been checked + * (i.e. has size and mimetype) + * @return boolean + */ + public boolean isChecked() { + return (pixelSize != null); + } + + /** Returns the aspect ratio of the image (width/height). + * + * @return + */ + public float getAspect() { + return (pixelSize != null) ? pixelSize.getAspect() : 0; + } + +} \ No newline at end of file
--- a/servlet/src/digilib/servlet/DigilibConfiguration.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/servlet/DigilibConfiguration.java Wed Dec 22 09:54:34 2010 +0100 @@ -36,6 +36,7 @@ import digilib.image.DocuImageImpl; import digilib.io.FileOps; import digilib.io.ImageFile; +import digilib.io.ImageInput; import digilib.io.XMLListLoader; import digilib.util.Parameter; import digilib.util.ParameterMap; @@ -277,7 +278,7 @@ * @return * @throws IOException */ - public static ImageFile docuImageIdentify(ImageFile imgf) throws IOException { + public static ImageInput docuImageIdentify(ImageFile imgf) throws IOException { // use fresh DocuImage instance DocuImage di = getDocuImageInstance(); return di.identify(imgf);
--- a/servlet/src/digilib/servlet/Scaler.java Tue Dec 21 20:24:09 2010 +0100 +++ b/servlet/src/digilib/servlet/Scaler.java Wed Dec 22 09:54:34 2010 +0100 @@ -32,7 +32,7 @@ public class Scaler extends HttpServlet { /** digilib servlet version (for all components) */ - public static final String version = "1.8.2a"; + public static final String version = "1.9.0a"; /** servlet error codes */ public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};