Mercurial > hg > digilib-old
changeset 1158:2ee261676828 default tip
better out-of-the box experience:
* digilib works without config files using sensible defaults
* new sample images folder used by default
* config files moved to templates
line wrap: on
line diff
--- a/servlet2/src/main/java/digilib/servlet/DigilibServletConfiguration.java Tue Feb 19 17:27:53 2013 +0100 +++ b/servlet2/src/main/java/digilib/servlet/DigilibServletConfiguration.java Tue Feb 19 17:32:25 2013 +0100 @@ -24,6 +24,7 @@ import java.io.File; import java.util.Map; import java.util.Map.Entry; +import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -36,47 +37,50 @@ /** * Class to hold the digilib servlet configuration parameters. The parameters * can be read from the digilib-config file and be passed to other servlets or - * beans. <br>errorImgFileName: image file to send in case of error. <br> - * denyImgFileName: image file to send if access is denied. <br>baseDirs: - * array of base directories in order of preference (prescaled versions first). - * <br>useAuth: use authentication information. <br>authConfPath: - * authentication configuration file. <br>... <br> + * beans. <br> + * errorImgFileName: image file to send in case of error. <br> + * denyImgFileName: image file to send if access is denied. <br> + * baseDirs: array of base directories in order of preference (prescaled + * versions first). <br> + * useAuth: use authentication information. <br> + * authConfPath: authentication configuration file. <br> + * ... <br> * * @author casties - * + * */ public class DigilibServletConfiguration extends DigilibConfiguration { - /** - * Definition of parameters and default values. - */ - protected void initParams() { - /* - * Definition of parameters and default values. System parameters that - * are not read from config file have a type 's'. - */ + /** time the webapp (i.e. this class) was loaded */ + public final Long webappStartTime = System.currentTimeMillis(); + + /** counter for HttpRequests (mostly for debugging) */ + public AtomicInteger webappRequestCnt = new AtomicInteger(0); + + /** counter for open HttpRequests (mostly for debugging) */ + public AtomicInteger openRequestCnt = new AtomicInteger(0); - // digilib servlet version - newParameter( - "servlet.version", - digilib.servlet.Scaler.getVersion(), - null, - 's'); - // configuration file location - newParameter("servlet.config.file", null, null, 's'); - // DocuDirCache instance - newParameter("servlet.dir.cache", null, null, 's'); - // DocuImage class instance - newParameter( - "servlet.docuimage.class", - digilib.image.ImageLoaderDocuImage.class, - null, - 's'); - // DocuImage version - newParameter("servlet.docuimage.version", - "?", null, 's'); - // AuthOps instance for authentication - newParameter("servlet.auth.op", null, null, 's'); + /** + * Definition of parameters and default values. + */ + protected void initParams() { + /* + * Definition of parameters and default values. System parameters that + * are not read from config file have a type 's'. + */ + + // digilib servlet version + newParameter("servlet.version", digilib.servlet.Scaler.getVersion(), null, 's'); + // configuration file location + newParameter("servlet.config.file", null, null, 's'); + // DocuDirCache instance + newParameter("servlet.dir.cache", null, null, 's'); + // DocuImage class instance + newParameter("servlet.docuimage.class", digilib.image.ImageLoaderDocuImage.class, null, 's'); + // DocuImage version + newParameter("servlet.docuimage.version", "?", null, 's'); + // AuthOps instance for authentication + newParameter("servlet.auth.op", null, null, 's'); // Executor for image operations newParameter("servlet.worker.imageexecutor", null, null, 's'); // Executor for PDF operations @@ -84,69 +88,55 @@ // Executor for PDF-image operations newParameter("servlet.worker.pdfimageexecutor", null, null, 's'); - /* - * parameters that can be read from config file have a type 'f' - */ + /* + * parameters that can be read from config file have a type 'f' + */ - // image file to send in case of error - newParameter( - "error-image", - new File("img/digilib-error.png"), - null, - 'f'); - // image file to send if access is denied - newParameter( - "denied-image", - new File("img/digilib-denied.png"), - null, - 'f'); - // image file to send if image file not found - newParameter( - "notfound-image", - new File("img/digilib-notfound.png"), - null, - 'f'); - // base directories in order of preference (prescaled versions last) - String[] bd = { "/docuserver/images", "/docuserver/scaled/small" }; - newParameter("basedir-list", bd, null, 'f'); - // use authentication information - newParameter("use-authorization", Boolean.FALSE, null, 'f'); - // authentication configuration file - newParameter("auth-file", new File("digilib-auth.xml"), null, 'f'); - // sending image files as-is allowed - newParameter("sendfile-allowed", Boolean.TRUE, null, 'f'); - // Type of DocuImage instance - newParameter( - "docuimage-class", - "digilib.image.ImageLoaderDocuImage", - null, - 'f'); - // part of URL used to indicate authorized access - newParameter("auth-url-path", "authenticated/", null, 'f'); - // degree of subsampling on image load - newParameter("subsample-minimum", new Float(2f), null, 'f'); - // default scaling quality - newParameter("default-quality", new Integer(1), null, 'f'); - // use mapping file to translate paths - newParameter("use-mapping", Boolean.FALSE, null, 'f'); - // mapping file location - newParameter("mapping-file", new File("digilib-map.xml"), null, 'f'); - // log4j config file location - newParameter("log-config-file", new File("log4j-config.xml"), null, 'f'); - // maximum destination image size (0 means no limit) - newParameter("max-image-size", new Integer(0), null, 'f'); - // number of working threads - newParameter("worker-threads", new Integer(1), null, 'f'); - // max number of waiting threads - newParameter("max-waiting-threads", new Integer(20), null, 'f'); - // number of pdf-generation threads - newParameter("pdf-worker-threads", new Integer(1), null, 'f'); - // max number of waiting pdf-generation threads - newParameter("pdf-max-waiting-threads", new Integer(20), null, 'f'); - // number of pdf-image generation threads - newParameter("pdf-image-worker-threads", new Integer(1), null, 'f'); - // max number of waiting pdf-image generation threads - newParameter("pdf-image-max-waiting-threads", new Integer(10), null, 'f'); + // image file to send in case of error + newParameter("error-image", new File("img/digilib-error.png"), null, 'f'); + // image file to send if access is denied + newParameter("denied-image", new File("img/digilib-denied.png"), null, 'f'); + // image file to send if image file not found + newParameter("notfound-image", new File("img/digilib-notfound.png"), null, 'f'); + // base directories in order of preference (prescaled versions last) + String[] bd = { "sample-images" }; + newParameter("basedir-list", bd, null, 'f'); + // use authentication information + newParameter("use-authorization", Boolean.FALSE, null, 'f'); + // authentication configuration file + newParameter("auth-file", new File("digilib-auth.xml"), null, 'f'); + // sending image files as-is allowed + newParameter("sendfile-allowed", Boolean.TRUE, null, 'f'); + // Type of DocuImage instance + newParameter("docuimage-class", "digilib.image.ImageLoaderDocuImage", null, 'f'); + // part of URL used to indicate authorized access + newParameter("auth-url-path", "authenticated/", null, 'f'); + // degree of subsampling on image load + newParameter("subsample-minimum", new Float(2f), null, 'f'); + // default scaling quality + newParameter("default-quality", new Integer(2), null, 'f'); + // use mapping file to translate paths + newParameter("use-mapping", Boolean.FALSE, null, 'f'); + // mapping file location + newParameter("mapping-file", new File("digilib-map.xml"), null, 'f'); + // log4j config file location + newParameter("log-config-file", new File("log4j-config.xml"), null, 'f'); + // maximum destination image size (0 means no limit) + newParameter("max-image-size", new Integer(0), null, 'f'); + // number of working threads + newParameter("worker-threads", new Integer(1), null, 'f'); + // max number of waiting threads + newParameter("max-waiting-threads", new Integer(20), null, 'f'); + // timeout for worker threads (ms) + newParameter("worker-timeout", new Integer(60000), null, 'f'); + // number of pdf-generation threads + newParameter("pdf-worker-threads", new Integer(1), null, 'f'); + // max number of waiting pdf-generation threads + newParameter("pdf-max-waiting-threads", new Integer(20), null, 'f'); + // number of pdf-image generation threads + newParameter("pdf-image-worker-threads", new Integer(1), null, 'f'); + // max number of waiting pdf-image generation threads + newParameter("pdf-image-max-waiting-threads", new Integer(10), null, 'f'); // PDF generation temp directory newParameter("pdf-temp-dir", "pdf_temp", null, 'f'); // PDF generation cache directory @@ -155,17 +145,18 @@ newParameter("img-diskcache-allowed", Boolean.TRUE, null, 'f'); // default type of error message (image, text, code) newParameter("default-errmsg-type", "image", null, 'f'); - } + } - /** - * Constructor taking a ServletConfig. Reads the config file location from - * an init parameter and loads the config file. Calls <code>readConfig()</code>. - * - * @see readConfig() - */ - public DigilibServletConfiguration(ServletContext c) throws Exception { - readConfig(c); - } + /** + * Constructor taking a ServletConfig. Reads the config file location from + * an init parameter and loads the config file. Calls + * <code>readConfig()</code>. + * + * @see readConfig() + */ + public DigilibServletConfiguration(ServletContext c) throws Exception { + readConfig(c); + } /** * read parameter list from the XML file in init parameter "config-file" or @@ -184,60 +175,66 @@ } String fn = c.getInitParameter("config-file"); if (fn == null) { + logger.debug("readConfig: no param config-file"); fn = ServletOps.getConfigFile("digilib-config.xml", c); - if (fn == null) { - logger.fatal("readConfig: no param config-file"); - throw new ServletException("ERROR: no digilib config file!"); - } } File f = new File(fn); - // setup config file list reader - XMLListLoader lilo = new XMLListLoader("digilib-config", "parameter", - "name", "value"); - // read config file into HashMap - Map<String, String> confTable = lilo.loadURL(f.toURL().toString()); + if (f.canRead()) { + // setup config file list reader + XMLListLoader lilo = new XMLListLoader("digilib-config", "parameter", "name", "value"); + // read config file into HashMap + Map<String, String> confTable = lilo.loadURL(f.toURL().toString()); - // set config file path parameter - setValue("servlet.config.file", f.getCanonicalPath()); + // set config file path parameter + setValue("servlet.config.file", f.getCanonicalPath()); - /* - * read parameters - */ + /* + * read parameters + */ - for (Entry<String, String> confEntry : confTable.entrySet()) { - Parameter p = get(confEntry.getKey()); - if (p != null) { - if (p.getType() == 's') { - // type 's' Parameters are not overwritten. - continue; - } - if (!p.setValueFromString(confEntry.getValue())) { - /* - * automatic conversion failed -- try special cases - */ + for (Entry<String, String> confEntry : confTable.entrySet()) { + Parameter p = get(confEntry.getKey()); + if (p != null) { + if (p.getType() == 's') { + // type 's' Parameters are not overwritten. + continue; + } + if (!p.setValueFromString(confEntry.getValue())) { + /* + * automatic conversion failed -- try special cases + */ - // basedir-list - if (confEntry.getKey().equals("basedir-list")) { - // split list into directories - String[] dirs = FileOps.pathToArray(confEntry.getValue()); - for (int j = 0; j < dirs.length; j++) { - // make relative directory paths be inside the webapp - dirs[j] = ServletOps.getFile(dirs[j], c); - } - if (dirs != null) { - p.setValue(dirs); + // basedir-list + if (confEntry.getKey().equals("basedir-list")) { + // split list into directories + String[] dirs = FileOps.pathToArray(confEntry.getValue()); + for (int j = 0; j < dirs.length; j++) { + // make relative directory paths be inside the + // webapp + dirs[j] = ServletOps.getFile(dirs[j], c); + } + if (dirs != null) { + p.setValue(dirs); + } } } + } else { + // parameter unknown -- just add + newParameter(confEntry.getKey(), null, confEntry.getValue(), 'f'); } - } else { - // parameter unknown -- just add - newParameter(confEntry.getKey(), null, confEntry.getValue(), - 'f'); + } + } else { + logger.warn("No digilib config file! Using defaults!"); + // update basedir-list + String[] dirs = (String[]) this.getValue("basedir-list"); + for (int j = 0; j < dirs.length; j++) { + // make relative directory paths be inside the + // webapp + dirs[j] = ServletOps.getFile(dirs[j], c); } } // initialise static DocuImage class instance - DigilibServletConfiguration.docuImageClass = (Class<DocuImageImpl>) Class - .forName(getAsString("docuimage-class")); + DigilibServletConfiguration.docuImageClass = (Class<DocuImageImpl>) Class.forName(getAsString("docuimage-class")); setValue("servlet.docuimage.version", getDocuImageInstance().getVersion()); }
--- a/servlet2/src/main/java/digilib/servlet/Scaler.java Tue Feb 19 17:27:53 2013 +0100 +++ b/servlet2/src/main/java/digilib/servlet/Scaler.java Tue Feb 19 17:32:25 2013 +0100 @@ -34,7 +34,7 @@ private static final long serialVersionUID = -5439198888139362735L; /** digilib servlet version (for all components) */ - public static final String version = "2.1b2 noasync"; + public static final String version = "2.1b3 noasync"; /** servlet error codes */ public static enum Error {UNKNOWN, AUTH, FILE, IMAGE};
--- a/servlet3/src/main/java/digilib/servlet/DigilibServletConfiguration.java Tue Feb 19 17:27:53 2013 +0100 +++ b/servlet3/src/main/java/digilib/servlet/DigilibServletConfiguration.java Tue Feb 19 17:32:25 2013 +0100 @@ -27,7 +27,6 @@ import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; -import javax.servlet.ServletException; import digilib.image.DocuImageImpl; import digilib.io.FileOps; @@ -53,7 +52,7 @@ /** time the webapp (i.e. this class) was loaded */ public final Long webappStartTime = System.currentTimeMillis(); - + /** counter for HttpRequests (mostly for debugging) */ public AtomicInteger webappRequestCnt = new AtomicInteger(0); @@ -70,18 +69,15 @@ */ // digilib servlet version - newParameter("servlet.version", digilib.servlet.Scaler.getVersion(), - null, 's'); + newParameter("servlet.version", digilib.servlet.Scaler.getVersion(), null, 's'); // configuration file location newParameter("servlet.config.file", null, null, 's'); // DocuDirCache instance newParameter("servlet.dir.cache", null, null, 's'); // DocuImage class instance - newParameter("servlet.docuimage.class", - digilib.image.ImageLoaderDocuImage.class, null, 's'); + newParameter("servlet.docuimage.class", digilib.image.ImageLoaderDocuImage.class, null, 's'); // DocuImage version - newParameter("servlet.docuimage.version", - "?", null, 's'); + newParameter("servlet.docuimage.version", "?", null, 's'); // AuthOps instance for authentication newParameter("servlet.auth.op", null, null, 's'); // Executor for image operations @@ -96,16 +92,13 @@ */ // image file to send in case of error - newParameter("error-image", new File("img/digilib-error.png"), null, - 'f'); + newParameter("error-image", new File("img/digilib-error.png"), null, 'f'); // image file to send if access is denied - newParameter("denied-image", new File("img/digilib-denied.png"), null, - 'f'); + newParameter("denied-image", new File("img/digilib-denied.png"), null, 'f'); // image file to send if image file not found - newParameter("notfound-image", new File("img/digilib-notfound.png"), - null, 'f'); + newParameter("notfound-image", new File("img/digilib-notfound.png"), null, 'f'); // base directories in order of preference (prescaled versions last) - String[] bd = { "/docuserver/images", "/docuserver/scaled/small" }; + String[] bd = { "sample-images" }; newParameter("basedir-list", bd, null, 'f'); // use authentication information newParameter("use-authorization", Boolean.FALSE, null, 'f'); @@ -120,7 +113,7 @@ // degree of subsampling on image load newParameter("subsample-minimum", new Float(2f), null, 'f'); // default scaling quality - newParameter("default-quality", new Integer(1), null, 'f'); + newParameter("default-quality", new Integer(2), null, 'f'); // use mapping file to translate paths newParameter("use-mapping", Boolean.FALSE, null, 'f'); // mapping file location @@ -142,8 +135,7 @@ // number of pdf-image generation threads newParameter("pdf-image-worker-threads", new Integer(1), null, 'f'); // max number of waiting pdf-image generation threads - newParameter("pdf-image-max-waiting-threads", new Integer(10), null, - 'f'); + newParameter("pdf-image-max-waiting-threads", new Integer(10), null, 'f'); // PDF generation temp directory newParameter("pdf-temp-dir", "pdf_temp", null, 'f'); // PDF generation cache directory @@ -182,59 +174,66 @@ } String fn = c.getInitParameter("config-file"); if (fn == null) { + logger.debug("readConfig: no param config-file"); fn = ServletOps.getConfigFile("digilib-config.xml", c); - if (fn == null) { - logger.fatal("readConfig: no param config-file"); - throw new ServletException("ERROR: no digilib config file!"); - } } File f = new File(fn); - // setup config file list reader - XMLListLoader lilo = new XMLListLoader("digilib-config", "parameter", - "name", "value"); - // read config file into HashMap - Map<String, String> confTable = lilo.loadURL(f.toURL().toString()); + if (f.canRead()) { + // setup config file list reader + XMLListLoader lilo = new XMLListLoader("digilib-config", "parameter", "name", "value"); + // read config file into HashMap + Map<String, String> confTable = lilo.loadURL(f.toURL().toString()); - // set config file path parameter - setValue("servlet.config.file", f.getCanonicalPath()); + // set config file path parameter + setValue("servlet.config.file", f.getCanonicalPath()); - /* - * read parameters - */ + /* + * read parameters + */ - for (Entry<String, String> confEntry : confTable.entrySet()) { - Parameter p = get(confEntry.getKey()); - if (p != null) { - if (p.getType() == 's') { - // type 's' Parameters are not overwritten. - continue; - } - if (!p.setValueFromString(confEntry.getValue())) { - /* - * automatic conversion failed -- try special cases - */ + for (Entry<String, String> confEntry : confTable.entrySet()) { + Parameter p = get(confEntry.getKey()); + if (p != null) { + if (p.getType() == 's') { + // type 's' Parameters are not overwritten. + continue; + } + if (!p.setValueFromString(confEntry.getValue())) { + /* + * automatic conversion failed -- try special cases + */ - // basedir-list - if (confEntry.getKey().equals("basedir-list")) { - // split list into directories - String[] dirs = FileOps.pathToArray(confEntry.getValue()); - for (int j = 0; j < dirs.length; j++) { - // make relative directory paths be inside the webapp - dirs[j] = ServletOps.getFile(dirs[j], c); - } - if (dirs != null) { - p.setValue(dirs); + // basedir-list + if (confEntry.getKey().equals("basedir-list")) { + // split list into directories + String[] dirs = FileOps.pathToArray(confEntry.getValue()); + for (int j = 0; j < dirs.length; j++) { + // make relative directory paths be inside the + // webapp + dirs[j] = ServletOps.getFile(dirs[j], c); + } + if (dirs != null) { + p.setValue(dirs); + } } } + } else { + // parameter unknown -- just add + newParameter(confEntry.getKey(), null, confEntry.getValue(), 'f'); } - } else { - // parameter unknown -- just add - newParameter(confEntry.getKey(), null, confEntry.getValue(), 'f'); + } + } else { + logger.warn("No digilib config file! Using defaults!"); + // update basedir-list + String[] dirs = (String[]) this.getValue("basedir-list"); + for (int j = 0; j < dirs.length; j++) { + // make relative directory paths be inside the + // webapp + dirs[j] = ServletOps.getFile(dirs[j], c); } } // initialise static DocuImage class instance - DigilibServletConfiguration.docuImageClass = (Class<DocuImageImpl>) Class - .forName(getAsString("docuimage-class")); + DigilibServletConfiguration.docuImageClass = (Class<DocuImageImpl>) Class.forName(getAsString("docuimage-class")); setValue("servlet.docuimage.version", getDocuImageInstance().getVersion()); }
--- a/servlet3/src/main/java/digilib/servlet/Initialiser.java Tue Feb 19 17:27:53 2013 +0100 +++ b/servlet3/src/main/java/digilib/servlet/Initialiser.java Tue Feb 19 17:32:25 2013 +0100 @@ -54,7 +54,7 @@ /** servlet version */ - public static final String version = "0.3"; + public static final String version = "0.4"; /** gengeral logger for this class */ private static Logger logger = Logger.getLogger("digilib.init"); @@ -97,8 +97,10 @@ // set up the logger File logConf = ServletOps.getConfigFile((File) dlConfig .getValue("log-config-file"), context); - DOMConfigurator.configure(logConf.getAbsolutePath()); - dlConfig.setValue("log-config-file", logConf); + if (logConf.canRead()) { + DOMConfigurator.configure(logConf.getAbsolutePath()); + dlConfig.setValue("log-config-file", logConf); + } // say hello in the log file logger .info("***** Digital Image Library Initialiser (version "
--- a/servlet3/src/main/java/digilib/servlet/Scaler.java Tue Feb 19 17:27:53 2013 +0100 +++ b/servlet3/src/main/java/digilib/servlet/Scaler.java Tue Feb 19 17:32:25 2013 +0100 @@ -31,7 +31,7 @@ private static final long serialVersionUID = 5289386646192471549L; /** digilib servlet version (for all components) */ - public static final String version = "2.1b2 async"; + public static final String version = "2.1b3 async"; /** servlet error codes */ public static enum Error {
--- a/webapp/src/main/webapp/WEB-INF/digilib-auth.xml Tue Feb 19 17:27:53 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Authentication configuration file for Digital Document Library --> -<auth-config> - - <digilib-paths> - <!-- - A user must supply one of the roles under "role" - to access the directory "name". - Roles under "role" must be separated by comma only (no spaces). - --> - <path name="histast/eastwood-collection" role="eastwood-coll" /> - <path name="ptolemaios_geo" role="ptolemaios-geo" /> - </digilib-paths> - - <digilib-addresses> - <!-- - A computer with an ip address that matches "ip" - is automatically granted all roles under "role". - The ip address is matched from the left (in full quads). - Roles under "role" must be separated by comma only (no spaces). - --> - <address ip="127" role="local" /> - <address ip="130.92.68" role="eastwood-coll,ptolemaios-geo" /> - <address ip="130.92.151" role="ALL" /> - </digilib-addresses> - -</auth-config>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/WEB-INF/digilib-auth.xml.template Tue Feb 19 17:32:25 2013 +0100 @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Authentication configuration file for Digital Document Library --> +<auth-config> + + <digilib-paths> + <!-- + A user must supply one of the roles under "role" + to access the directory "name". + Roles under "role" must be separated by comma only (no spaces). + --> + <path name="histast/eastwood-collection" role="eastwood-coll" /> + <path name="ptolemaios_geo" role="ptolemaios-geo" /> + </digilib-paths> + + <digilib-addresses> + <!-- + A computer with an ip address that matches "ip" + is automatically granted all roles under "role". + The ip address is matched from the left (in full quads). + Roles under "role" must be separated by comma only (no spaces). + --> + <address ip="127" role="local" /> + <address ip="130.92.68" role="eastwood-coll,ptolemaios-geo" /> + <address ip="130.92.151" role="ALL" /> + </digilib-addresses> + +</auth-config>
--- a/webapp/src/main/webapp/WEB-INF/digilib-config.xml Tue Feb 19 17:27:53 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Digilib servlet config file --> - -<digilib-config> - <!-- Image to be sent to indicate an error or general failure. --> - <parameter name="error-image" value="img/digilib-error.png" /> - - <!-- Image to be sent to indicate an authorization failure. --> - <parameter name="denied-image" value="img/digilib-denied.png" /> - - <!-- Image to be sent to indicate that the request was correct, but the specified image could not be ound. --> - <parameter name="notfound-image" value="img/digilib-notfound.png" /> - - <!-- List of directories where images are searched. - Directories with low-resolution images are LAST!!! in list. - Use OS-specific path separators (":" for Unix, ";" for Windows) --> - <parameter name="basedir-list" value="/docuserver/images:/docuserver/scaled/small:/docuserver/scaled/thumb" /> - - <!-- Java class to use for image operations --> - <parameter name="docuimage-class" value="digilib.image.ImageLoaderDocuImage" /> - - <!-- mimimum amount of scaling done with antialiasing --> - <parameter name="subsample-minimum" value="2"/> - - <!-- default interpolation quality (0=worst) --> - <parameter name="default-quality" value="2"/> - - <!-- is sending whole image files with mo=file allowed? --> - <parameter name="sendfile-allowed" value="true" /> - - <!-- the a maximum size of any sent image. (0 means no limit) --> - <parameter name="max-image-size" value="0" /> - - <!-- number of working threads --> - <parameter name="worker-threads" value="2" /> - - <!-- number of waiting requests in queue --> - <parameter name="max-waiting-threads" value="20" /> - - <!-- timeout for asynchronous servlet worker (ms) --> - <parameter name="worker-timeout" value="60000" /> - - <!-- Restrict access to authorized users. - User authentication and roles are provided by the servlet container - (see tomcat-users.xml). - Authorization for resources (directories) is evaluated by the servlet - (see auth-file). --> - <parameter name="use-authorization" value="false" /> - - <!-- URL location of XML file with authorization requirements. --> - <parameter name="auth-file" value="digilib-auth.xml" /> - - <!-- Part of URL to indicate authenticated access to Tomcat. --> - <parameter name="auth-url-path" value="authenticated" /> - - <!-- use mapping of "virtual directories" to real directories on the server --> - <parameter name="use-mapping" value="false"/> - - <!-- location of XML mapping file --> - <parameter name="mapping-file" value="digilib-map.xml"/> - - <!-- location of logger config file --> - <parameter name="log-config-file" value="log4j-config.xml"/> - - <!-- location for PDF files while still in progress --> - <parameter name="pdf-temp-dir" value="/tmp/pdf_tmp" /> - - <!-- location for PDF files upon completion --> - <parameter name="pdf-cache-dir" value="/tmp/pdf_cache"/> - - <!-- number of PDF generation threads --> - <parameter name="pdf-worker-threads" value="1" /> - - <!-- number of waiting PDF requests in queue --> - <parameter name="pdf-max-waiting-threads" value="20" /> - - <!-- number of image generation threads for PDF --> - <parameter name="pdf-image-worker-threads" value="1" /> - - <!-- number of waiting image requests for PDF in queue --> - <parameter name="pdf-image-max-waiting-threads" value="10" /> - - <!-- logo for PDFs --> - <parameter name="pdf-logo" value="http://digilib.berlios.de/images/digilib-logo-big.png" /> - - <!-- is the image toolkit allowed to use a disk cache --> - <parameter name="img-diskcache-allowed" value="false"/> - -</digilib-config>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/WEB-INF/digilib-config.xml.template Tue Feb 19 17:32:25 2013 +0100 @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Digilib servlet config file --> +<!-- rename this file to digilib-config.xml --> + +<digilib-config> + <!-- Image to be sent to indicate an error or general failure. --> + <parameter name="error-image" value="img/digilib-error.png" /> + + <!-- Image to be sent to indicate an authorization failure. --> + <parameter name="denied-image" value="img/digilib-denied.png" /> + + <!-- Image to be sent to indicate that the request was correct, but the specified image could not be found. --> + <parameter name="notfound-image" value="img/digilib-notfound.png" /> + + <!-- List of directories where images are searched. + Directories with low-resolution images are LAST!!! in list. + Use OS-specific path separators (":" for Unix, ";" for Windows) --> + <parameter name="basedir-list" value="/docuserver/images:/docuserver/scaled/small:/docuserver/scaled/thumb" /> + + <!-- Java class to use for image operations --> + <parameter name="docuimage-class" value="digilib.image.ImageLoaderDocuImage" /> + + <!-- mimimum amount of scaling done with antialiasing --> + <parameter name="subsample-minimum" value="2"/> + + <!-- default interpolation quality (0=worst) --> + <parameter name="default-quality" value="2"/> + + <!-- is sending whole image files with mo=file allowed? --> + <parameter name="sendfile-allowed" value="true" /> + + <!-- the a maximum size of any sent image. (0 means no limit) --> + <parameter name="max-image-size" value="0" /> + + <!-- number of working threads --> + <parameter name="worker-threads" value="2" /> + + <!-- number of waiting requests in queue --> + <parameter name="max-waiting-threads" value="20" /> + + <!-- timeout for asynchronous servlet worker (ms) --> + <parameter name="worker-timeout" value="60000" /> + + <!-- Restrict access to authorized users. + User authentication and roles are provided by the servlet container + (see tomcat-users.xml). + Authorization for resources (directories) is evaluated by the servlet + (see auth-file). --> + <parameter name="use-authorization" value="false" /> + + <!-- URL location of XML file with authorization requirements. --> + <parameter name="auth-file" value="digilib-auth.xml" /> + + <!-- Part of URL to indicate authenticated access to Tomcat. --> + <parameter name="auth-url-path" value="authenticated" /> + + <!-- use mapping of "virtual directories" to real directories on the server --> + <parameter name="use-mapping" value="false"/> + + <!-- location of XML mapping file --> + <parameter name="mapping-file" value="digilib-map.xml"/> + + <!-- location of logger config file --> + <parameter name="log-config-file" value="log4j-config.xml"/> + + <!-- location for PDF files while still in progress --> + <parameter name="pdf-temp-dir" value="/tmp/pdf_tmp" /> + + <!-- location for PDF files upon completion --> + <parameter name="pdf-cache-dir" value="/tmp/pdf_cache"/> + + <!-- number of PDF generation threads --> + <parameter name="pdf-worker-threads" value="1" /> + + <!-- number of waiting PDF requests in queue --> + <parameter name="pdf-max-waiting-threads" value="20" /> + + <!-- number of image generation threads for PDF --> + <parameter name="pdf-image-worker-threads" value="1" /> + + <!-- number of waiting image requests for PDF in queue --> + <parameter name="pdf-image-max-waiting-threads" value="10" /> + + <!-- logo for PDFs --> + <parameter name="pdf-logo" value="http://digilib.berlios.de/images/digilib-logo-big.png" /> + + <!-- is the image toolkit allowed to use a disk cache --> + <parameter name="img-diskcache-allowed" value="false"/> + +</digilib-config>
--- a/webapp/src/main/webapp/WEB-INF/digilib-map.xml Tue Feb 19 17:27:53 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- mapping of "virtual" and real directories on digilib server --> -<digilib-aliases> - <mapping link="exp1/archimedes/hutto_dicti_1625" dir="lib2/china/QiQi/Vol1"/> - <mapping link="exp1/archimedes/kopernicus" dir="pro1/sundries/kop2"/> -</digilib-aliases> \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/WEB-INF/digilib-map.xml.template Tue Feb 19 17:32:25 2013 +0100 @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- mapping of "virtual" and real directories on digilib server --> +<digilib-aliases> + <mapping link="exp1/archimedes/hutto_dicti_1625" dir="lib2/china/QiQi/Vol1"/> + <mapping link="exp1/archimedes/kopernicus" dir="pro1/sundries/kop2"/> +</digilib-aliases> \ No newline at end of file
--- a/webapp/src/main/webapp/WEB-INF/log4j-config.xml Tue Feb 19 17:27:53 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> - -<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> - - <appender name="cons" class="org.apache.log4j.ConsoleAppender"> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> - </layout> - </appender> - - <appender name="log" class="org.apache.log4j.FileAppender"> - <param name="File" value="digilib-log.txt"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> - </layout> - </appender> - - <appender name="account" class="org.apache.log4j.FileAppender"> - <param name="File" value="dl-access-log.txt"/> - <param name="Append" value="true"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> - </layout> - </appender> - - <logger name="account.request"> - <level value ="debug"/> - <appender-ref ref="account"/> - </logger> - - <root> - <level value ="debug"/> - <appender-ref ref="cons"/> - <appender-ref ref="log"/> - </root> - -</log4j:configuration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/WEB-INF/log4j-config.xml.template Tue Feb 19 17:32:25 2013 +0100 @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <appender name="cons" class="org.apache.log4j.ConsoleAppender"> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> + </layout> + </appender> + + <appender name="log" class="org.apache.log4j.FileAppender"> + <param name="File" value="digilib-log.txt"/> + <param name="Append" value="true"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> + </layout> + </appender> + + <appender name="account" class="org.apache.log4j.FileAppender"> + <param name="File" value="dl-access-log.txt"/> + <param name="Append" value="true"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %p - %m%n"/> + </layout> + </appender> + + <logger name="account.request"> + <level value ="debug"/> + <appender-ref ref="account"/> + </logger> + + <root> + <level value ="debug"/> + <appender-ref ref="cons"/> + <appender-ref ref="log"/> + </root> + +</log4j:configuration>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/sample-images/p0005.jpg.meta Tue Feb 19 17:32:25 2013 +0100 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<resource version="1.0"> + <meta> + <img> + <original-dpi>370</original-dpi> + </img> + <copyright resource="digital-image"> + <owner> + <name>Max Planck Institute for the History of Science, Library</name> + <url>http://www.mpiwg-berlin.mpg.de/</url> + </owner> + <license type="cc-by-sa"/> + </copyright> + </meta> +</resource>