# HG changeset patch # User robcast # Date 1377187191 -7200 # Node ID 247eab96bf04119cb6b8824009b4a5df9208fd3f # Parent 59d615f4e5f31fe8c185745b35aa9fd41851f23c ImageJobDescription creates an ImageSet when you only set an ImageInput. diff -r 59d615f4e5f3 -r 247eab96bf04 common/src/main/java/digilib/image/ImageJobDescription.java --- a/common/src/main/java/digilib/image/ImageJobDescription.java Thu Aug 22 17:14:33 2013 +0200 +++ b/common/src/main/java/digilib/image/ImageJobDescription.java Thu Aug 22 17:59:51 2013 +0200 @@ -78,6 +78,7 @@ String mimeType = null; Integer paramDW = null; Integer paramDH = null; + DocuDirCache dirCache = null; /** * create empty ImageJobDescription. @@ -87,6 +88,7 @@ public ImageJobDescription(DigilibConfiguration dlcfg) { super(30); dlConfig = dlcfg; + dirCache = (DocuDirCache) dlConfig.getValue("servlet.dir.cache"); } /** @@ -198,11 +200,18 @@ } /** + * Set the current ImageInput. + * * @param input * the input to set */ public void setInput(ImageInput input) { this.input = input; + // create and set ImageSet if needed + if (dirCache == null && imageSet == null) { + imageSet = new ImageSet(); + imageSet.add(input); + } } /** @@ -250,7 +259,6 @@ */ public DocuDirectory getFileDirectory() throws FileOpException { if (fileDir == null) { - DocuDirCache dirCache = (DocuDirCache) dlConfig.getValue("servlet.dir.cache"); String fp = getFilePath(); fileDir = dirCache.getDirectory(fp); if (fileDir == null) { @@ -268,8 +276,9 @@ */ public ImageSet getImageSet() throws FileOpException { if (imageSet == null) { - DocuDirCache dirCache = (DocuDirCache) dlConfig.getValue("servlet.dir.cache"); - + if (dirCache == null) { + throw new FileOpException("No DirCache configured!"); + } imageSet = (ImageSet) dirCache.getFile(getFilePath(), getAsInt("pn"), FileClass.IMAGE); if (imageSet == null) { throw new FileOpException("File " + getFilePath() + "(" + getAsInt("pn") + ") not found."); @@ -279,6 +288,16 @@ } /** + * Set the current ImageSet. + * + * @param imageSet + */ + public void setImageSet(ImageSet imageSet) { + this.imageSet = imageSet; + } + + + /** * Returns the file path name from the request. * * @return @@ -667,6 +686,8 @@ } /** + * Set the current docuImage. + * * @param docuImage * the docuImage to set */ diff -r 59d615f4e5f3 -r 247eab96bf04 common/src/main/java/digilib/io/ImageFileSet.java --- a/common/src/main/java/digilib/io/ImageFileSet.java Thu Aug 22 17:14:33 2013 +0200 +++ b/common/src/main/java/digilib/io/ImageFileSet.java Thu Aug 22 17:59:51 2013 +0200 @@ -115,22 +115,6 @@ } /** - * Adds an ImageFile to this Fileset. - * - * The files should be added in the order of higher to lower resolutions. - * The first file is considered the hires "original". - * - * - * @param f - * file to add - * @return true (always) - */ - public boolean add(ImageInput f) { - f.setParent(this); - return list.add(f); - } - - /** * Fill the ImageSet with files from different base directories. * * diff -r 59d615f4e5f3 -r 247eab96bf04 common/src/main/java/digilib/io/ImageSet.java --- a/common/src/main/java/digilib/io/ImageSet.java Thu Aug 22 17:14:33 2013 +0200 +++ b/common/src/main/java/digilib/io/ImageSet.java Thu Aug 22 17:59:51 2013 +0200 @@ -217,4 +217,20 @@ } + /** + * Adds an ImageImput to this ImageSet. + * + * The images should be added in the order of higher to lower resolutions. + * The first image is considered the hires "original". + * + * + * @param f + * ImageInput to add + * @return true (always) + */ + public boolean add(ImageInput f) { + f.setParent(this); + return list.add(f); + } + }