changeset 758:485b85f6e097 stream

fixed jsp to work with new classes. try SynchronizedHashMap.
author robcast
date Mon, 07 Feb 2011 11:02:23 +0100
parents 5d3f74f378dd
children 16a16ca5f651
files client/digitallibrary/ImgInfo-json.jsp servlet/src/digilib/io/DocuDirCache.java
diffstat 2 files changed, 6 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/client/digitallibrary/ImgInfo-json.jsp	Mon Feb 07 09:12:47 2011 +0100
+++ b/client/digitallibrary/ImgInfo-json.jsp	Mon Feb 07 11:02:23 2011 +0100
@@ -1,6 +1,6 @@
 <%@page language="java" 
-	import="digilib.io.FileOps, digilib.io.ImageFileset, digilib.io.ImageFile, 
-	digilib.image.ImageSize, digilib.servlet.DigilibConfiguration"
+	import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile, 
+	digilib.util.ImageSize, digilib.servlet.DigilibConfiguration"
 	contentType="application/json"%><%!
 // create DocumentBean instance for all JSP requests
 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
@@ -23,14 +23,11 @@
 digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache");
 // get file
 FileOps.FileClass fc = FileOps.FileClass.IMAGE;
-ImageFileset imgFile = (ImageFileset) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc);
+ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc);
 
 %>{ <% 
     if (imgFile != null) {
-		ImageFile img = imgFile.getBiggest();
-		if (!img.isChecked()) {
-			DigilibConfiguration.docuImageIdentify(img);
-		}
+		ImageFile img = (ImageFile) imgFile.getBiggest();
 		ImageSize imgSize = img.getSize(); 
 		%>
   "filename" : "<%= imgFile.getName() %>",
--- a/servlet/src/digilib/io/DocuDirCache.java	Mon Feb 07 09:12:47 2011 +0100
+++ b/servlet/src/digilib/io/DocuDirCache.java	Mon Feb 07 11:02:23 2011 +0100
@@ -27,6 +27,7 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
 
@@ -42,7 +43,7 @@
 	Logger logger = Logger.getLogger(this.getClass());
 
 	/** HashMap of directories */
-	Map<String, DocuDirectory> map = null;
+	Map<String, DocuDirectory> map = new ConcurrentHashMap<String, DocuDirectory>();
 
 	/** names of base directories */
 	String[] baseDirNames = null;
@@ -71,7 +72,6 @@
 	public DocuDirCache(String[] bd, FileClass[] fcs,
 			DigilibConfiguration dlConfig) {
 		baseDirNames = bd;
-		map = new HashMap<String, DocuDirectory>();
 		this.fileClasses = fcs;
 	}
 
@@ -83,7 +83,6 @@
 	 */
 	public DocuDirCache(String[] bd) {
 		baseDirNames = bd;
-		map = new HashMap<String, DocuDirectory>();
 		// default file class is CLASS_IMAGE
 		fileClasses = new FileClass[] { FileClass.IMAGE };
 	}