]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5437: Adding nuxeo's thumbnail creation.
authorRichard Millet <remillet@berkeley.edu>
Tue, 7 Aug 2012 23:01:12 +0000 (16:01 -0700)
committerRichard Millet <remillet@berkeley.edu>
Tue, 7 Aug 2012 23:01:12 +0000 (16:01 -0700)
13 files changed:
3rdparty/nuxeo/build.xml
3rdparty/nuxeo/nuxeo-platform-collectionspace/src/main/resources/OSGI-INF/core-types-contrib.xml
3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java [new file with mode: 0644]
3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConstants.java [new file with mode: 0644]
3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConverter.java [moved from services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/ThumbnailConverter.java with 73% similarity]
3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java [new file with mode: 0644]
3rdparty/nuxeo/nuxeo-server/5.5-HF07/bundles/nuxeo-runtime-launcher-5.5.0-HF07.jar [new file with mode: 0644]
3rdparty/nuxeo/pom.xml
services/blob/client/src/test/resources/blobs/01-03-09_1546.jpg [deleted file]
services/blob/client/src/test/resources/blobs/Copy of 01-03-09_1546 [deleted file]
services/blob/client/src/test/resources/blobs/MavenCheatSheet_EL4J.pdf [deleted file]
services/common/pom.xml
services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoImageUtils.java

index 3e5b9ac6fdbb9af54d3f867a2ca97c778b735961..214b10dfa9f7168740e80a03e89104c42c1a2b00 100644 (file)
             </filterset>\r
         </copy>\r
         <ant antfile="nuxeo-platform-collectionspace/build.xml" target="deploy" inheritall="false"/>\r
+        <ant antfile="nuxeo-platform-thumbnail/build.xml" target="deploy" inheritall="false"/>\r
     </target>\r
 \r
     <target name="undeploy"\r
         <ant antfile="nuxeo-platform-collectionspace/build.xml" target="undeploy" inheritall="false"/>\r
                <ant antfile="nuxeo-platform-quote/build.xml" target="undeploy" inheritall="false"/>\r
                <ant antfile="nuxeo-platform-quote-api/build.xml" target="undeploy" inheritall="false"/>\r
+               <ant antfile="nuxeo-platform-thumbnail/build.xml" target="undeploy" inheritall="false"/>\r
     </target>\r
 \r
     <target name="dist"\r
index c6d4461c3385bdd80e4ad4b0eb3dceb6b69f55ce..eeb93c7335fc447189a5f4a24eebba0934b56439 100644 (file)
                        <schema name="subitem" />
                </doctype>
        </extension>
-
-       <!-- Support for creation of document/blob thumbnails.  All of this code was take from the following two
-            blog posts:
-               http://dev.blogs.nuxeo.com/2012/06/qa-friday-thumbnails-pdf-psd-documents.html
-               http://dev.blogs.nuxeo.com/2012/06/monday-dev-heaven-adding-thumbnail-preview-document-content-nuxeo.html
-       -->
-       <extension target="org.nuxeo.ecm.core.schema.TypeService"
-               point="schema">
-               <schema name="thumbnail" src="schemas/thumbnail.xsd" prefix="thumb" />
-       </extension>
-       <extension target="org.nuxeo.ecm.core.schema.TypeService"
-               point="doctype">
-               <facet name="Thumbnail">
-                       <schema name="thumbnail" />
-               </facet>
-       </extension>
-       <extension target="org.nuxeo.ecm.platform.commandline.executor.service.CommandLineExecutorComponent" point="command">
-               <command name="toThumbnail" enabled="true">
-                       <commandLine>convert</commandLine>
-                       <parameterString>-strip -thumbnail 100x100 -background transparent -gravity center -extent 100x100 -format png -quality 75 #{inputFilePath}[0] #{outputFilePath}</parameterString>
-                       <winParameterString>-strip -thumbnail 100x100 -background transparent -gravity center -extent 100x100 -format png -quality 75 #{inputFilePath}[0] #{outputFilePath}</winParameterString>
-                       <installationDirective>You need to install ImageMagick.</installationDirective>
-               </command>
-       </extension>
-       <extension target="org.nuxeo.ecm.core.convert.service.ConversionServiceImpl" point="converter">
-               <converter name="toThumbnail" class="org.collectionspace.services.common.imaging.nuxeo.ThumbnailConverter">
-               </converter>
-       </extension>
 </component>
diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java
new file mode 100644 (file)
index 0000000..c21cd20
--- /dev/null
@@ -0,0 +1,122 @@
+package org.collectionspace.services.nuxeo.extension.thumbnail;
+
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.security.NoSuchAlgorithmException;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuxeo.ecm.core.api.Blob;
+import org.nuxeo.ecm.core.api.ClientException;
+import org.nuxeo.ecm.core.api.CoreSession;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.UnrestrictedSessionRunner;
+import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
+import org.nuxeo.ecm.core.convert.api.ConversionService;
+import org.nuxeo.ecm.platform.filemanager.api.FileManager;
+import org.nuxeo.runtime.api.Framework;
+
+public class AddThumbnailUnrestricted extends UnrestrictedSessionRunner {
+    private static final Log logger = LogFactory
+            .getLog(AddThumbnailUnrestricted.class);
+    protected ConversionService cs;
+    protected DocumentModel doc;
+    protected BlobHolder blobHolder;
+    protected Thumbnail thumbnail = null;
+    public AddThumbnailUnrestricted(CoreSession coreSession, DocumentModel doc,
+            BlobHolder blobHolder) {
+        super(coreSession);
+        this.doc = doc;
+        this.blobHolder = blobHolder;
+    }
+    /*
+     * (non-Javadoc)
+     * @see org.nuxeo.ecm.core.api.UnrestrictedSessionRunner#run()
+     * 
+     * Creates a new thumbnail image and associates it with the document blob by adding a "Thumnail" facet
+     * to the document blob.
+     */
+    @Override
+    public void run() throws ClientException {
+       String errMsg = "Error while adding preview thumbnail.";
+       String documentId = doc.getId();
+       
+        try {
+            Blob blob = blobHolder.getBlob();
+            if (blob != null) {
+                if (doc.hasFacet(ThumbnailConstants.THUMBNAIL_FACET) == false) { // Make sure we don't already have a "Thumbnail" facet
+                       cs = Framework.getService(ConversionService.class);                
+                       ensureModificationDateExists(doc); // For some reason, the ConversionService service requires the modification date of the blob is not null so we need to ensure it is not null. 
+                       BlobHolder thumbnailBlobHolder = cs.convert(ThumbnailConstants.THUMBNAIL_CONVERTER_NAME,
+                               blobHolder, null /*no params*/);
+                       if (thumbnailBlobHolder != null && thumbnailBlobHolder.getBlob() != null) {
+                           Blob thumbnailBlob = thumbnailBlobHolder.getBlob();
+                               doc.addFacet(ThumbnailConstants.THUMBNAIL_FACET); // Add the "Thumbnail" facet since we were able to create a thumnail image
+                               // Give the thumbnail blob a name.
+                           String thumbnailName = documentId + ThumbnailConstants.THUMBNAIL_PROPERTY_NAME;
+                           thumbnailBlobHolder.getBlob().setFilename(thumbnailName); // Give it a name so we can manually search for it in the "nuxeo" database
+                           
+                           doc.setProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME,
+                                   ThumbnailConstants.THUMBNAIL_FILENAME_PROPERTY_NAME,
+                                   (Serializable) thumbnailName);
+                           doc.setProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME,
+                                   ThumbnailConstants.THUMBNAIL_PROPERTY_NAME,
+                                   (Serializable) thumbnailBlob);
+                           //
+                           // Save the new Thumnail facet data (including the new thumbnail image).  The save triggers a new create event and recurses us back to
+                           // this method, but the next time we'll have a Thumbnail facet and bypass this save -sparing us from an infinite event loop.
+                           //
+                           doc = session.saveDocument(doc); 
+                       } else {
+                               logger.warn("Could not create a preview thumbnail image for Nuxeo blob document: " + doc.getId());
+                       }
+                }
+            } else {
+               logger.warn(errMsg + " " + "The Nuxeo blob holder had an empty blob object.  Document ID:" + doc.getId());
+            }
+        } catch (Exception e) {
+            logger.warn(errMsg, e);
+        }
+    }
+    private String computeDigest(FileManager fileManager, Blob blob) throws Exception {
+       String result = null;
+       
+       // Compute the digest
+        result = fileManager.computeDigest(blob); // REM - Warning: Why is this operation so slow?
+        
+        return result;
+    }
+    
+    private String ensureModificationDateExists(DocumentModel docModel) throws Exception {
+        Calendar modificationDate = (Calendar)doc.getProperty("dublincore", "modified");
+        if (modificationDate == null) {
+               // If the 'modified' field is null then try the 'created' field
+               Calendar creationDate = (Calendar)doc.getProperty("dublincore", "created");
+               if (creationDate != null) {
+                       modificationDate = creationDate;
+               } else {
+                       // We *need* a 'modified' date, so let's use the current date
+                       modificationDate = new GregorianCalendar();
+               }
+               doc.setProperty("dublincore", "modified", modificationDate);
+        }
+        
+        return modificationDate.toString();
+    }
+    
+    public Thumbnail getAdapter() {
+        return thumbnail;
+    }
+}
diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConstants.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConstants.java
new file mode 100644 (file)
index 0000000..2a75074
--- /dev/null
@@ -0,0 +1,12 @@
+package org.collectionspace.services.nuxeo.extension.thumbnail;
+
+public class ThumbnailConstants {
+       public static final String THUMBNAIL_SIZE_PARAMETER_NAME = "size";
+       public static final String THUMBNAIL_DEFAULT_SIZE = "200";
+       public static final String THUMBNAIL_FACET = "Thumbnail";
+       public static final String THUMBNAIL_SCHEMA_NAME = "thumbnail";
+       public static final String THUMBNAIL_PROPERTY_NAME = "thumbnail";
+       public static final String THUMBNAIL_DIGEST_PROPERTY_NAME = "digest";
+       public static final String THUMBNAIL_FILENAME_PROPERTY_NAME = "fileName";
+       public static final String THUMBNAIL_CONVERTER_NAME = "toThumbnail";
+}
@@ -1,4 +1,4 @@
-package org.collectionspace.services.common.imaging.nuxeo;
+package org.collectionspace.services.nuxeo.extension.thumbnail;
 
 import java.io.File;
 import java.io.Serializable;
@@ -6,9 +6,11 @@ import java.util.Map;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.nuxeo.ecm.core.api.Blob;
 import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
 import org.nuxeo.ecm.core.api.impl.blob.FileBlob;
+import org.nuxeo.ecm.core.api.impl.blob.StreamingBlob;
 import org.nuxeo.ecm.core.convert.api.ConversionException;
 import org.nuxeo.ecm.core.convert.cache.SimpleCachableBlobHolder;
 import org.nuxeo.ecm.core.convert.extension.Converter;
@@ -19,12 +21,13 @@ import org.nuxeo.ecm.platform.commandline.executor.api.CommandAvailability;
 import org.nuxeo.ecm.platform.commandline.executor.api.CommandLineExecutorService;
 import org.nuxeo.ecm.platform.commandline.executor.api.ExecResult;
 import org.nuxeo.ecm.platform.picture.core.im.IMImageUtils;
+
 import org.nuxeo.runtime.api.Framework;
 import org.nuxeo.runtime.services.streaming.FileSource;
 import org.nuxeo.runtime.services.streaming.StreamSource;
 
 public class ThumbnailConverter extends IMImageUtils implements Converter {
-       private static final Log log = LogFactory.getLog(ThumbnailConverter.class);
+       private static final Log logger = LogFactory.getLog(ThumbnailConverter.class);
 
        @Override
        public BlobHolder convert(BlobHolder blobHolder,
@@ -47,13 +50,27 @@ public class ThumbnailConverter extends IMImageUtils implements Converter {
                                StreamSource source = ((SQLBlob) blob).getBinary()
                                                .getStreamSource();
                                inputFile = ((FileSource) source).getFile();
+                       } else if (blob instanceof StreamingBlob) {
+                               StreamingBlob streamingBlob = ((StreamingBlob) blob);
+                               if (!streamingBlob.isPersistent()) {
+                                       streamingBlob.persist();
+                               }
+                               StreamSource source = streamingBlob.getStreamSource();
+                               inputFile = ((FileSource) source).getFile();
                        }
                        if (inputFile == null) {
-                               return null;
+                               return null; // Add a log message here
                        }
                        CmdParameters params = new CmdParameters();
                        File outputFile = File.createTempFile("nuxeoImageTarget", "."
                                        + "png");
+                       String size = ThumbnailConstants.THUMBNAIL_DEFAULT_SIZE;
+                       if (parameters != null) {
+                               if (parameters.containsKey(ThumbnailConstants.THUMBNAIL_SIZE_PARAMETER_NAME)) {
+                                       size = (String) parameters.get(ThumbnailConstants.THUMBNAIL_SIZE_PARAMETER_NAME);
+                               }
+                       }
+                       params.addNamedParameter(ThumbnailConstants.THUMBNAIL_SIZE_PARAMETER_NAME, size);
                        params.addNamedParameter("inputFilePath", inputFile);
                        params.addNamedParameter("outputFilePath", outputFile);
 
@@ -65,6 +82,7 @@ public class ThumbnailConverter extends IMImageUtils implements Converter {
                        Framework.trackFile(outputFile, targetBlob);
                        return new SimpleCachableBlobHolder(targetBlob);
                } catch (Exception e) {
+                       logger.trace("Could not create a thumbnail image using the Nuxeo conversion service", e);
                        throw new ConversionException("Thumbnail conversion has failed", e);
                }
        }
diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java
new file mode 100644 (file)
index 0000000..fa9e5f2
--- /dev/null
@@ -0,0 +1,43 @@
+package org.collectionspace.services.nuxeo.extension.thumbnail;
+
+import org.nuxeo.ecm.core.api.Blob;
+import org.nuxeo.ecm.core.api.ClientException;
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.blobholder.BlobHolder;
+import org.nuxeo.ecm.core.api.event.DocumentEventTypes;
+import org.nuxeo.ecm.core.event.Event;
+import org.nuxeo.ecm.core.event.EventContext;
+import org.nuxeo.ecm.core.event.EventListener;
+import org.nuxeo.ecm.core.event.impl.DocumentEventContext;
+
+public class UpdateThumbListener implements EventListener {
+    public void handleEvent(Event event) throws ClientException {
+        EventContext ec = event.getContext();
+        if (ec instanceof DocumentEventContext) {
+            DocumentEventContext context = (DocumentEventContext) ec;
+            DocumentModel doc = context.getSourceDocument();
+            if (doc.isDirty() || DocumentEventTypes.DOCUMENT_CREATED.equals(event.getName())) {
+                BlobHolder blobHolder = doc.getAdapter(BlobHolder.class);
+                if (blobHolder != null) {
+                    Blob blob = blobHolder.getBlob();
+                    if (blob != null) {
+                        try {
+                            AddThumbnailUnrestricted runner = new AddThumbnailUnrestricted(
+                                    context.getCoreSession(), doc, blobHolder);
+                            runner.runUnrestricted();
+                            return; // Exit
+                        } catch (Exception e) {
+                            throw new RuntimeException(e);
+                        }
+                    }
+                }
+                // No Blob anymore, remove the facet
+                if (doc.hasFacet(ThumbnailConstants.THUMBNAIL_FACET)) {
+                    doc.removeFacet(ThumbnailConstants.THUMBNAIL_FACET);
+                    context.getCoreSession().saveDocument(doc);
+                }
+            }
+        }
+    }
+}
diff --git a/3rdparty/nuxeo/nuxeo-server/5.5-HF07/bundles/nuxeo-runtime-launcher-5.5.0-HF07.jar b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/bundles/nuxeo-runtime-launcher-5.5.0-HF07.jar
new file mode 100644 (file)
index 0000000..5e1e3b2
Binary files /dev/null and b/3rdparty/nuxeo/nuxeo-server/5.5-HF07/bundles/nuxeo-runtime-launcher-5.5.0-HF07.jar differ
index 7e1c2a73d45bc5413ec2d4e591f8358b4aeb37b3..3ac17551ae9020433c63f59042c963a75cc8fdf5 100644 (file)
@@ -1,36 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
-\r
-    <parent>\r
-        <groupId>org.collectionspace.services</groupId>\r
-        <artifactId>org.collectionspace.services.3rdparty</artifactId>\r
-        <version>2.6-SNAPSHOT</version>\r
-    </parent>\r
-\r
-    <modelVersion>4.0.0</modelVersion>\r
-    <groupId>org.collectionspace.services</groupId>\r
-    <artifactId>org.collectionspace.services.3rdparty.nuxeo</artifactId>\r
-    <packaging>pom</packaging>\r
-    <name>services.3rdparty.nuxeo</name>\r
-\r
-    <modules>\r
-        <module>nuxeo-platform-collectionspace</module>\r
-               <module>nuxeo-platform-quote-api</module>\r
-               <module>nuxeo-platform-quote</module>\r
-    </modules>\r
-\r
-    <dependencies>\r
-        <dependency>\r
-            <groupId>org.osgi</groupId>\r
-            <artifactId>org.osgi.core</artifactId>\r
-            <version>4.1.0</version>\r
-        </dependency>\r
-        <!-- jboss -->\r
-        <dependency>\r
-               <groupId>org.jboss.remoting</groupId>\r
-               <artifactId>jboss-remoting</artifactId>\r
-        <scope>provided</scope>\r
-        </dependency>\r
-    </dependencies>\r
-\r
-</project>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.3rdparty</artifactId>
+        <version>2.6-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.3rdparty.nuxeo</artifactId>
+    <packaging>pom</packaging>
+    <name>services.3rdparty.nuxeo</name>
+
+    <modules>
+        <module>nuxeo-platform-collectionspace</module>
+               <module>nuxeo-platform-quote-api</module>
+               <module>nuxeo-platform-quote</module>
+               <module>nuxeo-platform-thumbnail</module>
+       </modules>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>4.1.0</version>
+        </dependency>
+        <!-- jboss -->
+        <dependency>
+               <groupId>org.jboss.remoting</groupId>
+               <artifactId>jboss-remoting</artifactId>
+        <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file
diff --git a/services/blob/client/src/test/resources/blobs/01-03-09_1546.jpg b/services/blob/client/src/test/resources/blobs/01-03-09_1546.jpg
deleted file mode 100644 (file)
index 15b559c..0000000
Binary files a/services/blob/client/src/test/resources/blobs/01-03-09_1546.jpg and /dev/null differ
diff --git a/services/blob/client/src/test/resources/blobs/Copy of 01-03-09_1546 b/services/blob/client/src/test/resources/blobs/Copy of 01-03-09_1546
deleted file mode 100644 (file)
index 15b559c..0000000
Binary files a/services/blob/client/src/test/resources/blobs/Copy of 01-03-09_1546 and /dev/null differ
diff --git a/services/blob/client/src/test/resources/blobs/MavenCheatSheet_EL4J.pdf b/services/blob/client/src/test/resources/blobs/MavenCheatSheet_EL4J.pdf
deleted file mode 100644 (file)
index 1383b92..0000000
Binary files a/services/blob/client/src/test/resources/blobs/MavenCheatSheet_EL4J.pdf and /dev/null differ
index 5b3123691ab751d47026ff35ac1e8d8d1639d8d7..de16bbbfaf1cfd85025f26df37a886b926f245c1 100644 (file)
             <artifactId>org.collectionspace.services.config</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>        \r
+        <dependency>\r
+            <groupId>org.collectionspace.services</groupId>\r
+            <artifactId>org.collectionspace.services.3rdparty.nuxeo.thumbnail</artifactId>\r
+            <version>${project.version}</version>\r
+        </dependency>        \r
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.common-api</artifactId>\r
index ff9b10ee69682b4fe589d9b0c37670ef3ae6b232..c1826caed0d7d667b5069fce5986c856fb4f1d33 100644 (file)
@@ -107,6 +107,7 @@ import org.collectionspace.services.blob.MeasuredPartGroupList;
 //import org.collectionspace.services.blob.BlobsCommonList.BlobListItem;\r
 import org.collectionspace.services.jaxb.BlobJAXBSchema;\r
 import org.collectionspace.services.nuxeo.client.java.CommonList;\r
+import org.collectionspace.services.nuxeo.extension.thumbnail.ThumbnailConstants;\r
 import org.collectionspace.services.common.blob.BlobOutput;\r
 \r
 import org.collectionspace.services.config.service.ListResultField;\r
@@ -398,6 +399,29 @@ public class NuxeoImageUtils {
                        if (measuredPartGroupList != null) {\r
                                result.setMeasuredPartGroupList(measuredPartGroupList);\r
                        }\r
+                       \r
+                       // Check to see if a thumbnail preview was created by Nuxeo\r
+            if (documentModel.hasFacet(ThumbnailConstants.THUMBNAIL_FACET)) {\r
+                       String errorMsg = null;\r
+               String thumbnailName = null;\r
+                               try {\r
+                                       thumbnailName = (String)documentModel.getProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME,\r
+                                               ThumbnailConstants.THUMBNAIL_FILENAME_PROPERTY_NAME);\r
+                                       Blob thumbnailBlob = (Blob)documentModel.getProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME,\r
+                                               ThumbnailConstants.THUMBNAIL_PROPERTY_NAME);\r
+                               } catch (ClientException e) {\r
+                                       errorMsg = "Could not extract the name of the thumbnail preview image file.";\r
+                                       if (logger.isTraceEnabled()) {\r
+                                               logger.trace(errorMsg, e);\r
+                                       }\r
+                               }\r
+                               \r
+                               if (errorMsg == null) {\r
+                                       logger.info("A thumbnail preview was created for this document blob: " + thumbnailName);\r
+                               } else {\r
+                                       logger.warn(errorMsg);\r
+                               }\r
+            }\r
                }\r
 \r
                return result;\r