diff servlet/src/digilib/io/ImageFile.java @ 579:efd7a223f819 stream

try: ImageInput as interface, ImageFile inherits from Dirent and implements ImageInput
author robcast
date Wed, 22 Dec 2010 19:17:52 +0100
parents 790cbfb58b52
children f210731dc6cc
line wrap: on
line diff
--- a/servlet/src/digilib/io/ImageFile.java	Wed Dec 22 18:32:06 2010 +0100
+++ b/servlet/src/digilib/io/ImageFile.java	Wed Dec 22 19:17:52 2010 +0100
@@ -28,7 +28,7 @@
 /**
  * @author casties
  */
-public class ImageFile extends ImageInput {
+public class ImageFile extends DocuDirent implements ImageInput {
 	
 	// file name
 	private String filename = null;
@@ -36,6 +36,11 @@
 	private ImageSet parent = null;
 	// parent directory
 	private Directory dir = null;
+    // mime file type
+    protected String mimetype = null;
+    // image size in pixels
+    protected ImageSize pixelSize = null;
+
 
 	public ImageFile(String fn, ImageSet parent, Directory dir) {
 		this.filename = fn;
@@ -50,12 +55,6 @@
 	}
 	
 	
-	@Override
-	public boolean hasFile() {
-		// this is File-based
-		return true;
-	}
-
 	/** Returns the file name (without path).
 	 * 
 	 * @return
@@ -68,7 +67,6 @@
 	/**
 	 * @return File
 	 */
-	@Override
 	public File getFile() {
 		if (dir == null) {
 			return null;
@@ -77,21 +75,6 @@
 		return f;
 	}
 
-	/**
-	 * @return ImageSet
-	 */
-	public ImageSet getParent() {
-		return parent;
-	}
-
-	/**
-	 * Sets the parent.
-	 * @param parent The parent to set
-	 */
-	public void setParent(ImageSet parent) {
-		this.parent = parent;
-	}
-
 	/* (non-Javadoc)
 	 * @see digilib.io.ImageInput#setSize(digilib.image.ImageSize)
 	 */
@@ -102,5 +85,63 @@
 			this.parent.setAspect(imageSize);
 		}
 	}
+    /* (non-Javadoc)
+     * @see digilib.io.ImageInput#getSize()
+     */
+    public ImageSize getSize() {
+        return pixelSize;
+    }
+
+    /* (non-Javadoc)
+     * @see digilib.io.ImageInput#getMimetype()
+     */
+    public String getMimetype() {
+        return mimetype;
+    }
+
+    /* (non-Javadoc)
+     * @see digilib.io.ImageInput#setMimetype(java.lang.String)
+     */
+    public void setMimetype(String filetype) {
+        this.mimetype = filetype;
+    }
+
+    /* (non-Javadoc)
+     * @see digilib.io.ImageInput#isChecked()
+     */
+    public boolean isChecked() {
+        return (pixelSize != null);
+    }
+    
+    /* (non-Javadoc)
+     * @see digilib.io.ImageInput#getAspect()
+     */
+    public float getAspect() {
+        return (pixelSize != null) ? pixelSize.getAspect() : 0;
+    }
+
+    @Override
+    public ImageSet getParentSet() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    public void setParentSet(ImageSet parent) {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public void checkMeta() {
+        // TODO Auto-generated method stub
+        
+    }
+
+    @Override
+    public File getInput() {
+        // TODO Auto-generated method stub
+        return null;
+    }
 
 }