changeset 825:26a3e127f45c stream

config option img-diskcache-allowed to switch off disk caching in ImageIO
author robcast
date Wed, 23 Feb 2011 10:09:53 +0100
parents 6c752969f9e8
children 980661e00372
files client/digitallibrary/WEB-INF/digilib-config.xml servlet/src/digilib/servlet/DigilibConfiguration.java servlet/src/digilib/servlet/Initialiser.java servlet/src/digilib/servlet/Scaler.java
diffstat 4 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/WEB-INF/digilib-config.xml	Tue Feb 22 20:08:27 2011 +0100
+++ b/client/digitallibrary/WEB-INF/digilib-config.xml	Wed Feb 23 10:09:53 2011 +0100
@@ -68,5 +68,7 @@
   <!-- logo for PDFs -->
   <parameter name="pdf-logo" value="http://www.mpiwg-berlin.mpg.de/de/images/logo.png" />
 
+  <!-- is the image toolkit allowed to use a disk cache -->
+  <parameter name="img-diskcache-allowed" value="false"/>
   
 </digilib-config>
--- a/servlet/src/digilib/servlet/DigilibConfiguration.java	Tue Feb 22 20:08:27 2011 +0100
+++ b/servlet/src/digilib/servlet/DigilibConfiguration.java	Wed Feb 23 10:09:53 2011 +0100
@@ -26,7 +26,6 @@
 import java.util.Map;
 import java.util.Map.Entry;
 
-import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
 
@@ -173,8 +172,8 @@
         newParameter("pdf-temp-dir", "pdf_temp", null, 'f');
         // PDF generation cache directory
         newParameter("pdf-cache-dir", "pdf_cache", null, 'f');
-        // PDF generation cache directory
-        newParameter("pdf-cache-dir", "pdf_cache", null, 'f');
+		// allow image toolkit to use disk cache
+		newParameter("img-diskcache-allowed", Boolean.TRUE, null, 'f');
 	}
 
 	/**
--- a/servlet/src/digilib/servlet/Initialiser.java	Tue Feb 22 20:08:27 2011 +0100
+++ b/servlet/src/digilib/servlet/Initialiser.java	Wed Feb 23 10:09:53 2011 +0100
@@ -24,6 +24,7 @@
 import java.io.OutputStream;
 import java.util.List;
 
+import javax.imageio.ImageIO;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletContextEvent;
 import javax.servlet.ServletContextListener;
@@ -129,6 +130,10 @@
 				// DocuImage class
 				DocuImage di = DigilibConfiguration.getDocuImageInstance();
 				dlConfig.setValue("servlet.docuimage.class", di.getClass().getName());
+				// disk cache for image toolkit
+				boolean dc = dlConfig.getAsBoolean("img-diskcache-allowed");
+				// TODO: methods for all toolkits?
+				ImageIO.setUseCache(dc);
 				// digilib worker threads
 				int nt = dlConfig.getAsInt("worker-threads");
                 int mt = dlConfig.getAsInt("max-waiting-threads");
--- a/servlet/src/digilib/servlet/Scaler.java	Tue Feb 22 20:08:27 2011 +0100
+++ b/servlet/src/digilib/servlet/Scaler.java	Wed Feb 23 10:09:53 2011 +0100
@@ -31,7 +31,7 @@
     private static final long serialVersionUID = 5289386646192471549L;
 
     /** digilib servlet version (for all components) */
-    public static final String version = "1.9.1a9";
+    public static final String version = "1.9.1a10";
 
     /** servlet error codes */
     public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};