From f78f18fdb7c5adf88192d17be5dbd04706f07fc2 Mon Sep 17 00:00:00 2001 From: Ray Gauss Date: Wed, 10 Oct 2012 16:42:31 +0000 Subject: [PATCH] Merged BRANCHES/DEV/V4.1-BUG-FIX to HEAD: 42476: ALF-5051: Define ThumbnailDefinition Beans Outside of ThumbnailRegistry Bean - Created defaultImageResizeOptions abstract bean for common properties - Changed system.thumbnail.definition.doclib.* to system.thumbnail.definition.default.* in repository.properties - Created defaultImageTransformationOptions abstract bean for common properties defined by system.thumbnail.definition.default.* in repository.properties - Created thumbnail definition beans with ids outside of the thumbnailRegistry with defaultImageTransformationOptions and defaultImageResizeOptions - Added thumbnailRegistry property to ThumbnailDefinition and register method which calls thumbnailRegistry.addThumbnailDefinition(this) - Added baseThumbnailDefinition bean with init-method="register" but did not yet make it the parent of the thumbnail definitions for backwards compatibility - Changed thumbnailRegistry thumbnailDefinitions list to reference thumbnail definition beans from above, also for backwards compatibility git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42486 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/repository.properties | 17 +- config/alfresco/thumbnail-service-context.xml | 279 ++++++++++-------- .../repo/thumbnail/ThumbnailDefinition.java | 47 ++- 3 files changed, 206 insertions(+), 137 deletions(-) diff --git a/config/alfresco/repository.properties b/config/alfresco/repository.properties index 27e7b381dd..8a3b6054b7 100644 --- a/config/alfresco/repository.properties +++ b/config/alfresco/repository.properties @@ -554,15 +554,14 @@ swf.languagedir=. # Thumbnail Service system.thumbnail.generate=true -# Generate doclib icons -# When creating a doclib icon, only use the first pageLimit pages (currently only understood by pdfbox -# TextToPdfContentTransformer) -system.thumbnail.definition.doclib.timeoutMs=-1 -system.thumbnail.definition.doclib.readLimitTimeMs=-1 -system.thumbnail.definition.doclib.maxSourceSizeKBytes=-1 -system.thumbnail.definition.doclib.readLimitKBytes=-1 -system.thumbnail.definition.doclib.pageLimit=1 -system.thumbnail.definition.doclib.maxPages=-1 +# Default thumbnail limits +# When creating thumbnails, only use the first pageLimit pages +system.thumbnail.definition.default.timeoutMs=-1 +system.thumbnail.definition.default.readLimitTimeMs=-1 +system.thumbnail.definition.default.maxSourceSizeKBytes=-1 +system.thumbnail.definition.default.readLimitKBytes=-1 +system.thumbnail.definition.default.pageLimit=1 +system.thumbnail.definition.default.maxPages=-1 # Max mimetype sizes to create thumbnail icons system.thumbnail.mimetype.maxSourceSizeKBytes.pdf=-1 diff --git a/config/alfresco/thumbnail-service-context.xml b/config/alfresco/thumbnail-service-context.xml index 52374bd5a3..e8bcc6f4b7 100644 --- a/config/alfresco/thumbnail-service-context.xml +++ b/config/alfresco/thumbnail-service-context.xml @@ -53,6 +53,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -61,133 +207,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + diff --git a/source/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java b/source/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java index 597a77c8a3..2248f3ad60 100644 --- a/source/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java +++ b/source/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Alfresco Software Limited. + * Copyright (C) 2005-2012 Alfresco Software Limited. * * This file is part of Alfresco * @@ -18,6 +18,9 @@ */ package org.alfresco.repo.thumbnail; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.alfresco.service.cmr.repository.TransformationOptions; /** @@ -27,6 +30,9 @@ import org.alfresco.service.cmr.repository.TransformationOptions; */ public class ThumbnailDefinition { + + private static final Log logger = LogFactory.getLog(ThumbnailDefinition.class); + /** Name of the thumbnail */ private String name; @@ -50,6 +56,9 @@ public class ThumbnailDefinition /** Username to run the thumbnailrendition as */ private String runAs; + /** The thumbnail registry */ + private ThumbnailRegistry thumbnailRegistry; + /** * Default constructor */ @@ -225,4 +234,40 @@ public class ThumbnailDefinition { return mimeAwarePlaceHolderResourcePath; } + + /** + * Gets the thumbnail registry + * + * @return the thumbnail registry + */ + public ThumbnailRegistry getThumbnailRegistry() + { + return thumbnailRegistry; + } + + /** + * Sets the thumbnail registry + * + * @param thumbnailRegistry + */ + public void setThumbnailRegistry(ThumbnailRegistry thumbnailRegistry) + { + this.thumbnailRegistry = thumbnailRegistry; + } + + /** + * Registers the thumbnail definition with the thumbnail registry. + * + * @see #setThumbnailRegistry(ThumbnailRegistry) + */ + public void register() + { + if (thumbnailRegistry == null) + { + logger.warn("Property 'thumbnailRegistry' has not been set. Ignoring auto-registration: \n" + + " extracter: " + this); + return; + } + thumbnailRegistry.addThumbnailDefinition(this); + } }