diff --git a/pom.xml b/pom.xml index e4d53d1163..4bc71b8067 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ 6.2 7.4 6.1 - 8.10 + 8.15 7.1 1.1 1.0.9 diff --git a/src/main/java/org/alfresco/opencmis/CMISConnector.java b/src/main/java/org/alfresco/opencmis/CMISConnector.java index 318e566fcd..c6be813f26 100644 --- a/src/main/java/org/alfresco/opencmis/CMISConnector.java +++ b/src/main/java/org/alfresco/opencmis/CMISConnector.java @@ -309,6 +309,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen private CheckOutCheckInService checkOutCheckInService; private LockService lockService; private ContentService contentService; + @Deprecated private RenditionService renditionService; private FileFolderService fileFolderService; private TenantAdminService tenantAdminService; @@ -327,6 +328,7 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen private DictionaryService dictionaryService; private SiteService siteService; private ActionService actionService; + @Deprecated private ThumbnailService thumbnailService; private ServiceRegistry serviceRegistry; private EventPublisher eventPublisher; @@ -498,6 +500,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen return openHttpSession; } + /** + * + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void setThumbnailService(ThumbnailService thumbnailService) { this.thumbnailService = thumbnailService; @@ -614,7 +622,10 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen /** * Sets the rendition service. + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ + @Deprecated public void setrenditionService(RenditionService renditionService) { this.renditionService = renditionService; @@ -4079,7 +4090,12 @@ public class CMISConnector implements ApplicationContextAware, ApplicationListen return result; } - + + /** + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ + @Deprecated private CMISRenditionMapping getRenditionMapping() { CMISRenditionMapping renditionMapping = (CMISRenditionMapping)singletonCache.get(KEY_CMIS_RENDITION_MAPPING_NODEREF); diff --git a/src/main/java/org/alfresco/opencmis/CMISRenditionMapping.java b/src/main/java/org/alfresco/opencmis/CMISRenditionMapping.java index d84cef7b57..8c2e1ebbe6 100644 --- a/src/main/java/org/alfresco/opencmis/CMISRenditionMapping.java +++ b/src/main/java/org/alfresco/opencmis/CMISRenditionMapping.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.opencmis; import java.io.Serializable; @@ -53,6 +53,11 @@ import org.apache.chemistry.opencmis.commons.data.RenditionData; import org.apache.chemistry.opencmis.commons.exceptions.CmisFilterNotValidException; import org.apache.chemistry.opencmis.commons.impl.dataobjects.RenditionDataImpl; +/** + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ +@Deprecated public class CMISRenditionMapping { private NodeService nodeService; diff --git a/src/main/java/org/alfresco/repo/content/AbstractContentReader.java b/src/main/java/org/alfresco/repo/content/AbstractContentReader.java index b4ae420a36..c117bbb3e9 100644 --- a/src/main/java/org/alfresco/repo/content/AbstractContentReader.java +++ b/src/main/java/org/alfresco/repo/content/AbstractContentReader.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content; import java.io.BufferedInputStream; @@ -82,9 +82,11 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl private ReadableByteChannel channel; // Optional limits on reading + @Deprecated private TransformationOptionLimits limits; // Only needed if limits are set + @Deprecated private TransformerDebug transformerDebug; // For testing: Allows buffering to be turned off @@ -100,22 +102,44 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl listeners = new ArrayList(2); } - + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void setLimits(TransformationOptionLimits limits) { this.limits = limits; } - + + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public TransformationOptionLimits getLimits() { return limits; } + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void setTransformerDebug(TransformerDebug transformerDebug) { this.transformerDebug = transformerDebug; } + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public TransformerDebug getTransformerDebug() { return transformerDebug; @@ -448,7 +472,7 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl e); } } - + public final String getContentString(int length) throws ContentIOException { if (length < 0 || length > Integer.MAX_VALUE) @@ -567,7 +591,7 @@ public abstract class AbstractContentReader extends AbstractContentAccessor impl * InputStream that wraps another InputStream to terminate early after a timeout * or after reading a number of bytes. It terminates by either returning end of file * (-1) or throwing an IOException. - + * * @author Alan Davis */ private class TimeSizeRestrictedInputStream extends InputStream diff --git a/src/main/java/org/alfresco/repo/content/ContentServiceImpl.java b/src/main/java/org/alfresco/repo/content/ContentServiceImpl.java index ac1f84aab1..d740654cf4 100644 --- a/src/main/java/org/alfresco/repo/content/ContentServiceImpl.java +++ b/src/main/java/org/alfresco/repo/content/ContentServiceImpl.java @@ -1,82 +1,82 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content; -import java.io.File; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.repo.content.ContentServicePolicies.OnContentPropertyUpdatePolicy; -import org.alfresco.repo.content.ContentServicePolicies.OnContentReadPolicy; -import org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy; -import org.alfresco.repo.content.cleanup.EagerContentStoreCleaner; -import org.alfresco.repo.content.filestore.FileContentStore; -import org.alfresco.repo.content.filestore.FileContentWriter; -import org.alfresco.repo.content.transform.ContentTransformer; -import org.alfresco.repo.content.transform.ContentTransformerRegistry; -import org.alfresco.repo.content.transform.TransformerDebug; -import org.alfresco.repo.content.transform.UnimportantTransformException; -import org.alfresco.repo.content.transform.UnsupportedTransformationException; -import org.alfresco.repo.node.NodeServicePolicies; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.JavaBehaviour; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.dictionary.InvalidTypeException; -import org.alfresco.service.cmr.dictionary.PropertyDefinition; -import org.alfresco.service.cmr.repository.ContentData; -import org.alfresco.service.cmr.repository.ContentIOException; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.MimetypeService; -import org.alfresco.service.cmr.repository.MimetypeServiceAware; -import org.alfresco.service.cmr.repository.NoTransformerException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.TransformationOptions; -import org.alfresco.service.cmr.usage.ContentQuotaException; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.EqualsHelper; -import org.alfresco.util.TempFileProvider; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.extensions.surf.util.I18NUtil; +import java.io.File; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.ContentServicePolicies.OnContentPropertyUpdatePolicy; +import org.alfresco.repo.content.ContentServicePolicies.OnContentReadPolicy; +import org.alfresco.repo.content.ContentServicePolicies.OnContentUpdatePolicy; +import org.alfresco.repo.content.cleanup.EagerContentStoreCleaner; +import org.alfresco.repo.content.filestore.FileContentStore; +import org.alfresco.repo.content.filestore.FileContentWriter; +import org.alfresco.repo.content.transform.ContentTransformer; +import org.alfresco.repo.content.transform.ContentTransformerRegistry; +import org.alfresco.repo.content.transform.TransformerDebug; +import org.alfresco.repo.content.transform.UnimportantTransformException; +import org.alfresco.repo.content.transform.UnsupportedTransformationException; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.ClassPolicyDelegate; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.dictionary.InvalidTypeException; +import org.alfresco.service.cmr.dictionary.PropertyDefinition; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentIOException; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.MimetypeService; +import org.alfresco.service.cmr.repository.MimetypeServiceAware; +import org.alfresco.service.cmr.repository.NoTransformerException; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.service.cmr.usage.ContentQuotaException; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.EqualsHelper; +import org.alfresco.util.TempFileProvider; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.extensions.surf.util.I18NUtil; /** * Service implementation acting as a level of indirection between the client @@ -98,10 +98,12 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa private MimetypeService mimetypeService; private RetryingTransactionHelper transactionHelper; private ApplicationContext applicationContext; + @Deprecated protected TransformerDebug transformerDebug; /** a registry of all available content transformers */ + @Deprecated private ContentTransformerRegistry transformerRegistry; /** The cleaner that will ensure that rollbacks clean up after themselves */ private EagerContentStoreCleaner eagerContentStoreCleaner; @@ -109,6 +111,7 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa private ContentStore store; /** the store for all temporarily created content */ private ContentStore tempStore; + @Deprecated private ContentTransformer imageMagickContentTransformer; /** Should we consider zero byte content to be the same as no content? */ private boolean ignoreEmptyContent; @@ -145,7 +148,11 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa { this.mimetypeService = mimetypeService; } - + + /** + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void setTransformerRegistry(ContentTransformerRegistry transformerRegistry) { this.transformerRegistry = transformerRegistry; @@ -165,7 +172,12 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa { this.policyComponent = policyComponent; } - + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void setImageMagickContentTransformer(ContentTransformer imageMagickContentTransformer) { this.imageMagickContentTransformer = imageMagickContentTransformer; @@ -182,7 +194,10 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa * of the transformer must go to a temporary file in case it fails. * @param transformerFailover {@code true} (the default) indicate * that fail over should take place. + * @deprecated The transformations code is being moved out of the codebase and replaced by the + * new async RenditionService2 or other external libraries. */ + @Deprecated public void setTransformerFailover(boolean transformerFailover) { this.transformerFailover = transformerFailover; @@ -199,7 +214,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * Helper setter of the transformer debug. * @param transformerDebug TransformerDebug + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public void setTransformerDebug(TransformerDebug transformerDebug) { this.transformerDebug = transformerDebug; @@ -551,7 +568,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * @see org.alfresco.repo.content.transform.ContentTransformer * @see org.alfresco.service.cmr.repository.ContentService#transform(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter) + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public void transform(ContentReader reader, ContentWriter writer) { // Call transform with no options @@ -563,7 +582,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * @see org.alfresco.repo.content.transform.ContentTransformer * @deprecated - */ + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public void transform(ContentReader reader, ContentWriter writer, Map options) throws NoTransformerException, ContentIOException { @@ -573,7 +594,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * @see org.alfresco.repo.content.transform.ContentTransformer + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public void transform(ContentReader reader, ContentWriter writer, TransformationOptions options) throws NoTransformerException, ContentIOException { @@ -627,6 +650,11 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa } } + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated private void failoverTransformers(ContentReader reader, ContentWriter writer, TransformationOptions options, String targetMimetype, List transformers) @@ -747,12 +775,19 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * @see org.alfresco.repo.content.transform.ContentTransformer + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype) { return getTransformer(null, sourceMimetype, -1, targetMimetype, new TransformationOptions()); } - + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype, TransformationOptions options) { return getTransformer(null, sourceMimetype, -1, targetMimetype, options); @@ -760,7 +795,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.service.cmr.repository.ContentService#getTransformer(String, java.lang.String, long, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions) + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public ContentTransformer getTransformer(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options) { List transformers = getTransformers(sourceUrl, sourceMimetype, sourceSize, targetMimetype, options); @@ -769,7 +806,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.service.cmr.repository.ContentService#getTransformers(String, java.lang.String, long, java.lang.String, org.alfresco.service.cmr.repository.TransformationOptions) + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public List getTransformers(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options) { try @@ -790,7 +829,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa * Checks if the file just uploaded into Share is a special "debugTransformers.txt" file and * if it is creates TransformerDebug that lists all the supported mimetype transformation for * each transformer. + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated private void debugTransformations(String sourceMimetype, String targetMimetype, long sourceSize, TransformationOptions transformOptions) { @@ -809,7 +850,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * {@inheritDoc} + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public long getMaxSourceSizeBytes(String sourceMimetype, String targetMimetype, TransformationOptions options) { try @@ -845,12 +888,22 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa transformerDebug.popAvailable(); } } - + + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public List getActiveTransformers(String sourceMimetype, String targetMimetype, TransformationOptions options) { return getActiveTransformers(sourceMimetype, -1, targetMimetype, options); } + /** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ + @Deprecated public List getActiveTransformers(String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options) { return transformerRegistry.getActiveTransformers(sourceMimetype, sourceSize, targetMimetype, options); @@ -858,7 +911,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.service.cmr.repository.ContentService#getImageTransformer() + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public ContentTransformer getImageTransformer() { return imageMagickContentTransformer; @@ -867,7 +922,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * @see org.alfresco.repo.content.transform.ContentTransformer + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public boolean isTransformable(ContentReader reader, ContentWriter writer) { return isTransformable(reader, writer, new TransformationOptions()); @@ -875,7 +932,9 @@ public class ContentServiceImpl implements ContentService, ApplicationContextAwa /** * @see org.alfresco.service.cmr.repository.ContentService#isTransformable(org.alfresco.service.cmr.repository.ContentReader, org.alfresco.service.cmr.repository.ContentWriter, org.alfresco.service.cmr.repository.TransformationOptions) + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated public boolean isTransformable(ContentReader reader, ContentWriter writer, TransformationOptions options) { // check that source and target mimetypes are available diff --git a/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformer2.java b/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformer2.java index 779b658f88..0b6a8f5089 100644 --- a/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformer2.java +++ b/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformer2.java @@ -58,7 +58,10 @@ import org.apache.commons.logging.LogFactory; * * @author Derek Hulley * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public abstract class AbstractContentTransformer2 extends AbstractContentTransformerLimits { diff --git a/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimits.java b/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimits.java index 2256275e5b..15590e5bd8 100644 --- a/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimits.java +++ b/src/main/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimits.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_MAX_PAGES; @@ -52,7 +52,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * c) for the {@link TransformationOptions} provided for a specific transform. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public abstract class AbstractContentTransformerLimits extends ContentTransformerHelper implements ContentTransformer { diff --git a/src/main/java/org/alfresco/repo/content/transform/AbstractRemoteContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/AbstractRemoteContentTransformer.java index 16d2c92e81..066bea2423 100644 --- a/src/main/java/org/alfresco/repo/content/transform/AbstractRemoteContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/AbstractRemoteContentTransformer.java @@ -36,7 +36,10 @@ import org.apache.commons.logging.Log; /** * Optionally sends transformations to a remote transformer if a {@link RemoteTransformerClient} is set and * the ".url" Alfresco global property is set. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class AbstractRemoteContentTransformer extends AbstractContentTransformer2 { private RemoteTransformerClient remoteTransformerClient; diff --git a/src/main/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformer.java index e5d00ca4f2..3d50cdccc4 100644 --- a/src/main/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformer.java @@ -48,7 +48,10 @@ import java.util.List; * * @author Neil Mc Erlean * @since 4.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class AppleIWorksContentTransformer extends AbstractContentTransformer2 { private static final Log log = LogFactory.getLog(AppleIWorksContentTransformer.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/ArchiveContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/ArchiveContentTransformer.java index 71482909eb..cfa5c27fc3 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ArchiveContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/ArchiveContentTransformer.java @@ -52,7 +52,10 @@ import org.apache.tika.parser.pkg.PackageParser; * @author Neil McErlean * @author Nick Burch * @since 3.4 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ArchiveContentTransformer extends TikaPoweredContentTransformer { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformer.java index f5cbc23968..bb33bcb7da 100644 --- a/src/main/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.service.cmr.repository.ContentReader; @@ -41,7 +41,10 @@ import org.apache.commons.logging.LogFactory; * @see org.alfresco.repo.content.transform.StringExtractingContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class BinaryPassThroughContentTransformer extends AbstractContentTransformer2 { @SuppressWarnings("unused") diff --git a/src/main/java/org/alfresco/repo/content/transform/ComplexContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/ComplexContentTransformer.java index 8e907a4820..5bf9538de4 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ComplexContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/ComplexContentTransformer.java @@ -57,7 +57,10 @@ import org.springframework.beans.factory.InitializingBean; * in order to accomplish its goal. * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ComplexContentTransformer extends AbstractContentTransformer2 implements InitializingBean { diff --git a/src/main/java/org/alfresco/repo/content/transform/ContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/ContentTransformer.java index f06a813544..ab9fc731b3 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/ContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.List; @@ -39,7 +39,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * Interface for class that allow content transformation from one mimetype to another. * * @author Derek Hulley + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated @AlfrescoPublicApi public interface ContentTransformer extends ContentWorker { @@ -138,10 +141,10 @@ public interface ContentTransformer extends ContentWorker public long getTransformationTime(String sourceMimetype, String targetMimetype); /** - * @see #transform(ContentReader, ContentWriter, TransformationOptions) + * @see #transform(ContentReader, ContentWriter, TransformationOptions) * - * @deprecated - * Deprecated use {link {@link #transform(ContentReader, ContentWriter, TransformationOptions)}. + * @deprecated + * Deprecated use {link {@link #transform(ContentReader, ContentWriter, TransformationOptions)}. */ public void transform(ContentReader reader, ContentWriter writer) throws ContentIOException; diff --git a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java index 67d061809c..e667d1018e 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java +++ b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerHelper.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -44,7 +44,10 @@ import org.springframework.beans.factory.BeanNameAware; * A class providing basic functionality shared by both {@link ContentTransformer}s and {@link ContentTransformerWorker}s. * * @author dward + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ContentTransformerHelper implements BeanNameAware { @@ -448,4 +451,4 @@ public class ContentTransformerHelper implements BeanNameAware suffixAndValue; } } -} +} diff --git a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerRegistry.java b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerRegistry.java index 15508ce697..164f3f29b2 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerRegistry.java +++ b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerRegistry.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.ArrayList; @@ -47,7 +47,10 @@ import org.apache.commons.logging.LogFactory; * @see org.alfresco.repo.content.transform.ContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ContentTransformerRegistry { @@ -56,13 +59,13 @@ public class ContentTransformerRegistry private final List transformers; private final List allTransformers; - private final TransformerSelector transformerSelector; - - /** - * @param transformerSelector Transformer selector - */ - public ContentTransformerRegistry(TransformerSelector transformerSelector) - { + private final TransformerSelector transformerSelector; + + /** + * @param transformerSelector Transformer selector + */ + public ContentTransformerRegistry(TransformerSelector transformerSelector) + { this.transformerSelector = transformerSelector; this.transformers = new ArrayList(70); this.allTransformers = new ArrayList(70); @@ -202,13 +205,13 @@ public class ContentTransformerRegistry throw new UnsupportedOperationException(); } - /** - * A key for a combination of a source and target mimetype - * - * Deprecated since 3.0 - */ - @Deprecated - public static class TransformationKey + /** + * A key for a combination of a source and target mimetype + * + * Deprecated since 3.0 + */ + @Deprecated + public static class TransformationKey { private final String sourceMimetype; private final String targetMimetype; diff --git a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerWorker.java b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerWorker.java index 734b1b9bd2..f02d9084ea 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ContentTransformerWorker.java +++ b/src/main/java/org/alfresco/repo/content/transform/ContentTransformerWorker.java @@ -35,8 +35,11 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * performing the transformation. * * @author dward + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ // TODO Modify ContentTransformerWorker to understand transformer limits. At the moment no workers use them +@Deprecated @AlfrescoPublicApi public interface ContentTransformerWorker { diff --git a/src/main/java/org/alfresco/repo/content/transform/DoubleMap.java b/src/main/java/org/alfresco/repo/content/transform/DoubleMap.java index f64cb292b7..397d38bdbf 100644 --- a/src/main/java/org/alfresco/repo/content/transform/DoubleMap.java +++ b/src/main/java/org/alfresco/repo/content/transform/DoubleMap.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.Map; @@ -62,7 +62,9 @@ import java.util.concurrent.ConcurrentHashMap; * * * @author Alan Davis + * */ +@Deprecated public class DoubleMap { private final Map> mapMap = new ConcurrentHashMap>(); diff --git a/src/main/java/org/alfresco/repo/content/transform/EMLTransformer.java b/src/main/java/org/alfresco/repo/content/transform/EMLTransformer.java index 51332e7aea..0f35026afd 100644 --- a/src/main/java/org/alfresco/repo/content/transform/EMLTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/EMLTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; @@ -53,7 +53,10 @@ import org.alfresco.util.TempFileProvider; * parser. Would require a recursing parser to be specified, but not the full * Auto one (we don't want attachments), just one containing text and html * related parsers. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class EMLTransformer extends AbstractContentTransformer2 { diff --git a/src/main/java/org/alfresco/repo/content/transform/EncodingAwareStringBean.java b/src/main/java/org/alfresco/repo/content/transform/EncodingAwareStringBean.java index 5d61696f3f..a203d71ec3 100644 --- a/src/main/java/org/alfresco/repo/content/transform/EncodingAwareStringBean.java +++ b/src/main/java/org/alfresco/repo/content/transform/EncodingAwareStringBean.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.File; @@ -40,7 +40,10 @@ import org.htmlparser.util.ParserException; * This allows us to correctly handle HTML files where the encoding * is specified against the content property (rather than in the * HTML Head Meta), see ALF-10466 for details. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated class EncodingAwareStringBean extends StringBean { private static final long serialVersionUID = -9033414360428669553L; diff --git a/src/main/java/org/alfresco/repo/content/transform/ExplictTransformationDetails.java b/src/main/java/org/alfresco/repo/content/transform/ExplictTransformationDetails.java index 2a506fe524..dcad7d7a88 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ExplictTransformationDetails.java +++ b/src/main/java/org/alfresco/repo/content/transform/ExplictTransformationDetails.java @@ -23,22 +23,25 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.repo.content.transform; - -/** - * Specifies transformations that are considered to be 'exceptional' so - * should be used in preference to other transformers that can perform - * the same transformation. - */ -public class ExplictTransformationDetails extends SupportedTransformation -{ - public ExplictTransformationDetails() - { - super(); - } - - public ExplictTransformationDetails(String sourceMimetype, String targetMimetype) - { - super(sourceMimetype, targetMimetype); - } +package org.alfresco.repo.content.transform; + +/** + * Specifies transformations that are considered to be 'exceptional' so + * should be used in preference to other transformers that can perform + * the same transformation. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated +public class ExplictTransformationDetails extends SupportedTransformation +{ + public ExplictTransformationDetails() + { + super(); + } + + public ExplictTransformationDetails(String sourceMimetype, String targetMimetype) + { + super(sourceMimetype, targetMimetype); + } } \ No newline at end of file diff --git a/src/main/java/org/alfresco/repo/content/transform/FailoverContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/FailoverContentTransformer.java index 760237e020..c6a3ada242 100644 --- a/src/main/java/org/alfresco/repo/content/transform/FailoverContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/FailoverContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.File; @@ -48,7 +48,10 @@ import org.springframework.beans.factory.InitializingBean; *

Transformers are considered to have failed of they throw an exception. * * @author Neil McErlean + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class FailoverContentTransformer extends AbstractContentTransformer2 implements InitializingBean { diff --git a/src/main/java/org/alfresco/repo/content/transform/HtmlParserContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/HtmlParserContentTransformer.java index 0521eae7c3..6443cf7c81 100644 --- a/src/main/java/org/alfresco/repo/content/transform/HtmlParserContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/HtmlParserContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.File; @@ -50,15 +50,18 @@ import org.apache.commons.logging.LogFactory; *

* Tika Note - could be converted to use the Tika HTML parser, * but we'd potentially need a custom text handler to replicate - * the current settings around links and non-breaking spaces. - *

- * - * @see http://htmlparser.sourceforge.net - * @see org.htmlparser.beans.StringBean - * @see HTML Parser - * - * @author Derek Hulley - */ + * the current settings around links and non-breaking spaces. + *

+ * + * @see http://htmlparser.sourceforge.net + * @see org.htmlparser.beans.StringBean + * @see HTML Parser + * + * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated public class HtmlParserContentTransformer extends AbstractContentTransformer2 { @SuppressWarnings("unused") diff --git a/src/main/java/org/alfresco/repo/content/transform/JodContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/JodContentTransformer.java index 793c915e30..3ec51b5e59 100644 --- a/src/main/java/org/alfresco/repo/content/transform/JodContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/JodContentTransformer.java @@ -40,7 +40,10 @@ import java.io.File; * OpenOffice application to perform OpenOffice-driven conversions. * * @author Neil McErlean + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class JodContentTransformer extends OOoContentTransformerHelper implements ContentTransformerWorker, InitializingBean { private static Log logger = LogFactory.getLog(JodContentTransformer.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/LogEntries.java b/src/main/java/org/alfresco/repo/content/transform/LogEntries.java index 8e6190611b..cefed5f35d 100644 --- a/src/main/java/org/alfresco/repo/content/transform/LogEntries.java +++ b/src/main/java/org/alfresco/repo/content/transform/LogEntries.java @@ -23,18 +23,21 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.repo.content.transform; - -import org.apache.commons.logging.Log; - -/** - * Interface that gives access to Log entries - */ -interface LogEntries extends Log -{ - /** - * Returns the log entries. - * @param n the maximum number of entries to return. All if n is smaller or equal to zero. - */ - public abstract String[] getEntries(int n); +package org.alfresco.repo.content.transform; + +import org.apache.commons.logging.Log; + +/** + * Interface that gives access to Log entries + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated +interface LogEntries extends Log +{ + /** + * Returns the log entries. + * @param n the maximum number of entries to return. All if n is smaller or equal to zero. + */ + public abstract String[] getEntries(int n); } \ No newline at end of file diff --git a/src/main/java/org/alfresco/repo/content/transform/MailContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/MailContentTransformer.java index e538dff71a..9caffe2a5c 100644 --- a/src/main/java/org/alfresco/repo/content/transform/MailContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/MailContentTransformer.java @@ -35,7 +35,10 @@ import org.apache.tika.parser.microsoft.OfficeParser; * Outlook email msg files. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class MailContentTransformer extends TikaPoweredContentTransformer { public MailContentTransformer() { diff --git a/src/main/java/org/alfresco/repo/content/transform/MediaWikiContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/MediaWikiContentTransformer.java index 76001666cb..4b0d4b4445 100644 --- a/src/main/java/org/alfresco/repo/content/transform/MediaWikiContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/MediaWikiContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import info.bliki.wiki.filter.Encoder; @@ -51,7 +51,10 @@ import org.htmlcleaner.ContentToken; * transformer cannot currently be converted to use Tika. * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class MediaWikiContentTransformer extends AbstractContentTransformer2 { /** The file folder service */ diff --git a/src/main/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformer.java index 8c105eab02..0410b72a33 100644 --- a/src/main/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.File; @@ -52,7 +52,10 @@ import org.apache.poi.openxml4j.opc.PackageRelationshipTypes; * * @author Nick Burch * @since 4.0.1 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class OOXMLThumbnailContentTransformer extends AbstractContentTransformer2 { public static final String NO_THUMBNAIL_PRESENT_IN_FILE = "No thumbnail present in file, unable to generate "; diff --git a/src/main/java/org/alfresco/repo/content/transform/OOoContentTransformerHelper.java b/src/main/java/org/alfresco/repo/content/transform/OOoContentTransformerHelper.java index a9384597a4..b693ac49ca 100644 --- a/src/main/java/org/alfresco/repo/content/transform/OOoContentTransformerHelper.java +++ b/src/main/java/org/alfresco/repo/content/transform/OOoContentTransformerHelper.java @@ -49,7 +49,10 @@ import java.io.*; /** * A class providing basic OOo-related functionality shared by both * {@link ContentTransformer}s and {@link ContentTransformerWorker}s. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class OOoContentTransformerHelper extends ContentTransformerHelper { private String documentFormatsConfiguration; diff --git a/src/main/java/org/alfresco/repo/content/transform/PdfBoxContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/PdfBoxContentTransformer.java index cdccc18b47..25158a36d7 100644 --- a/src/main/java/org/alfresco/repo/content/transform/PdfBoxContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/PdfBoxContentTransformer.java @@ -44,7 +44,10 @@ import org.apache.tika.parser.pdf.PDFParserConfig; * * @author Nick Burch * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PdfBoxContentTransformer extends TikaPoweredContentTransformer { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/PoiContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/PoiContentTransformer.java index 88fa38db23..9b4cc4897a 100644 --- a/src/main/java/org/alfresco/repo/content/transform/PoiContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/PoiContentTransformer.java @@ -42,7 +42,10 @@ import org.apache.tika.parser.microsoft.OfficeParser; * this does all the other Office file formats. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiContentTransformer extends TikaPoweredContentTransformer { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/PoiHssfContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/PoiHssfContentTransformer.java index 41f6902f9f..aefceef32a 100644 --- a/src/main/java/org/alfresco/repo/content/transform/PoiHssfContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/PoiHssfContentTransformer.java @@ -51,7 +51,10 @@ import org.xml.sax.SAXException; * * @author Nick Burch * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiHssfContentTransformer extends TikaPoweredContentTransformer { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformer.java index d74f6c1adf..fb1e076a9c 100644 --- a/src/main/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformer.java @@ -37,7 +37,10 @@ import org.apache.tika.parser.microsoft.ooxml.OOXMLParser; * conversions from the newer OOXML Office documents. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiOOXMLContentTransformer extends TikaPoweredContentTransformer { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/ProxyContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/ProxyContentTransformer.java index ab10dcf7e6..529c4fa0b7 100644 --- a/src/main/java/org/alfresco/repo/content/transform/ProxyContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/ProxyContentTransformer.java @@ -37,7 +37,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * Makes use of a {@link ContentTransformerWorker} to perform conversions. * * @author dward + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ProxyContentTransformer extends AbstractContentTransformer2 { diff --git a/src/main/java/org/alfresco/repo/content/transform/RemoteTransformerClient.java b/src/main/java/org/alfresco/repo/content/transform/RemoteTransformerClient.java index 58b13d9c1a..db3979c104 100644 --- a/src/main/java/org/alfresco/repo/content/transform/RemoteTransformerClient.java +++ b/src/main/java/org/alfresco/repo/content/transform/RemoteTransformerClient.java @@ -53,7 +53,10 @@ import java.util.StringJoiner; * saved in a ContentWriter. In the event of an error an Exception is thrown. * * @since 6.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class RemoteTransformerClient { private final String name; diff --git a/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerOptions.java b/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerOptions.java index 7af530a019..7ed61342f9 100644 --- a/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerOptions.java +++ b/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerOptions.java @@ -1,32 +1,33 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import org.alfresco.service.cmr.repository.TransformationOptions; @@ -37,7 +38,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * execution string. * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class RuntimeExecutableContentTransformerOptions extends TransformationOptions { /** Map of property values */ @@ -64,4 +68,29 @@ public class RuntimeExecutableContentTransformerOptions extends TransformationOp props.putAll(propertyValues); return props; } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (!(o instanceof RuntimeExecutableContentTransformerOptions)) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + RuntimeExecutableContentTransformerOptions that = (RuntimeExecutableContentTransformerOptions) o; + return Objects.equals(propertyValues, that.propertyValues); + } + + @Override + public int hashCode() + { + return Objects.hash(super.hashCode(), propertyValues); + } } diff --git a/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerWorker.java b/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerWorker.java index 5a788baeef..bd6c6ecc89 100644 --- a/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerWorker.java +++ b/src/main/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerWorker.java @@ -69,7 +69,10 @@ import org.springframework.beans.factory.InitializingBean; * * @since 1.1 * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class RuntimeExecutableContentTransformerWorker extends ContentTransformerHelper implements ContentTransformerWorker, InitializingBean { diff --git a/src/main/java/org/alfresco/repo/content/transform/StringExtractingContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/StringExtractingContentTransformer.java index a4479ca616..f7b247108e 100644 --- a/src/main/java/org/alfresco/repo/content/transform/StringExtractingContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/StringExtractingContentTransformer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.InputStreamReader; @@ -43,7 +43,10 @@ import org.apache.commons.logging.LogFactory; * The transformation is sensitive to the source and target string encodings. * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class StringExtractingContentTransformer extends AbstractContentTransformer2 { public static final String PREFIX_TEXT = "text/"; @@ -71,7 +74,7 @@ public class StringExtractingContentTransformer extends AbstractContentTransform // conversions from any plain text format are very reliable return true; } - else if (sourceMimetype.startsWith(PREFIX_TEXT) || + else if (sourceMimetype.startsWith(PREFIX_TEXT) || sourceMimetype.equals(MimetypeMap.MIMETYPE_DITA)) { // the source is text, but probably with some kind of markup diff --git a/src/main/java/org/alfresco/repo/content/transform/SupportedTransformation.java b/src/main/java/org/alfresco/repo/content/transform/SupportedTransformation.java index b6a2d572ab..b26bdf9d50 100644 --- a/src/main/java/org/alfresco/repo/content/transform/SupportedTransformation.java +++ b/src/main/java/org/alfresco/repo/content/transform/SupportedTransformation.java @@ -1,34 +1,37 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; /** * Represents a supported transformation. Normally used in a spring bean that limits * the number of supported configures. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class SupportedTransformation { private String sourceMimetype; diff --git a/src/main/java/org/alfresco/repo/content/transform/TextMiningContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/TextMiningContentTransformer.java index 00b2b524b7..0b40d1ec80 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TextMiningContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/TextMiningContentTransformer.java @@ -34,7 +34,10 @@ import org.apache.tika.parser.microsoft.OfficeParser; * (Word 6, 95, 97, 2000, 2003) into plain text, using Apache Tika. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TextMiningContentTransformer extends TikaPoweredContentTransformer { public TextMiningContentTransformer() diff --git a/src/main/java/org/alfresco/repo/content/transform/TextToPdfContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/TextToPdfContentTransformer.java index 27867b2628..99f21edf70 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TextToPdfContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/TextToPdfContentTransformer.java @@ -55,7 +55,10 @@ import java.util.Map; * * @author Derek Hulley * @since 2.1.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TextToPdfContentTransformer extends AbstractContentTransformer2 { private static final Log logger = LogFactory.getLog(TextToPdfContentTransformer.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/TikaAutoContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/TikaAutoContentTransformer.java index 4c49ff0069..39370059b3 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TikaAutoContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/TikaAutoContentTransformer.java @@ -42,7 +42,10 @@ import org.apache.tika.parser.Parser; * extractor is defined. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TikaAutoContentTransformer extends TikaPoweredContentTransformer { private static AutoDetectParser parser; diff --git a/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContainerExtractor.java b/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContainerExtractor.java index a37d3f9cc6..4b1011800c 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContainerExtractor.java +++ b/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContainerExtractor.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.IOException; @@ -78,7 +78,10 @@ import org.apache.tika.parser.AutoDetectParser; * an extension context file. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TikaPoweredContainerExtractor { private static final Log logger = LogFactory.getLog(TikaPoweredContainerExtractor.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformer.java index 2b5fffb381..20f80ad286 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformer.java @@ -64,7 +64,10 @@ import org.xml.sax.ContentHandler; * transformers and have them nicely take priority. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class TikaPoweredContentTransformer extends AbstractRemoteContentTransformer { private static final Log logger = LogFactory.getLog(TikaPoweredContentTransformer.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/TikaSpringConfiguredContentTransformer.java b/src/main/java/org/alfresco/repo/content/transform/TikaSpringConfiguredContentTransformer.java index 7cba9756d7..5aded4859f 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TikaSpringConfiguredContentTransformer.java +++ b/src/main/java/org/alfresco/repo/content/transform/TikaSpringConfiguredContentTransformer.java @@ -41,7 +41,10 @@ import org.apache.tika.parser.Parser; * either a spring created bean, or a parser class name. * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TikaSpringConfiguredContentTransformer extends TikaPoweredContentTransformer { private Parser tikaParser; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfig.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfig.java index 068bd57fd7..5c1114ba9f 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfig.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfig.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.Arrays; @@ -39,7 +39,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * Provides access to transformer configuration and current performance data. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public interface TransformerConfig { @@ -135,8 +138,8 @@ public interface TransformerConfig /** * The suffix to property names for the blacklist. */ - static final String BLACKLIST = ".blacklist"; - + static final String BLACKLIST = ".blacklist"; + /** * The suffix to property names to indicate which Alfresco version the transformer is * available with. If not specified it is not restricted. So if set to "Enterprise" it @@ -259,12 +262,12 @@ public interface TransformerConfig */ public static final String LOG_ENTRIES = TRANSFORMER+"log."+ENTRIES; - /** - * A white list of declared and detected mimetypes, that don't match, but should still be transformed. - */ - // Has ".mimetypes" on the end as we might one day wish to use extensions too (to simplify the entry). - static final String STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES = TRANSFORMER+"strict.mimetype.check.whitelist"+MIMETYPES.substring(0, MIMETYPES.length()-1); - + /** + * A white list of declared and detected mimetypes, that don't match, but should still be transformed. + */ + // Has ".mimetypes" on the end as we might one day wish to use extensions too (to simplify the entry). + static final String STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES = TRANSFORMER+"strict.mimetype.check.whitelist"+MIMETYPES.substring(0, MIMETYPES.length()-1); + /** * Returns a transformer property value. * @param name of the property. @@ -361,20 +364,20 @@ public interface TransformerConfig List getBlacklist(ContentTransformer transformer, String sourceMimetype, String targetMimetype); - /** - * When strict mimetype checking is performed before a transformation, this method is called. - * There are a few issues with the Tika mimetype detection. As a result we still allow some - * transformations to take place even if there is a discrepancy between the detected and - * declared mimetypes. - * @param declaredMimetype the mimetype on the source node - * @param detectedMimetype returned by Tika having looked at the content. - * @return true if the transformation should take place. This includes the case where the - * detectedMimetype is null (returned by Tika when the mimetypes are the same), or - * the supplied pair of mimetypes have been added to the - * {@code}transformer.strict.mimetype.check.whitelist{@code}. - */ - boolean strictMimetypeCheck(String declaredMimetype, String detectedMimetype); - + /** + * When strict mimetype checking is performed before a transformation, this method is called. + * There are a few issues with the Tika mimetype detection. As a result we still allow some + * transformations to take place even if there is a discrepancy between the detected and + * declared mimetypes. + * @param declaredMimetype the mimetype on the source node + * @param detectedMimetype returned by Tika having looked at the content. + * @return true if the transformation should take place. This includes the case where the + * detectedMimetype is null (returned by Tika when the mimetypes are the same), or + * the supplied pair of mimetypes have been added to the + * {@code}transformer.strict.mimetype.check.whitelist{@code}. + */ + boolean strictMimetypeCheck(String declaredMimetype, String detectedMimetype); + /** * Returns the threshold of the transformer. It is only after this number of transformation attempts * that the average time is used. diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformers.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformers.java index 4f1f75ce10..89bb6731d7 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformers.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformers.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.AMP; @@ -36,9 +36,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; -import java.util.Map; -import java.util.Properties; - +import java.util.Map; +import java.util.Properties; + import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.service.cmr.module.ModuleService; @@ -52,7 +52,10 @@ import org.apache.commons.logging.LogFactory; * Adds dynamic transformers defined in alfresco global properties to the ContentTransformerRegistry. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigDynamicTransformers extends TransformerPropertyNameExtractor { private static final Log logger = LogFactory.getLog(TransformerConfigDynamicTransformers.class); @@ -61,7 +64,7 @@ public class TransformerConfigDynamicTransformers extends TransformerPropertyNam public TransformerConfigDynamicTransformers(TransformerConfig transformerConfig, TransformerProperties transformerProperties, MimetypeService mimetypeService, ContentService contentService, ContentTransformerRegistry transformerRegistry, - TransformerDebug transformerDebug, ModuleService moduleService, DescriptorService descriptorService, + TransformerDebug transformerDebug, ModuleService moduleService, DescriptorService descriptorService, Properties globalProperties) { createDynamicTransformers(transformerConfig, transformerProperties, mimetypeService, contentService, @@ -70,7 +73,7 @@ public class TransformerConfigDynamicTransformers extends TransformerPropertyNam private void createDynamicTransformers(TransformerConfig transformerConfig, TransformerProperties transformerProperties, MimetypeService mimetypeService, ContentService contentService, ContentTransformerRegistry transformerRegistry, - TransformerDebug transformerDebug, ModuleService moduleService, DescriptorService descriptorService, + TransformerDebug transformerDebug, ModuleService moduleService, DescriptorService descriptorService, Properties globalProperties) { Collection SUFFIXES = Arrays.asList(new String [] { @@ -121,10 +124,10 @@ public class TransformerConfigDynamicTransformers extends TransformerPropertyNam AbstractContentTransformer2 transformer = property.suffix.equals(PIPELINE) ? createComplexTransformer(property, transformerConfig, mimetypeService, - contentService, transformerRegistry, transformerDebug, available, + contentService, transformerRegistry, transformerDebug, available, globalProperties) : createFailoverTransformer(property, transformerConfig, mimetypeService, - contentService, transformerRegistry, transformerDebug, available, + contentService, transformerRegistry, transformerDebug, available, globalProperties); transformer.register(); processed.add(property); @@ -291,7 +294,7 @@ public class TransformerConfigDynamicTransformers extends TransformerPropertyNam TransformerConfig transformerConfig, MimetypeService mimetypeService, ContentService contentService, ContentTransformerRegistry transformerRegistry, TransformerDebug transformerDebug, boolean available, - AbstractContentTransformer2 transformer, List transformers, + AbstractContentTransformer2 transformer, List transformers, Properties globalProperties) { try @@ -317,17 +320,17 @@ public class TransformerConfigDynamicTransformers extends TransformerPropertyNam // AbstractContentTransformer2 transformer.setBeanName(property.transformerName); - transformer.setRegisterTransformer(available); - transformer.setStrictMimeTypeCheck(getBoolean(globalProperties, "transformer.strict.mimetype.check")); - transformer.setRetryTransformOnDifferentMimeType(getBoolean(globalProperties, "content.transformer.retryOn.different.mimetype")); + transformer.setRegisterTransformer(available); + transformer.setStrictMimeTypeCheck(getBoolean(globalProperties, "transformer.strict.mimetype.check")); + transformer.setRetryTransformOnDifferentMimeType(getBoolean(globalProperties, "content.transformer.retryOn.different.mimetype")); + } + + private boolean getBoolean(Properties properties, String name) + { + String value = properties == null ? null : properties.getProperty(name); + return "true".equalsIgnoreCase(value); } - private boolean getBoolean(Properties properties, String name) - { - String value = properties == null ? null : properties.getProperty(name); - return "true".equalsIgnoreCase(value); - } - private void error(String msg) { errorCount++; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigImpl.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigImpl.java index dbdaa74041..9078679962 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigImpl.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigImpl.java @@ -1,60 +1,63 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.MalformedNodeRefException; -import org.alfresco.service.cmr.repository.MimetypeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.TransformationOptionLimits; -import org.alfresco.service.cmr.repository.TransformationOptions; -import org.alfresco.service.descriptor.DescriptorService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.context.ApplicationEvent; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory; +import org.alfresco.service.cmr.module.ModuleService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.MalformedNodeRefException; +import org.alfresco.service.cmr.repository.MimetypeService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.TransformationOptionLimits; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.service.descriptor.DescriptorService; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationEvent; import org.springframework.extensions.surf.util.AbstractLifecycleBean; /** * Provides access to transformer configuration and current performance data. * * @author Alan Davis + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class TransformerConfigImpl extends AbstractLifecycleBean implements TransformerConfig { - private static final Log logger = LogFactory.getLog(TransformerConfigImpl.class); - + private static final Log logger = LogFactory.getLog(TransformerConfigImpl.class); + private MimetypeService mimetypeService; private ContentService contentService; @@ -114,8 +117,8 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran private TransformerProperties transformerProperties; - private TransformerConfigDynamicTransformers dynamicTransformers; - + private TransformerConfigDynamicTransformers dynamicTransformers; + private Map> strictMimetypeExceptions; /** @@ -187,7 +190,7 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran errorTimes = new TransformerConfigProperty(transformerProperties, mimetypeService, ERROR_TIME, "120000"); initialAverageTimes = new TransformerConfigProperty(transformerProperties, mimetypeService, INITIAL_TIME, "0"); initialCounts = new TransformerConfigProperty(transformerProperties, mimetypeService, INITIAL_COUNT, "100000"); - propertySetter = new TransformerPropertySetter(transformerProperties, mimetypeService, transformerRegistry); + propertySetter = new TransformerPropertySetter(transformerProperties, mimetypeService, transformerRegistry); strictMimetypeExceptions = getStrictMimetypeExceptions(transformerProperties); } @@ -318,72 +321,72 @@ public class TransformerConfigImpl extends AbstractLifecycleBean implements Tran return null; } } - } - - // Build up a Map keyed on declared source node mimetype to a Set of detected mimetypes that should allow - // the transformation to take place. i.e. The cases that Tika gets wrong. - private Map> getStrictMimetypeExceptions(TransformerProperties transformerProperties2) - { - Map> strictMimetypeExceptions = new HashMap<>(); - - String whitelist = getProperty(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES); - whitelist = whitelist == null ? "" : whitelist.trim(); - if (whitelist.length() > 0) - { - String[] mimetypes = whitelist.split(";"); - - if (mimetypes.length % 2 != 0) - { - logger.error(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES+" should have an even number of mimetypes as a ; separated list."); - } - else - { - Set detectedMimetypes = null; - for (String mimetype: mimetypes) - { - mimetype = mimetype.trim(); - if (mimetype.isEmpty()) - { - logger.error(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES+" contains a blank mimetype."); - // Still okay to use it in the map though, but it will be ignored. - } - - if (detectedMimetypes == null) - { - detectedMimetypes = strictMimetypeExceptions.get(mimetype); - if (detectedMimetypes == null) - { - detectedMimetypes = new HashSet<>(); - strictMimetypeExceptions.put(mimetype, detectedMimetypes); - } - } - else - { - detectedMimetypes.add(mimetype); - detectedMimetypes = null; - } - } - } - } - - return strictMimetypeExceptions; - } - - /** - * {@inheritDoc} - */ - @Override - public boolean strictMimetypeCheck(String declaredMimetype, String detectedMimetype) - { - if (detectedMimetype == null) - { - return true; - } - - Set detectedMimetypes = strictMimetypeExceptions.get(declaredMimetype); - return detectedMimetypes != null && detectedMimetypes.contains(detectedMimetype); - } - + } + + // Build up a Map keyed on declared source node mimetype to a Set of detected mimetypes that should allow + // the transformation to take place. i.e. The cases that Tika gets wrong. + private Map> getStrictMimetypeExceptions(TransformerProperties transformerProperties2) + { + Map> strictMimetypeExceptions = new HashMap<>(); + + String whitelist = getProperty(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES); + whitelist = whitelist == null ? "" : whitelist.trim(); + if (whitelist.length() > 0) + { + String[] mimetypes = whitelist.split(";"); + + if (mimetypes.length % 2 != 0) + { + logger.error(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES+" should have an even number of mimetypes as a ; separated list."); + } + else + { + Set detectedMimetypes = null; + for (String mimetype: mimetypes) + { + mimetype = mimetype.trim(); + if (mimetype.isEmpty()) + { + logger.error(STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES+" contains a blank mimetype."); + // Still okay to use it in the map though, but it will be ignored. + } + + if (detectedMimetypes == null) + { + detectedMimetypes = strictMimetypeExceptions.get(mimetype); + if (detectedMimetypes == null) + { + detectedMimetypes = new HashSet<>(); + strictMimetypeExceptions.put(mimetype, detectedMimetypes); + } + } + else + { + detectedMimetypes.add(mimetype); + detectedMimetypes = null; + } + } + } + } + + return strictMimetypeExceptions; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean strictMimetypeCheck(String declaredMimetype, String detectedMimetype) + { + if (detectedMimetype == null) + { + return true; + } + + Set detectedMimetypes = strictMimetypeExceptions.get(declaredMimetype); + return detectedMimetypes != null && detectedMimetypes.contains(detectedMimetype); + } + /** * {@inheritDoc} */ diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigLimits.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigLimits.java index f91246beff..a451e8fd74 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigLimits.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigLimits.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -47,7 +47,10 @@ import org.apache.commons.logging.LogFactory; * Provides access to transformer limits defined via properties. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigLimits extends TransformerPropertyNameExtractor { private static Log logger = LogFactory.getLog(TransformerConfigLimits.class); diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBean.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBean.java index 8f562e8fa4..499dd262f0 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBean.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBean.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; /** @@ -30,7 +30,10 @@ package org.alfresco.repo.content.transform; * and statistics. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public interface TransformerConfigMBean { /** diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImpl.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImpl.java index 63107e03a2..3255443ee2 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImpl.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.ArrayList; @@ -37,7 +37,10 @@ import org.alfresco.service.cmr.repository.MimetypeService; * and statistics. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigMBeanImpl implements TransformerConfigMBean { private static final String NO_TRANSFORMATIONS_TO_REPORT = "No transformations to report"; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigProperty.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigProperty.java index 3fe6e189ad..03a5484f52 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigProperty.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigProperty.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -43,7 +43,10 @@ import org.alfresco.service.cmr.repository.NodeRef; * transformer and source and target mimetypes, falling back to defaults. * * @author Alan Davis + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class TransformerConfigProperty extends TransformerPropertyNameExtractor { private Map> values; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigStatistics.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigStatistics.java index d039fbb4c0..20da18f618 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigStatistics.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigStatistics.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -46,7 +46,10 @@ import org.alfresco.service.cmr.repository.MimetypeService; * of another transformation. * * @author Alan Davis + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class TransformerConfigStatistics { private TransformerConfigImpl transformerConfigImpl; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigSupported.java b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigSupported.java index 3f0a1d9bb2..424880cacf 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerConfigSupported.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerConfigSupported.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -41,7 +41,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * defined via properties for all transformers. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigSupported extends TransformerPropertyNameExtractor { // Holds configured (entries only exist if configured rather than for all possible combinations) diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerDebug.java b/src/main/java/org/alfresco/repo/content/transform/TransformerDebug.java index 00f2edc7f8..b0757008ba 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerDebug.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerDebug.java @@ -81,7 +81,10 @@ import org.springframework.util.ResourceUtils; * transformers) and {@link #popAvailable} are called.

* * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class TransformerDebug { @@ -91,6 +94,7 @@ public class TransformerDebug private final Log logger; private final Log info; + @Deprecated @AlfrescoPublicApi private enum Call { @@ -98,7 +102,8 @@ public class TransformerDebug TRANSFORM, AVAILABLE_AND_TRANSFORM }; - + + @Deprecated @AlfrescoPublicApi private static class ThreadInfo { @@ -149,7 +154,8 @@ public class TransformerDebug threadInfo.get().sb = sb; } } - + + @Deprecated @AlfrescoPublicApi private static class Frame { @@ -226,7 +232,8 @@ public class TransformerDebug return transformerName; } } - + + @Deprecated @AlfrescoPublicApi private class UnavailableTransformer implements Comparable { @@ -1445,6 +1452,7 @@ public class TransformerDebug return result; } + @Deprecated @AlfrescoPublicApi private abstract class TestTransform { diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerDebugLog.java b/src/main/java/org/alfresco/repo/content/transform/TransformerDebugLog.java index 2fbe61b8fe..83ff6513a0 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerDebugLog.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerDebugLog.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.Date; @@ -38,7 +38,10 @@ import org.apache.commons.logging.Log; * {@link TransformerConfigMBean#getTransformationDebugLog(int)}.

* * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerDebugLog extends TransformerLogger { private static Pattern END_OF_REQUEST_ID_PATTERN = Pattern.compile("[^0-9]"); @@ -105,6 +108,7 @@ public class TransformerDebugLog extends TransformerLogger } // Collects multiple lines of debug for the same transformer request. +@Deprecated class DebugEntry { final String requestId; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerInfoException.java b/src/main/java/org/alfresco/repo/content/transform/TransformerInfoException.java index 01952b555d..dd8c39edc3 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerInfoException.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerInfoException.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.error.AlfrescoRuntimeException; @@ -37,8 +37,10 @@ import org.alfresco.error.AlfrescoRuntimeException; * See {@link org.alfresco.repo.content.transform.PoiHssfContentTransformer} for pattern. * * @author Arseny Kovalchuk - * + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerInfoException extends AlfrescoRuntimeException { private static final long serialVersionUID = -4343331677825559617L; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerLog.java b/src/main/java/org/alfresco/repo/content/transform/TransformerLog.java index fc6c080685..782d2a69f6 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerLog.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerLog.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.Date; @@ -37,7 +37,10 @@ import org.alfresco.api.AlfrescoPublicApi; * {@link TransformerConfigMBean#getTransformationLog(int)}.

* * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class TransformerLog extends TransformerLogger { diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerLogger.java b/src/main/java/org/alfresco/repo/content/transform/TransformerLogger.java index ea8419220b..a725d6c015 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerLogger.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerLogger.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.text.SimpleDateFormat; @@ -42,7 +42,10 @@ import org.apache.commons.logging.Log; * Only supports debug level logging. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi abstract class TransformerLogger extends LogAdapter implements LogEntries { @@ -200,8 +203,8 @@ abstract class TransformerLogger extends LogAdapter implements LogEntries StringBuilder sb = new StringBuilder(); TransformerPropertyGetter.appendProperty(sb, propertyName, value, defaultValue); return sb.toString(); - } - + } + /** * Overridden to specify the maximum value the maxEntries property may set. * Generally quite a small number as values are stored in memory. diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerProperties.java b/src/main/java/org/alfresco/repo/content/transform/TransformerProperties.java index 7652a805f2..664feb3950 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerProperties.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerProperties.java @@ -46,7 +46,10 @@ import org.apache.commons.logging.LogFactory; * As this class allows this to happen for the Transformers subsystem. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerProperties { private static final String TRANSFORMERS_PROPERTIES = "alfresco/subsystems/Transformers/default/transformers.properties"; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyGetter.java b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyGetter.java index 856a1ee2d4..3d51089328 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyGetter.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyGetter.java @@ -1,41 +1,41 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; -import static org.alfresco.repo.content.transform.TransformerConfig.PREFIX; - -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Set; -import java.util.TreeSet; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; - +import static org.alfresco.repo.content.transform.TransformerConfig.PREFIX; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + import org.alfresco.service.cmr.repository.MimetypeService; @@ -44,7 +44,10 @@ import org.alfresco.service.cmr.repository.MimetypeService; * where these are sorted into groups. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerPropertyGetter { private final String string; @@ -57,11 +60,11 @@ public class TransformerPropertyGetter StringBuilder sb = new StringBuilder(); // Log entries - appendLoggerSetting(sb, changesOnly, transformerLog, transformerDebugLog, transformerProperties); - - // Miscellaneous - appendMiscellaneousSettings(sb, changesOnly, transformerProperties); - + appendLoggerSetting(sb, changesOnly, transformerLog, transformerDebugLog, transformerProperties); + + // Miscellaneous + appendMiscellaneousSettings(sb, changesOnly, transformerProperties); + // Default transformer Set alreadySpecified = new HashSet(); appendConfiguredTransformerSettings(sb, changesOnly, transformerProperties, mimetypeService, availableTransformers, @@ -118,69 +121,69 @@ public class TransformerPropertyGetter sb.append("\n"); } } - } - - private void appendMiscellaneousSettings(StringBuilder sb, boolean changesOnly, - TransformerProperties transformerProperties) - { - Properties defaultProperties = transformerProperties.getDefaultProperties(); - boolean first = true; - for (String propertyName: getMiscellaneousPropertyNames(defaultProperties)) - { - String defaultValue = defaultProperties.getProperty(propertyName); - String value = transformerProperties.getProperty(propertyName); - boolean isDefaultValue = value == null || value.equals(defaultValue); - value = value == null ? defaultValue : value; - - if (!changesOnly || !isDefaultValue) - { - if (first) - { - sb.append("\n"); - sb.append("# Miscellaneous settings\n"); - sb.append("# ======================\n"); - first = false; - } - appendProperty(sb, propertyName, value, defaultValue); - sb.append("\n"); - } - } - } - - // Gets names from transformers.properties that are not log or content.transformer values. - private Set getMiscellaneousPropertyNames(Properties defaultProperties) - { - Set propertyNames = new TreeSet(); - for (Object key: defaultProperties.keySet()) - { - String propertyName = key.toString(); - if (!propertyName.startsWith(PREFIX) && - !propertyName.equals(TransformerConfig.LOG_ENTRIES) && - !propertyName.equals(TransformerConfig.DEBUG_ENTRIES)) - { - propertyNames.add(propertyName); - } - } - return propertyNames; - } - - public static void appendProperty(StringBuilder sb, String propertyName, String value, String defaultValue) - { - boolean isDefaultValue = value.equals(defaultValue); - if (isDefaultValue) - { - sb.append("# "); - } - sb.append(propertyName); - sb.append('='); - sb.append(value); - if (!isDefaultValue) - { - sb.append(" # default="); - sb.append(defaultValue); - } - } - + } + + private void appendMiscellaneousSettings(StringBuilder sb, boolean changesOnly, + TransformerProperties transformerProperties) + { + Properties defaultProperties = transformerProperties.getDefaultProperties(); + boolean first = true; + for (String propertyName: getMiscellaneousPropertyNames(defaultProperties)) + { + String defaultValue = defaultProperties.getProperty(propertyName); + String value = transformerProperties.getProperty(propertyName); + boolean isDefaultValue = value == null || value.equals(defaultValue); + value = value == null ? defaultValue : value; + + if (!changesOnly || !isDefaultValue) + { + if (first) + { + sb.append("\n"); + sb.append("# Miscellaneous settings\n"); + sb.append("# ======================\n"); + first = false; + } + appendProperty(sb, propertyName, value, defaultValue); + sb.append("\n"); + } + } + } + + // Gets names from transformers.properties that are not log or content.transformer values. + private Set getMiscellaneousPropertyNames(Properties defaultProperties) + { + Set propertyNames = new TreeSet(); + for (Object key: defaultProperties.keySet()) + { + String propertyName = key.toString(); + if (!propertyName.startsWith(PREFIX) && + !propertyName.equals(TransformerConfig.LOG_ENTRIES) && + !propertyName.equals(TransformerConfig.DEBUG_ENTRIES)) + { + propertyNames.add(propertyName); + } + } + return propertyNames; + } + + public static void appendProperty(StringBuilder sb, String propertyName, String value, String defaultValue) + { + boolean isDefaultValue = value.equals(defaultValue); + if (isDefaultValue) + { + sb.append("# "); + } + sb.append(propertyName); + sb.append('='); + sb.append(value); + if (!isDefaultValue) + { + sb.append(" # default="); + sb.append(defaultValue); + } + } + private void appendConfiguredTransformerSettings(final StringBuilder sb, final boolean changesOnly, TransformerProperties transformerProperties, MimetypeService mimetypeService, final List availableTransformers, diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractor.java b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractor.java index f7e11229a7..255d61f1da 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractor.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractor.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -44,7 +44,10 @@ import org.alfresco.service.cmr.repository.MimetypeService; * Provides access to transformer property names and values. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class TransformerPropertyNameExtractor { private static Pattern EXTENSIONS_SEPARATOR = Pattern.compile("[^]\\\\]\\."); diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertySetter.java b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertySetter.java index a36d97f207..ad076d4b6e 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerPropertySetter.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerPropertySetter.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -65,7 +65,9 @@ import org.alfresco.util.Pair; * Provides methods to set and remove transformer properties and values. * * @author Alan Davis + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerPropertySetter { /** @@ -233,12 +235,12 @@ public class TransformerPropertySetter { checkInteger(hasValue, line, TransformerConfig.LOG_ENTRIES.length()); properties.add(line); - } + } else if (lowerLine.startsWith(TransformerConfig.STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES)) - { - checkMimetypeList(hasValue, line, TransformerConfig.STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES.length(), true); - properties.add(line); - } + { + checkMimetypeList(hasValue, line, TransformerConfig.STRICT_MIMETYPE_CHECK_WHITELIST_MIMETYPES.length(), true); + properties.add(line); + } else { throw unexpectedProperty("Not a transformer property", line); @@ -549,35 +551,35 @@ public class TransformerPropertySetter } } } - } - - private void checkMimetypeList(boolean hasValue, String line, int i, boolean evenNumberOfEntries) - { - String value = checkValue(hasValue, line, i); - value = value == null ? "" : value.trim(); - if (value.length() > 0) - { - String[] mimetypes = value.split(";"); - - if (evenNumberOfEntries && mimetypes.length % 2 != 0) - { - throw unexpectedProperty("There should be an even number of mimetypes.", line); - } - else - { - // Check the dericed mimetype on the Node are valid. Tika may have mimetypes we know nothing about. - List knownMimetypes = mimetypeService.getMimetypes(); - for (int j=0; j 0) + { + String[] mimetypes = value.split(";"); + + if (evenNumberOfEntries && mimetypes.length % 2 != 0) + { + throw unexpectedProperty("There should be an even number of mimetypes.", line); + } + else + { + // Check the dericed mimetype on the Node are valid. Tika may have mimetypes we know nothing about. + List knownMimetypes = mimetypeService.getMimetypes(); + for (int j=0; j. - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.List; @@ -35,7 +35,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * able to handle a given transformation. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public interface TransformerSelector { diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImpl.java b/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImpl.java index b0bef49ed3..274b08ef45 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImpl.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.ArrayList; @@ -48,7 +48,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * Old 'Explicit' transformers have been given a priority of {@code 5}. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerSelectorImpl implements TransformerSelector { private TransformerConfig transformerConfig; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImplOriginal.java b/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImplOriginal.java index db0ae78af9..f692aa8ed6 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImplOriginal.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerSelectorImplOriginal.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.ArrayList; @@ -40,7 +40,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * to maintain the previous approach if they really wish. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerSelectorImplOriginal implements TransformerSelector { private ContentTransformerRegistry contentTransformerRegistry; diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerStatistics.java b/src/main/java/org/alfresco/repo/content/transform/TransformerStatistics.java index c6e67c0004..392512bc6f 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerStatistics.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerStatistics.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.api.AlfrescoPublicApi; @@ -32,7 +32,10 @@ import org.alfresco.api.AlfrescoPublicApi; * source, target and transformer combination. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public interface TransformerStatistics { diff --git a/src/main/java/org/alfresco/repo/content/transform/TransformerStatisticsImpl.java b/src/main/java/org/alfresco/repo/content/transform/TransformerStatisticsImpl.java index 886fe6f838..4328c7b676 100644 --- a/src/main/java/org/alfresco/repo/content/transform/TransformerStatisticsImpl.java +++ b/src/main/java/org/alfresco/repo/content/transform/TransformerStatisticsImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -34,7 +34,10 @@ import org.alfresco.service.cmr.repository.MimetypeService; * Implementation of a {@link TransformerStatistics}. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerStatisticsImpl implements TransformerStatistics { private final MimetypeService mimetypeService; diff --git a/src/main/java/org/alfresco/repo/content/transform/UnimportantTransformException.java b/src/main/java/org/alfresco/repo/content/transform/UnimportantTransformException.java index 32cd869105..379a6e4607 100644 --- a/src/main/java/org/alfresco/repo/content/transform/UnimportantTransformException.java +++ b/src/main/java/org/alfresco/repo/content/transform/UnimportantTransformException.java @@ -23,22 +23,25 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.repo.content.transform; - -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * An exception that may be thrown by a transformer that indicates that the transform - * could not be performed, but that a full stack trace is not required in logging as - * the reason is expected some of the time (for example source file does not contain an - * embedded image). - * - * @author Alan Davis - */ -public class UnimportantTransformException extends AlfrescoRuntimeException -{ - public UnimportantTransformException(String msgId) - { - super(msgId); - } -} +package org.alfresco.repo.content.transform; + +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * An exception that may be thrown by a transformer that indicates that the transform + * could not be performed, but that a full stack trace is not required in logging as + * the reason is expected some of the time (for example source file does not contain an + * embedded image). + * + * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated +public class UnimportantTransformException extends AlfrescoRuntimeException +{ + public UnimportantTransformException(String msgId) + { + super(msgId); + } +} diff --git a/src/main/java/org/alfresco/repo/content/transform/UnsupportedTransformationException.java b/src/main/java/org/alfresco/repo/content/transform/UnsupportedTransformationException.java index 621b97a3ac..6fcb7b2e2d 100644 --- a/src/main/java/org/alfresco/repo/content/transform/UnsupportedTransformationException.java +++ b/src/main/java/org/alfresco/repo/content/transform/UnsupportedTransformationException.java @@ -23,26 +23,29 @@ * along with Alfresco. If not, see . * #L% */ -package org.alfresco.repo.content.transform; - -import org.alfresco.api.AlfrescoPublicApi; -import org.alfresco.error.AlfrescoRuntimeException; - -/** - * Exception indicates that a transformer is unable to transform a requested - * transformation. Normally the transformer is a component of a complex (compound) transformer - * and has been asked to transform a file that is too large (see transformation limits) as the - * size of the intermediate file is unknown at the start. - * - * @author Alan Davis - */ -@AlfrescoPublicApi -public class UnsupportedTransformationException extends AlfrescoRuntimeException -{ - private static final long serialVersionUID = 9039331287661301086L; - - public UnsupportedTransformationException(String msgId) - { - super(msgId); - } -} +package org.alfresco.repo.content.transform; + +import org.alfresco.api.AlfrescoPublicApi; +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * Exception indicates that a transformer is unable to transform a requested + * transformation. Normally the transformer is a component of a complex (compound) transformer + * and has been asked to transform a file that is too large (see transformation limits) as the + * size of the intermediate file is unknown at the start. + * + * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated +@AlfrescoPublicApi +public class UnsupportedTransformationException extends AlfrescoRuntimeException +{ + private static final long serialVersionUID = 9039331287661301086L; + + public UnsupportedTransformationException(String msgId) + { + super(msgId); + } +} diff --git a/src/main/java/org/alfresco/repo/content/transform/magick/AbstractImageMagickContentTransformerWorker.java b/src/main/java/org/alfresco/repo/content/transform/magick/AbstractImageMagickContentTransformerWorker.java index 4c79970e57..b31a103e5a 100644 --- a/src/main/java/org/alfresco/repo/content/transform/magick/AbstractImageMagickContentTransformerWorker.java +++ b/src/main/java/org/alfresco/repo/content/transform/magick/AbstractImageMagickContentTransformerWorker.java @@ -44,7 +44,10 @@ import java.io.InputStream; * Abstract helper for transformations based on ImageMagick * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class AbstractImageMagickContentTransformerWorker extends ContentTransformerHelper implements ContentTransformerWorker, InitializingBean { /** the prefix for mimetypes supported by the transformer */ diff --git a/src/main/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerWorker.java b/src/main/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerWorker.java index 863eb94579..b9779b16da 100644 --- a/src/main/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerWorker.java +++ b/src/main/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerWorker.java @@ -42,11 +42,31 @@ import org.alfresco.util.exec.RuntimeExec.ExecutionResult; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_ENLARGEMENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.ALPHA_REMOVE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.AUTO_ORIENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_GRAVITY; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_PERCENTAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_WIDTH; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_X_OFFSET; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_Y_OFFSET; +import static org.alfresco.repo.rendition2.RenditionDefinition2.END_PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.MAINTAIN_ASPECT_RATIO; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_PERCENTAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_WIDTH; +import static org.alfresco.repo.rendition2.RenditionDefinition2.START_PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.THUMBNAIL; + /** * Executes a statement to implement - * + * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ImageMagickContentTransformerWorker extends AbstractImageMagickContentTransformerWorker { /** options variable name */ @@ -360,25 +380,25 @@ public class ImageMagickContentTransformerWorker extends AbstractImageMagickCont remoteTransformerClient.request(reader, writer, sourceMimetype, sourceExtension, targetExtension, timeoutMs, logger, - "startPage", startPage, - "endPage", endPage, + START_PAGE, startPage, + END_PAGE, endPage, - "alphaRemove", alphaRemove, - "autoOrient", autoOrient, + ALPHA_REMOVE, alphaRemove, + AUTO_ORIENT, autoOrient, - "cropGravity", cropGravity, - "cropWidth", cropWidth, - "cropHeight", cropHeight, - "cropPercentage", cropPercentage, - "cropXOffset", cropXOffset, - "cropYOffset", cropYOffset, + CROP_GRAVITY, cropGravity, + CROP_WIDTH, cropWidth, + CROP_HEIGHT, cropHeight, + CROP_PERCENTAGE, cropPercentage, + CROP_X_OFFSET, cropXOffset, + CROP_Y_OFFSET, cropYOffset, - "thumbnail", thumbnail, - "resizeWidth", resizeWidth, - "resizeHeight", resizeHeight, - "resizePercentage", resizePercentage, - "allowEnlargement", allowEnlargement, - "maintainAspectRatio", maintainAspectRatio, + THUMBNAIL, thumbnail, + RESIZE_WIDTH, resizeWidth, + RESIZE_HEIGHT, resizeHeight, + RESIZE_PERCENTAGE, resizePercentage, + ALLOW_ENLARGEMENT, allowEnlargement, + MAINTAIN_ASPECT_RATIO, maintainAspectRatio, // Parameter not to be taken forward into the Transform Service version "commandOptions", commandOptions); diff --git a/src/main/java/org/alfresco/repo/content/transform/magick/ImageResizeOptions.java b/src/main/java/org/alfresco/repo/content/transform/magick/ImageResizeOptions.java index 7f2231b71a..f7aeee2440 100644 --- a/src/main/java/org/alfresco/repo/content/transform/magick/ImageResizeOptions.java +++ b/src/main/java/org/alfresco/repo/content/transform/magick/ImageResizeOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform.magick; import org.alfresco.api.AlfrescoPublicApi; @@ -31,7 +31,10 @@ import org.alfresco.api.AlfrescoPublicApi; * Image resize options * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ImageResizeOptions { diff --git a/src/main/java/org/alfresco/repo/content/transform/magick/ImageTransformationOptions.java b/src/main/java/org/alfresco/repo/content/transform/magick/ImageTransformationOptions.java index 9fff3406dd..2b711d6024 100644 --- a/src/main/java/org/alfresco/repo/content/transform/magick/ImageTransformationOptions.java +++ b/src/main/java/org/alfresco/repo/content/transform/magick/ImageTransformationOptions.java @@ -27,6 +27,7 @@ package org.alfresco.repo.content.transform.magick; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.service.cmr.repository.TransformationOptions; @@ -36,7 +37,10 @@ import org.alfresco.service.cmr.repository.TransformationSourceOptions; * Image transformation options * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class ImageTransformationOptions extends TransformationOptions { @@ -118,7 +122,17 @@ public class ImageTransformationOptions extends TransformationOptions builder.append("]"); return builder.toString(); } - + + @Override + public String toStringAll() + { + return super.toStringAll()+"ImageTransformationOptions{" + + "commandOptions='" + commandOptions + '\'' + + ", resizeOptions=" + resizeOptions + + ", autoOrient=" + autoOrient + + '}'; + } + /** * Overrides the base class implementation to add our options */ @@ -164,4 +178,31 @@ public class ImageTransformationOptions extends TransformationOptions } } } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + ImageTransformationOptions that = (ImageTransformationOptions) o; + return autoOrient == that.autoOrient && + Objects.equals(commandOptions, that.commandOptions) && + Objects.equals(resizeOptions, that.resizeOptions); + } + + @Override + public int hashCode() + { + return Objects.hash(super.hashCode(), commandOptions, resizeOptions, autoOrient); + } } diff --git a/src/main/java/org/alfresco/repo/content/transform/pdfrenderer/AlfrescoPdfRendererContentTransformerWorker.java b/src/main/java/org/alfresco/repo/content/transform/pdfrenderer/AlfrescoPdfRendererContentTransformerWorker.java index 74c980d258..da30213a9f 100644 --- a/src/main/java/org/alfresco/repo/content/transform/pdfrenderer/AlfrescoPdfRendererContentTransformerWorker.java +++ b/src/main/java/org/alfresco/repo/content/transform/pdfrenderer/AlfrescoPdfRendererContentTransformerWorker.java @@ -46,6 +46,17 @@ import java.io.File; import java.util.HashMap; import java.util.Map; +import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_ENLARGEMENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.MAINTAIN_ASPECT_RATIO; +import static org.alfresco.repo.rendition2.RenditionDefinition2.PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.WIDTH; + +/** + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. + */ +@Deprecated public class AlfrescoPdfRendererContentTransformerWorker extends ContentTransformerHelper implements ContentTransformerWorker, InitializingBean { @@ -366,11 +377,11 @@ public class AlfrescoPdfRendererContentTransformerWorker extends ContentTransfor remoteTransformerClient.request(reader, writer, sourceMimetype, sourceExtension, targetExtension, timeoutMs, logger, - "page", page, - "width", width, - "height", height, - "allowEnlargement", allowEnlargement, - "maintainAspectRatio", maintainAspectRatio); + PAGE, page, + WIDTH, width, + HEIGHT, height, + ALLOW_ENLARGEMENT, allowEnlargement, + MAINTAIN_ASPECT_RATIO, maintainAspectRatio); } @Override diff --git a/src/main/java/org/alfresco/repo/content/transform/swf/SWFTransformationOptions.java b/src/main/java/org/alfresco/repo/content/transform/swf/SWFTransformationOptions.java index 2ae27cf01c..cadbafdf68 100644 --- a/src/main/java/org/alfresco/repo/content/transform/swf/SWFTransformationOptions.java +++ b/src/main/java/org/alfresco/repo/content/transform/swf/SWFTransformationOptions.java @@ -1,44 +1,50 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform.swf; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import org.alfresco.service.cmr.repository.TransformationOptions; import org.springframework.extensions.surf.util.ParameterCheck; +import static org.alfresco.repo.rendition2.RenditionDefinition2.FLASH_VERSION; + /** * SFW transformation options * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class SWFTransformationOptions extends TransformationOptions { - private static final String OPT_FLASH_VERSION = "flashVersion"; + private static final String OPT_FLASH_VERSION = FLASH_VERSION; /** The version of the flash to convert to */ private String flashVersion = "9"; @@ -62,4 +68,29 @@ public class SWFTransformationOptions extends TransformationOptions props.put(OPT_FLASH_VERSION, flashVersion); return props; } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (!(o instanceof SWFTransformationOptions)) + { + return false; + } + if (!super.equals(o)) + { + return false; + } + SWFTransformationOptions that = (SWFTransformationOptions) o; + return Objects.equals(flashVersion, that.flashVersion); + } + + @Override + public int hashCode() + { + return Objects.hash(super.hashCode(), flashVersion); + } } diff --git a/src/main/java/org/alfresco/repo/jscript/ScriptNode.java b/src/main/java/org/alfresco/repo/jscript/ScriptNode.java index caff4812d6..a8ef780353 100644 --- a/src/main/java/org/alfresco/repo/jscript/ScriptNode.java +++ b/src/main/java/org/alfresco/repo/jscript/ScriptNode.java @@ -2725,7 +2725,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider { return transformDocument(mimetype, destination.getNodeRef()); } - + private ScriptNode transformDocument(String mimetype, NodeRef destination) { ParameterCheck.mandatoryString("Mimetype", mimetype); @@ -2848,7 +2848,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider ParameterCheck.mandatory("Destination Node", destination); return transformImage(mimetype, options, destination.getNodeRef()); } - + private ScriptNode transformImage(String mimetype, final String options, NodeRef destination) { ParameterCheck.mandatoryString("Mimetype", mimetype); @@ -3017,7 +3017,11 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider * @param thumbnailName the name of the thumbnail * @param async indicates whether the thumbnail is create asynchronously or not * @return ScriptThumbnail the newly create thumbnail node or null if async creation occures + * + * @deprecated The async flag in the method signature will not be applicable as all of + * the future transformations will be asynchronous */ + @Deprecated public ScriptThumbnail createThumbnail(String thumbnailName, boolean async) { return createThumbnail(thumbnailName, async, false); @@ -3038,7 +3042,11 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider * @param async indicates whether the thumbnail is create asynchronously or not * @param force ignore system.thumbnail.generate=false * @return ScriptThumbnail the newly create thumbnail node or null if async creation occures + * + * @deprecated The async flag in the method signature will not be applicable as all of + * the future transformations will be asynchronous */ + @Deprecated public ScriptThumbnail createThumbnail(String thumbnailName, boolean async, boolean force) { final ThumbnailService thumbnailService = services.getThumbnailService(); @@ -3189,7 +3197,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider } /** * This version of the method name spelling is retained (for now) for backwards compatibility - * @see #getThumbnailDefinitions() + * @see #getThumbnailDefinitions() */ @Deprecated public String[] getThumbnailDefintions() @@ -4123,7 +4131,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider private QName property; private boolean isDirty; } - + /** * Interface contract for simple anonymous classes that implement document transformations */ @@ -4142,7 +4150,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider ScriptNode transform(ContentService contentService, NodeRef noderef, ContentReader reader, ContentWriter writer); } - + private abstract class AbstractTransformer implements Transformer { public ScriptNode transform(ContentService contentService, NodeRef nodeRef, diff --git a/src/main/java/org/alfresco/repo/rendition/CompositeRenditionDefinitionImpl.java b/src/main/java/org/alfresco/repo/rendition/CompositeRenditionDefinitionImpl.java index fca6624950..86a6b967bc 100644 --- a/src/main/java/org/alfresco/repo/rendition/CompositeRenditionDefinitionImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/CompositeRenditionDefinitionImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -39,7 +39,10 @@ import org.alfresco.service.namespace.QName; /** * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class CompositeRenditionDefinitionImpl extends RenditionDefinitionImpl implements CompositeRenditionDefinition { /** diff --git a/src/main/java/org/alfresco/repo/rendition/RenderingEngineDefinitionImpl.java b/src/main/java/org/alfresco/repo/rendition/RenderingEngineDefinitionImpl.java index 0947692d68..17327485ad 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenderingEngineDefinitionImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/RenderingEngineDefinitionImpl.java @@ -23,25 +23,28 @@ * along with Alfresco. If not, see . * #L% */ - -package org.alfresco.repo.rendition; - -import org.alfresco.repo.action.ActionDefinitionImpl; -import org.alfresco.service.cmr.rendition.RenderingEngineDefinition; - -/** - * @author Nick Smith - * @since 3.3 - */ -public class RenderingEngineDefinitionImpl extends ActionDefinitionImpl implements RenderingEngineDefinition -{ - /** - * Serial version UID. - */ - private static final long serialVersionUID = 1L; - - public RenderingEngineDefinitionImpl(String name) - { - super(name); - } -} + +package org.alfresco.repo.rendition; + +import org.alfresco.repo.action.ActionDefinitionImpl; +import org.alfresco.service.cmr.rendition.RenderingEngineDefinition; + +/** + * @author Nick Smith + * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ +@Deprecated +public class RenderingEngineDefinitionImpl extends ActionDefinitionImpl implements RenderingEngineDefinition +{ + /** + * Serial version UID. + */ + private static final long serialVersionUID = 1L; + + public RenderingEngineDefinitionImpl(String name) + { + super(name); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionImpl.java b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionImpl.java index 52e8423da4..b1d5e46143 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -39,7 +39,10 @@ import org.alfresco.service.namespace.QName; * @author Nick Smith * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionDefinitionImpl extends ActionImpl implements RenditionDefinition { /** diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersister.java b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersister.java index dc50a1ba93..ac9e9d7385 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersister.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersister.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -40,7 +40,10 @@ import org.alfresco.service.namespace.QName; * @author Nick Smith * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public interface RenditionDefinitionPersister { /** diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersisterImpl.java b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersisterImpl.java index acb44cfcec..a895cd6238 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersisterImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionDefinitionPersisterImpl.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -57,7 +57,10 @@ import org.alfresco.service.namespace.QName; * @author Nick Smith * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionDefinitionPersisterImpl implements RenditionDefinitionPersister { /** Reference to the rendering action space node */ diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionLocation.java b/src/main/java/org/alfresco/repo/rendition/RenditionLocation.java index 229d7963d8..1bc6784146 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionLocation.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionLocation.java @@ -1,36 +1,38 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; import org.alfresco.service.cmr.repository.NodeRef; /** * This simple interface defines a data class which identifies a rendition node, its parent and its name. + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ - +@Deprecated public interface RenditionLocation { /** diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionLocationImpl.java b/src/main/java/org/alfresco/repo/rendition/RenditionLocationImpl.java index ea18c8d7bb..2cde6507a9 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionLocationImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionLocationImpl.java @@ -1,35 +1,38 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; import org.alfresco.service.cmr.repository.NodeRef; /** * This simple class is a struct containing a rendition node, its parent and its name. + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionLocationImpl implements RenditionLocation { private final NodeRef parentRef; diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionLocationResolver.java b/src/main/java/org/alfresco/repo/rendition/RenditionLocationResolver.java index cbea0506f5..de2fd03c59 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionLocationResolver.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionLocationResolver.java @@ -31,7 +31,10 @@ import org.alfresco.service.cmr.repository.NodeRef; /** * This interface defines a type which can be used to resolve the location of rendition nodes. + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public interface RenditionLocationResolver { diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionNodeManager.java b/src/main/java/org/alfresco/repo/rendition/RenditionNodeManager.java index 5cb6f2fd2f..630b1cad4e 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionNodeManager.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionNodeManager.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -60,7 +60,10 @@ import org.apache.commons.logging.LogFactory; * other things. * * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionNodeManager { /** Logger */ diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionServiceImpl.java b/src/main/java/org/alfresco/repo/rendition/RenditionServiceImpl.java index 369d3bde06..07b9f0e071 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionServiceImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionServiceImpl.java @@ -26,12 +26,6 @@ package org.alfresco.repo.rendition; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - import org.alfresco.model.ContentModel; import org.alfresco.model.RenditionModel; import org.alfresco.repo.action.executer.ActionExecuter; @@ -39,6 +33,10 @@ import org.alfresco.repo.coci.CheckOutCheckInServicePolicies.BeforeCheckOut; import org.alfresco.repo.lock.LockServicePolicies.BeforeLock; import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.rendition.executer.AbstractRenderingEngine; +import org.alfresco.repo.rendition2.RenditionDefinition2; +import org.alfresco.repo.rendition2.RenditionDefinitionRegistry2; +import org.alfresco.repo.rendition2.RenditionService2Impl; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.action.ActionDefinition; @@ -59,18 +57,26 @@ import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.GUID; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Set; + /* * @author Nick Smith * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionServiceImpl implements RenditionService, RenditionDefinitionPersister, @@ -85,7 +91,8 @@ public class RenditionServiceImpl implements private DictionaryService dictionaryService; private NodeService nodeService; private PolicyComponent policyComponent; - + private RenditionService2Impl renditionService2; + private RenditionDefinitionPersister renditionDefinitionPersister; /** @@ -170,6 +177,11 @@ public class RenditionServiceImpl implements this.knownCancellableActionTypes = knownCancellableActionTypes; } + public void setRenditionService2(RenditionService2Impl renditionService2) + { + this.renditionService2 = renditionService2; + } + public void init() { this.policyComponent.bindClassBehaviour( @@ -453,16 +465,7 @@ public class RenditionServiceImpl implements */ public List getRenditions(NodeRef node) { - List result = Collections.emptyList(); - - // Check that the node has the renditioned aspect applied - if (nodeService.hasAspect(node, RenditionModel.ASPECT_RENDITIONED) == true) - { - // Get all the renditions that match the given rendition name - result = nodeService.getChildAssocs(node, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); - - } - return result; + return renditionService2.getRenditions(node); } /* @@ -528,7 +531,9 @@ public class RenditionServiceImpl implements { log.debug("Unexpectedly found " + renditions.size() + " renditions of name " + renditionName + " on node " + node); } - return renditions.get(0); + ChildAssociationRef childAssoc = renditions.get(0); + NodeRef renditionNode = childAssoc.getChildRef(); + return !renditionService2.isRenditionAvailable(node, renditionNode) ? null: childAssoc; } } @@ -631,4 +636,81 @@ public class RenditionServiceImpl implements { cancelRenditions(nodeRef); } + + @Override + public boolean usingRenditionService2(NodeRef sourceNodeRef, RenditionDefinition rendDefn) + { + boolean useRenditionService2 = false; + + QName renditionQName = rendDefn.getRenditionName(); + String renditionName = renditionQName.getLocalName(); + RenditionDefinition2 renditionDefinition2 = getEquivalentRenditionDefinition2(rendDefn); + boolean createdByRenditionService2 = renditionService2.isCreatedByRenditionService2(sourceNodeRef, renditionName); + + if (renditionService2.isEnabled()) + { + if (createdByRenditionService2) + { + // The rendition has been created by RenditionService2 and the older RenditionService should leave it to + // the newer service to do the work unless there is no matching rendition in which case we remove the + // rendition and the old service takes over again. + if (renditionDefinition2 != null) + { + if (log.isDebugEnabled()) + { + log.debug("OnContentUpdate ignored by original service as the rendition for \""+sourceNodeRef+"\", \""+renditionName+"\" new service has taken over."); + } + useRenditionService2 = true; + } + else + { + if (log.isDebugEnabled()) + { + log.debug("OnContentUpdate remove rendition for \""+sourceNodeRef+"\", \""+renditionName+"\" so we switch back to the original service, as the new service does not have the definition."); + } + renditionService2.deleteRendition(sourceNodeRef, renditionName); + } + } + else if (renditionDefinition2 != null) + { + // The rendition has been created by the older RenditionService but we know that RenditionService2 + // can do the work, so we ask the newer service to do it here. This will result in the rendition2 + // aspect being added, so future renditions will also be done by the newer service. + if (log.isDebugEnabled()) + { + log.debug("OnContentUpdate calling RenditionService2.render(\""+sourceNodeRef+"\", \""+renditionName+"\" so we switch to the new service."); + } + useRenditionService2 = true; + renditionService2.render(sourceNodeRef, renditionName); + } + } + else if (createdByRenditionService2) + { + // As the new service has been disabled the old service needs to take over, so the rendition is removed. + if (log.isDebugEnabled()) + { + log.debug("OnContentUpdate remove rendition for \""+sourceNodeRef+"\", \""+renditionName+"\" so we switch back to the original service, as the new service is disabled."); + } + renditionService2.deleteRendition(sourceNodeRef, renditionName); + } + + return useRenditionService2; + } + + // Finds a RenditionDefinition2 with the same name (local part) and target mimetype. + private RenditionDefinition2 getEquivalentRenditionDefinition2(RenditionDefinition rendDefn) + { + QName renditionQName = rendDefn.getRenditionName(); + String renditionName = renditionQName.getLocalName(); + RenditionDefinitionRegistry2 renditionDefinitionRegistry2 = renditionService2.getRenditionDefinitionRegistry2(); + RenditionDefinition2 renditionDefinition2 = renditionDefinitionRegistry2.getRenditionDefinition(renditionName); + RenditionDefinition2 equivalentRenditionDefinition2 = null; + if (renditionDefinition2 != null) + { + String targetMimetype = (String) rendDefn.getParameterValue(AbstractRenderingEngine.PARAM_MIME_TYPE); + String targetMimetype2 = renditionDefinition2.getTargetMimetype(); + equivalentRenditionDefinition2 = targetMimetype.equals(targetMimetype2) ? renditionDefinition2 : null; + } + return equivalentRenditionDefinition2; + } } diff --git a/src/main/java/org/alfresco/repo/rendition/RenditionedAspect.java b/src/main/java/org/alfresco/repo/rendition/RenditionedAspect.java index 9085f7ea7f..53c90ffaf8 100644 --- a/src/main/java/org/alfresco/repo/rendition/RenditionedAspect.java +++ b/src/main/java/org/alfresco/repo/rendition/RenditionedAspect.java @@ -1,35 +1,30 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - import org.alfresco.model.RenditionModel; import org.alfresco.repo.copy.CopyBehaviourCallback; import org.alfresco.repo.copy.CopyDetails; @@ -55,11 +50,18 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.EqualsHelper; import org.alfresco.util.Pair; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + /** * Renditioned aspect behaviour bean. * When any node with the renditioned aspect has a property updated, then all @@ -70,7 +72,10 @@ import org.apache.commons.logging.LogFactory; * * @author Neil McErlean * @author Roy Wetherall + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionedAspect implements NodeServicePolicies.OnUpdatePropertiesPolicy, CopyServicePolicies.OnCopyNodePolicy { @@ -121,7 +126,7 @@ public class RenditionedAspect implements NodeServicePolicies.OnUpdateProperties { this.renditionService = renditionService; } - + /** * Set the dictionary service * @@ -161,7 +166,7 @@ public class RenditionedAspect implements NodeServicePolicies.OnUpdateProperties List changedProperties = getChangedProperties(before, after); // There may be a different policy for different rendition kinds. - List renditions = this.renditionService.getRenditions(nodeRef); + List renditions = getRenditionChildAssociations(nodeRef); for (ChildAssociationRef chAssRef : renditions) { final QName renditionAssocName = chAssRef.getQName(); @@ -181,6 +186,7 @@ public class RenditionedAspect implements NodeServicePolicies.OnUpdateProperties { if (logger.isDebugEnabled()) { + // We will see this debug if a new RenditionService2 definition exists. StringBuilder msg = new StringBuilder(); msg.append("Cannot update rendition ") .append(renditionAssocName) @@ -233,7 +239,25 @@ public class RenditionedAspect implements NodeServicePolicies.OnUpdateProperties } } } - + + // Identical to the original RenditionService.getRenditions(NodeRef) method. + // It returns all renditions (including those that need to be replaced). + // The code in RenditionService.getRenditions(NodeRef) no longer does this as + // it hides any rendition service 2 renditions that are out of date or have failed. + private List getRenditionChildAssociations(NodeRef sourceNodeRef) + { + // Copy of code from the original RenditionService. + List result = Collections.emptyList(); + + // Check that the node has the renditioned aspect applied + if (nodeService.hasAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED)) + { + // Get all the renditions that match the given rendition name + result = nodeService.getChildAssocs(sourceNodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); + } + return result; + } + private List getChangedProperties(Map before, Map after) { List results = new ArrayList(); @@ -275,14 +299,14 @@ public class RenditionedAspect implements NodeServicePolicies.OnUpdateProperties private void queueUpdate(final NodeRef sourceNodeRef, final RenditionDefinition rendDefn, final ChildAssociationRef renditionAssoc) { - if (logger.isDebugEnabled()) + if (logger.isDebugEnabled() && rendDefn != null) { StringBuilder msg = new StringBuilder(); msg.append("Queueing rendition update for node ").append(sourceNodeRef).append(": ").append(rendDefn.getRenditionName()); logger.debug(msg.toString()); } - if (rendDefn != null) + if (rendDefn != null && !renditionService.usingRenditionService2(sourceNodeRef, rendDefn)) { Action deleteRendition = actionService.createAction(DeleteRenditionActionExecuter.NAME); deleteRendition.setParameterValue(DeleteRenditionActionExecuter.PARAM_RENDITION_DEFINITION_NAME, rendDefn.getRenditionName()); diff --git a/src/main/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java b/src/main/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java index 13ed0b6c06..7f09525887 100644 --- a/src/main/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java +++ b/src/main/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverImpl.java @@ -66,6 +66,12 @@ import freemarker.ext.dom.NodeModel; import freemarker.template.SimpleDate; import freemarker.template.SimpleHash; +/** + * + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ +@Deprecated public class StandardRenditionLocationResolverImpl implements RenditionLocationResolver { private final static Log log = LogFactory.getLog(StandardRenditionLocationResolverImpl.class); diff --git a/src/main/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngine.java index 7fb7844b0b..98c218166c 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngine.java @@ -52,6 +52,7 @@ import org.alfresco.repo.rendition.RenditionDefinitionImpl; import org.alfresco.repo.rendition.RenditionLocation; import org.alfresco.repo.rendition.RenditionLocationResolver; import org.alfresco.repo.rendition.RenditionNodeManager; +import org.alfresco.repo.rendition2.RenditionService2Impl; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ActionDefinition; @@ -86,7 +87,10 @@ import org.springframework.extensions.surf.util.I18NUtil; * @author Neil McErlean * @author Nick Smith * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase { @@ -117,10 +121,9 @@ public abstract class AbstractRenderingEngine extends ActionExecuterAbstractBase * This is the default default property used to specify where rendition * content is stored - used if no value is injected from spring. */ - private static final QName DEFAULT_DEFAULT_RENDITION_CONTENT_PROP = ContentModel.PROP_CONTENT; - - private static final String DEFAULT_MIMETYPE = MimetypeMap.MIMETYPE_TEXT_PLAIN; - private static final String DEFAULT_ENCODING = "UTF-8"; + private static final QName DEFAULT_DEFAULT_RENDITION_CONTENT_PROP = RenditionService2Impl.DEFAULT_RENDITION_CONTENT_PROP; + private static final String DEFAULT_MIMETYPE = RenditionService2Impl.DEFAULT_MIMETYPE; + private static final String DEFAULT_ENCODING = RenditionService2Impl.DEFAULT_ENCODING; /** * This is the default node type that is used when creating rendition diff --git a/src/main/java/org/alfresco/repo/rendition/executer/AbstractTransformationRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/AbstractTransformationRenderingEngine.java index 63b8bf5b20..02c1325826 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/AbstractTransformationRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/AbstractTransformationRenderingEngine.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -39,7 +39,9 @@ import org.alfresco.repo.action.ParameterDefinitionImpl; import org.alfresco.repo.content.transform.ContentTransformer; import org.alfresco.repo.content.transform.TransformerConfig; import org.alfresco.repo.content.transform.TransformerDebug; -import org.alfresco.repo.content.transform.UnsupportedTransformationException; +import org.alfresco.repo.content.transform.UnsupportedTransformationException; + +import org.alfresco.repo.rendition2.RenditionService2Impl; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.action.ActionServiceException; import org.alfresco.service.cmr.action.ActionTrackingService; @@ -61,7 +63,10 @@ import org.apache.commons.logging.LogFactory; /** * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public abstract class AbstractTransformationRenderingEngine extends AbstractRenderingEngine { private static Log logger = LogFactory.getLog(AbstractTransformationRenderingEngine.class); @@ -116,7 +121,7 @@ public abstract class AbstractTransformationRenderingEngine extends AbstractRend /* Error messages */ private static final String TRANSFORMER_NOT_EXISTS_MESSAGE_PATTERN = "Transformer for '%s' source mime type and '%s' target mime type was not found. Operation can't be performed"; private static final String NOT_TRANSFORMABLE_MESSAGE_PATTERN = "Content not transformable for '%s' source mime type and '%s' target mime type. Operation can't be performed"; - private static final String TRANSFORMING_ERROR_MESSAGE = "Some error occurred during document transforming. Error message: "; + private static final String TRANSFORMING_ERROR_MESSAGE = RenditionService2Impl.TRANSFORMING_ERROR_MESSAGE; private Collection sourceOptionsSerializers; diff --git a/src/main/java/org/alfresco/repo/rendition/executer/BaseTemplateRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/BaseTemplateRenderingEngine.java index d98e021cf6..be93f67a57 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/BaseTemplateRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/BaseTemplateRenderingEngine.java @@ -58,7 +58,10 @@ import org.springframework.extensions.surf.util.I18NUtil; * * @author Brian Remmington * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public abstract class BaseTemplateRenderingEngine extends AbstractRenderingEngine { private static final Log log = LogFactory.getLog(BaseTemplateRenderingEngine.class); diff --git a/src/main/java/org/alfresco/repo/rendition/executer/CompositeRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/CompositeRenderingEngine.java index a464d9923d..c922002584 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/CompositeRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/CompositeRenderingEngine.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -47,7 +47,10 @@ import org.apache.commons.logging.LogFactory; * definition executed is the output of this rendering engine. * * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class CompositeRenderingEngine extends AbstractRenderingEngine { /** Logger */ diff --git a/src/main/java/org/alfresco/repo/rendition/executer/DeleteRenditionActionExecuter.java b/src/main/java/org/alfresco/repo/rendition/executer/DeleteRenditionActionExecuter.java index b57316e760..e559996913 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/DeleteRenditionActionExecuter.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/DeleteRenditionActionExecuter.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; import java.io.Serializable; @@ -62,7 +62,10 @@ import org.apache.commons.logging.LogFactory; * * @see RenditionedAspect * @see AddFailedThumbnailActionExecuter + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class DeleteRenditionActionExecuter extends ActionExecuterAbstractBase { private static Log log = LogFactory.getLog(DeleteRenditionActionExecuter.class); @@ -94,13 +97,13 @@ public class DeleteRenditionActionExecuter extends ActionExecuterAbstractBase public void setBehaviourFilter(BehaviourFilter behaviourFilter) { this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) - */ - public void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuter#execute(Action, NodeRef) + */ + public void executeImpl(final Action action, final NodeRef actionedUponNodeRef) + { // It is possible that the user who triggered the thumbnail update does not have delete permissions on the node // but does have write permissions. e.g. if a SiteCollaborator updates a node which they do not own, any failure // to update renditions would trigger this DeleteRendition action and they would not have permissions to delete. diff --git a/src/main/java/org/alfresco/repo/rendition/executer/FreemarkerRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/FreemarkerRenderingEngine.java index 9777218873..8ff2ecf472 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/FreemarkerRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/FreemarkerRenderingEngine.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -43,7 +43,10 @@ import org.alfresco.service.cmr.repository.TemplateImageResolver; /** * @author Nick Smith * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class FreemarkerRenderingEngine extends BaseTemplateRenderingEngine { diff --git a/src/main/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngine.java index 2216b9ee12..1c2da660f0 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngine.java @@ -83,7 +83,10 @@ import org.xml.sax.helpers.AttributesImpl; * * @author Nick Burch * @since 3.4 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class HTMLRenderingEngine extends AbstractRenderingEngine { private static Log logger = LogFactory.getLog(HTMLRenderingEngine.class); diff --git a/src/main/java/org/alfresco/repo/rendition/executer/ImageRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/ImageRenderingEngine.java index b1cfa99641..ce29af3086 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/ImageRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/ImageRenderingEngine.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -38,6 +38,9 @@ import org.alfresco.service.cmr.rendition.RenditionService; import org.alfresco.service.cmr.repository.CropSourceOptions.CropSourceOptionsSerializer; import org.alfresco.service.cmr.repository.TransformationOptions; +import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_ENLARGEMENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.MAINTAIN_ASPECT_RATIO; + /** * This class is the implementation of the {@link RenditionService}'s * "imageRenderingEngine" rendering engine. This action renders a piece of @@ -46,7 +49,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class ImageRenderingEngine extends AbstractTransformationRenderingEngine { public static final String NAME = "imageRenderingEngine"; @@ -62,7 +68,7 @@ public class ImageRenderingEngine extends AbstractTransformationRenderingEngine * If an image is being cropped and resized then the cropping happens first, * followed by resizing of the cropped image. */ - public static final String PARAM_RESIZE_WIDTH = "xsize"; + public static final String PARAM_RESIZE_WIDTH = "xsize"; // RESIZE_WIDTH /** * This optional {@link Integer} or {@link Float} parameter specifies the @@ -74,7 +80,7 @@ public class ImageRenderingEngine extends AbstractTransformationRenderingEngine * If an image is being cropped and resized then the cropping happens * first, followed by resizing of the cropped image. */ - public static final String PARAM_RESIZE_HEIGHT = "ysize"; + public static final String PARAM_RESIZE_HEIGHT = "ysize"; // RESIZE_HEIGHT /** * This optional {@link Boolean} flag parameter specifies how the @@ -101,7 +107,7 @@ public class ImageRenderingEngine extends AbstractTransformationRenderingEngine * original aspect ratio.
* This parameter defaults to false */ - public static final String PARAM_MAINTAIN_ASPECT_RATIO = "maintainAspectRatio"; + public static final String PARAM_MAINTAIN_ASPECT_RATIO = MAINTAIN_ASPECT_RATIO; /** * This optional {@link Boolean} flag parameter specifies a mode for @@ -121,7 +127,7 @@ public class ImageRenderingEngine extends AbstractTransformationRenderingEngine * of the original image at the same size. * @since 4.0 */ - public static final String PARAM_ALLOW_ENLARGEMENT = "allowEnlargement"; + public static final String PARAM_ALLOW_ENLARGEMENT = ALLOW_ENLARGEMENT; /** * This optional {@link String} parameter specifies any additional diff --git a/src/main/java/org/alfresco/repo/rendition/executer/ReformatRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/ReformatRenderingEngine.java index 7f5bf07b03..a4d53298a2 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/ReformatRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/ReformatRenderingEngine.java @@ -1,46 +1,45 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; import java.util.Collection; import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.content.transform.magick.ImageTransformationOptions; -import org.alfresco.repo.rendition.executer.AbstractRenderingEngine.RenderingContext; import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.rendition.RenditionService; import org.alfresco.service.cmr.rendition.RenditionServiceException; import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.TransformationOptions; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import static org.alfresco.repo.rendition2.RenditionDefinition2.FLASH_VERSION; + /** * This class is the implementation of the {@link RenditionService}'s "reformat" * action/rendering. This action renders a piece of content in the specified @@ -54,7 +53,10 @@ import org.apache.commons.logging.LogFactory; * * @author Neil McErlean * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class ReformatRenderingEngine extends AbstractTransformationRenderingEngine { private static Log logger = LogFactory.getLog(ReformatRenderingEngine.class); @@ -64,7 +66,7 @@ public class ReformatRenderingEngine extends AbstractTransformationRenderingEngi * from pdf to Flash and is used to specify which Flash version to convert * to. */ - public static final String PARAM_FLASH_VERSION = "flashVersion"; + public static final String PARAM_FLASH_VERSION = FLASH_VERSION; /* * Action constants diff --git a/src/main/java/org/alfresco/repo/rendition/executer/XSLTFunctions.java b/src/main/java/org/alfresco/repo/rendition/executer/XSLTFunctions.java index 8bd004b8a1..ce0561e9cb 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/XSLTFunctions.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/XSLTFunctions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -54,8 +54,11 @@ import org.xml.sax.SAXException; /** * @author Brian Remmington * @since 3.3 - * + * + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class XSLTFunctions { private static final Log log = LogFactory.getLog(XSLTFunctions.class); diff --git a/src/main/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngine.java b/src/main/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngine.java index e589c4e31f..1f7e842880 100644 --- a/src/main/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngine.java +++ b/src/main/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngine.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; @@ -56,7 +56,10 @@ import org.xml.sax.SAXException; /** * @author Brian Remmington * @since 3.3 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class XSLTRenderingEngine extends BaseTemplateRenderingEngine { public static final String NAME = "xsltRenderingEngine"; diff --git a/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionDefinition.java b/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionDefinition.java index d419f3cdb6..f571925194 100644 --- a/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionDefinition.java +++ b/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionDefinition.java @@ -39,7 +39,10 @@ import org.mozilla.javascript.Scriptable; * * @author Neil McErlean * @see org.alfresco.service.cmr.rendition.RenditionDefinition + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public final class ScriptRenditionDefinition extends ScriptAction { private static final long serialVersionUID = 8132935577891455490L; diff --git a/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionService.java b/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionService.java index 910cabefa4..79eabf8898 100644 --- a/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionService.java +++ b/src/main/java/org/alfresco/repo/rendition/script/ScriptRenditionService.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.script; import java.util.List; @@ -44,7 +44,10 @@ import org.apache.commons.logging.LogFactory; * Script object representing the rendition service. * * @author Neil McErlean + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class ScriptRenditionService extends BaseScopableProcessorExtension { private static Log logger = LogFactory.getLog(ScriptRenditionService.class); diff --git a/src/main/java/org/alfresco/repo/rendition2/AbstractTransformClient.java b/src/main/java/org/alfresco/repo/rendition2/AbstractTransformClient.java new file mode 100644 index 0000000000..f8ce1d6f6c --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/AbstractTransformClient.java @@ -0,0 +1,54 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.model.ContentModel; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.util.PropertyCheck; +import org.springframework.beans.factory.InitializingBean; + +/** + * Contains common code used in TransformClients. + * + * @author adavis + */ +public abstract class AbstractTransformClient implements InitializingBean +{ + protected NodeService nodeService; + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + @Override + public void afterPropertiesSet() throws Exception + { + PropertyCheck.mandatory(this, "nodeService", nodeService); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/AbstractTransformServiceRegistry.java b/src/main/java/org/alfresco/repo/rendition2/AbstractTransformServiceRegistry.java new file mode 100644 index 0000000000..0ed3bb5fd3 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/AbstractTransformServiceRegistry.java @@ -0,0 +1,43 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.util.Map; + +/** + * Contains common code used in TransformServiceRegistries. + * + * @author adavis + */ +public abstract class AbstractTransformServiceRegistry implements TransformServiceRegistry +{ + @Override + public boolean isSupported(String sourceMimetype, long size, String targetMimetype, String renditionName, Map options) + { + Long maxSize = getMaxSize(sourceMimetype, targetMimetype, renditionName, options); + return maxSize != null && (maxSize == -1L || maxSize > size); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/LocalTransformClient.java b/src/main/java/org/alfresco/repo/rendition2/LocalTransformClient.java new file mode 100644 index 0000000000..afbbdcc92f --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/LocalTransformClient.java @@ -0,0 +1,390 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.transform.ContentTransformer; +import org.alfresco.repo.content.transform.magick.ImageResizeOptions; +import org.alfresco.repo.content.transform.magick.ImageTransformationOptions; +import org.alfresco.repo.content.transform.swf.SWFTransformationOptions; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.CropSourceOptions; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.PagedSourceOptions; +import org.alfresco.service.cmr.repository.TemporalSourceOptions; +import org.alfresco.service.cmr.repository.TransformationOptionLimits; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.service.cmr.repository.TransformationSourceOptions; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.PropertyCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringJoiner; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import static org.alfresco.repo.rendition2.RenditionDefinition2.ALLOW_ENLARGEMENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.AUTO_ORIENT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_GRAVITY; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_PERCENTAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_WIDTH; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_X_OFFSET; +import static org.alfresco.repo.rendition2.RenditionDefinition2.CROP_Y_OFFSET; +import static org.alfresco.repo.rendition2.RenditionDefinition2.DURATION; +import static org.alfresco.repo.rendition2.RenditionDefinition2.END_PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.FLASH_VERSION; +import static org.alfresco.repo.rendition2.RenditionDefinition2.HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.INCLUDE_CONTENTS; +import static org.alfresco.repo.rendition2.RenditionDefinition2.MAINTAIN_ASPECT_RATIO; +import static org.alfresco.repo.rendition2.RenditionDefinition2.OFFSET; +import static org.alfresco.repo.rendition2.RenditionDefinition2.PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_HEIGHT; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_PERCENTAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.RESIZE_WIDTH; +import static org.alfresco.repo.rendition2.RenditionDefinition2.START_PAGE; +import static org.alfresco.repo.rendition2.RenditionDefinition2.THUMBNAIL; +import static org.alfresco.repo.rendition2.RenditionDefinition2.WIDTH; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_MAX_PAGES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_MAX_SOURCE_SIZE_K_BYTES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_PAGE_LIMIT; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_READ_LIMIT_K_BYTES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_READ_LIMIT_TIME_MS; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_TIMEOUT_MS; +import static org.springframework.util.CollectionUtils.containsAny; + +/** + * Requests rendition transforms take place using transforms available on the local machine. The transform and + * consumption of the resulting content is linked into a single operation that will take place at some point in + * the future on the local machine. + * + * @author adavis + */ +public class LocalTransformClient extends AbstractTransformClient implements TransformClient +{ + private static Log logger = LogFactory.getLog(LocalTransformClient.class); + + private static Set PAGED_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + PAGE, START_PAGE, END_PAGE + })); + + private static Set CROP_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + CROP_GRAVITY, CROP_WIDTH, CROP_HEIGHT, CROP_PERCENTAGE, CROP_X_OFFSET, CROP_Y_OFFSET + })); + + private static Set TEMPORAL_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + OFFSET, DURATION + })); + + private static Set RESIZE_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + WIDTH, HEIGHT, + THUMBNAIL, RESIZE_WIDTH, RESIZE_HEIGHT, RESIZE_PERCENTAGE, + ALLOW_ENLARGEMENT, MAINTAIN_ASPECT_RATIO + })); + + private static Set IMAGE_OPTIONS = new HashSet<>(); + static + { + IMAGE_OPTIONS.addAll(PAGED_OPTIONS); + IMAGE_OPTIONS.addAll(CROP_OPTIONS); + IMAGE_OPTIONS.addAll(TEMPORAL_OPTIONS); + IMAGE_OPTIONS.addAll(RESIZE_OPTIONS); + } + + private static Set PDF_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + PAGE, WIDTH, HEIGHT, ALLOW_ENLARGEMENT, MAINTAIN_ASPECT_RATIO + })); + + private static Set FLASH_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + FLASH_VERSION + })); + + private static Set LIMIT_OPTIONS = new HashSet<>(Arrays.asList(new String[] + { + OPT_TIMEOUT_MS, OPT_READ_LIMIT_TIME_MS, + OPT_MAX_SOURCE_SIZE_K_BYTES, OPT_READ_LIMIT_K_BYTES, + OPT_MAX_PAGES, OPT_PAGE_LIMIT + })); + + private TransactionService transactionService; + + private ContentService contentService; + + private RenditionService2Impl renditionService2; + + private ExecutorService executorService; + + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setRenditionService2(RenditionService2Impl renditionService2) + { + this.renditionService2 = renditionService2; + } + + public void setExecutorService(ExecutorService executorService) + { + this.executorService = executorService; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + PropertyCheck.mandatory(this, "contentService", contentService); + PropertyCheck.mandatory(this, "renditionService2", renditionService2); + if (executorService == null) + { + executorService = Executors.newCachedThreadPool(); + } + } + + @Override + public void checkSupported(NodeRef sourceNodeRef, RenditionDefinition2 renditionDefinition, String sourceMimetype, long size, String contentUrl) + { + String targetMimetype = renditionDefinition.getTargetMimetype(); + String renditionName = renditionDefinition.getRenditionName(); + Map options = renditionDefinition.getTransformOptions(); + + TransformationOptions transformationOptions = getTransformationOptions(renditionName, options); + transformationOptions.setSourceNodeRef(sourceNodeRef); + + ContentTransformer transformer = contentService.getTransformer(contentUrl, sourceMimetype, size, targetMimetype, transformationOptions); + if (transformer == null) + { + String message = "Unsupported rendition " + renditionName + " from " + sourceMimetype + " size: " + size; + logger.debug(message); + throw new UnsupportedOperationException(message); + } + if (logger.isDebugEnabled()) + { + logger.debug("Rendition of " + renditionName + " from " + sourceMimetype + " will use " + transformer.getName()); + } + } + + @Override + public void transform(NodeRef sourceNodeRef, RenditionDefinition2 renditionDefinition, String user, int sourceContentUrlHashCode) + { + executorService.submit(() -> + { + AuthenticationUtil.runAs((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + try + { + String targetMimetype = renditionDefinition.getTargetMimetype(); + String renditionName = renditionDefinition.getRenditionName(); + Map options = renditionDefinition.getTransformOptions(); + + TransformationOptions transformationOptions = getTransformationOptions(renditionName, options); + transformationOptions.setSourceNodeRef(sourceNodeRef); + + ContentReader reader = LocalTransformClient.this.contentService.getReader(sourceNodeRef, ContentModel.PROP_CONTENT); + if (null == reader || !reader.exists()) + { + throw new IllegalArgumentException("The supplied sourceNodeRef "+sourceNodeRef+" has no content."); + } + + ContentWriter writer = contentService.getTempWriter(); + writer.setMimetype(targetMimetype); + contentService.transform(reader, writer, transformationOptions); + + InputStream inputStream = writer.getReader().getContentInputStream(); + renditionService2.consume(sourceNodeRef, inputStream, renditionDefinition, sourceContentUrlHashCode); + } + catch (Exception e) + { + if (logger.isDebugEnabled()) + { + String renditionName = renditionDefinition.getRenditionName(); + logger.debug("Rendition of "+renditionName+" failed", e); + } + renditionService2.failure(sourceNodeRef, renditionDefinition, sourceContentUrlHashCode); + throw e; + } + return null; + }), user); + }); + } + + /** + * @deprecated as we do not plan to use TransformationOptions moving forwards as local transformations will also + * use the same options as the Transform Service. + */ + @Deprecated + static TransformationOptions getTransformationOptions(String renditionName, Map options) + { + TransformationOptions transformationOptions = null; + Set optionNames = options.keySet(); + + Set subclassOptionNames = new HashSet<>(optionNames); + subclassOptionNames.removeAll(LIMIT_OPTIONS); + subclassOptionNames.remove(INCLUDE_CONTENTS); + if (!subclassOptionNames.isEmpty()) + { + if (FLASH_OPTIONS.containsAll(subclassOptionNames)) + { + SWFTransformationOptions opts = new SWFTransformationOptions(); + transformationOptions = opts; + opts.setFlashVersion(options.get(FLASH_VERSION)); + } + else if (IMAGE_OPTIONS.containsAll(subclassOptionNames) || PDF_OPTIONS.containsAll(subclassOptionNames)) + { + ImageTransformationOptions opts = new ImageTransformationOptions(); + transformationOptions = opts; + + if (containsAny(subclassOptionNames, RESIZE_OPTIONS)) + { + ImageResizeOptions imageResizeOptions = new ImageResizeOptions(); + opts.setResizeOptions(imageResizeOptions); + ifSet(options, WIDTH, (v) -> imageResizeOptions.setWidth(Integer.parseInt(v))); + ifSet(options, RESIZE_WIDTH, (v) -> imageResizeOptions.setWidth(Integer.parseInt(v))); + ifSet(options, HEIGHT, (v) -> imageResizeOptions.setHeight(Integer.parseInt(v))); + ifSet(options, RESIZE_HEIGHT, (v) -> imageResizeOptions.setHeight(Integer.parseInt(v))); + ifSet(options, THUMBNAIL, (v) ->imageResizeOptions.setResizeToThumbnail(Boolean.parseBoolean(v))); + ifSet(options, RESIZE_PERCENTAGE, (v) ->imageResizeOptions.setPercentResize(Boolean.parseBoolean(v))); + ifSet(options, ALLOW_ENLARGEMENT, (v) ->imageResizeOptions.setAllowEnlargement(Boolean.parseBoolean(v))); + ifSet(options, MAINTAIN_ASPECT_RATIO, (v) ->imageResizeOptions.setMaintainAspectRatio(Boolean.parseBoolean(v))); + } + + ifSet(options, AUTO_ORIENT, (v) ->opts.setAutoOrient(Boolean.parseBoolean(v))); + + boolean containsPaged = containsAny(subclassOptionNames, PAGED_OPTIONS); + boolean containsCrop = containsAny(subclassOptionNames, CROP_OPTIONS); + boolean containsTemporal = containsAny(subclassOptionNames, TEMPORAL_OPTIONS); + if (containsPaged || containsCrop || containsTemporal) + { + List sourceOptionsList = new ArrayList<>(); + opts.setSourceOptionsList(sourceOptionsList); + if (containsPaged) + { + PagedSourceOptions pagedSourceOptions = new PagedSourceOptions(); + sourceOptionsList.add(pagedSourceOptions); + ifSet(options, START_PAGE, (v) -> pagedSourceOptions.setStartPageNumber(Integer.parseInt(v))); + ifSet(options, END_PAGE, (v) -> pagedSourceOptions.setEndPageNumber(Integer.parseInt(v))); + ifSet(options, PAGE, (v) -> + { + int i = Integer.parseInt(v); + pagedSourceOptions.setStartPageNumber(i); + pagedSourceOptions.setEndPageNumber(i); + }); + } + + if (containsCrop) + { + CropSourceOptions cropSourceOptions = new CropSourceOptions(); + sourceOptionsList.add(cropSourceOptions); + ifSet(options, CROP_GRAVITY, (v) -> cropSourceOptions.setGravity(v)); + ifSet(options, CROP_PERCENTAGE, (v) -> cropSourceOptions.setPercentageCrop(Boolean.parseBoolean(v))); + ifSet(options, CROP_WIDTH, (v) -> cropSourceOptions.setWidth(Integer.parseInt(v))); + ifSet(options, CROP_HEIGHT, (v) -> cropSourceOptions.setHeight(Integer.parseInt(v))); + ifSet(options, CROP_X_OFFSET, (v) -> cropSourceOptions.setXOffset(Integer.parseInt(v))); + ifSet(options, CROP_Y_OFFSET, (v) -> cropSourceOptions.setYOffset(Integer.parseInt(v))); + } + + if (containsTemporal) + { + TemporalSourceOptions temporalSourceOptions = new TemporalSourceOptions(); + sourceOptionsList.add(temporalSourceOptions); + ifSet(options, DURATION, (v) -> temporalSourceOptions.setDuration(v)); + ifSet(options, OFFSET, (v) -> temporalSourceOptions.setOffset(v)); + } + } + } + } + + if (transformationOptions == null) + { + StringJoiner sj = new StringJoiner("\n "); + sj.add("The RenditionDefinition2 "+renditionName + + " contains options that cannot be mapped to TransformationOptions used by local transformers"); + HashSet otherNames = new HashSet<>(optionNames); + otherNames.removeAll(FLASH_OPTIONS); + otherNames.removeAll(IMAGE_OPTIONS); + otherNames.removeAll(PDF_OPTIONS); + otherNames.removeAll(LIMIT_OPTIONS); + otherNames.forEach(sj::add); + sj.add("---"); + optionNames.forEach(sj::add); + throw new IllegalArgumentException(sj.toString()); + } + + final TransformationOptions opts = transformationOptions; + ifSet(options, INCLUDE_CONTENTS, (v) ->opts.setIncludeEmbedded(Boolean.parseBoolean(v))); + + if (containsAny(optionNames, LIMIT_OPTIONS)) + { + TransformationOptionLimits limits = new TransformationOptionLimits(); + transformationOptions.setLimits(limits); + ifSet(options, OPT_TIMEOUT_MS, (v) -> limits.setTimeoutMs(Long.parseLong(v))); + ifSet(options, OPT_READ_LIMIT_TIME_MS, (v) -> limits.setReadLimitTimeMs(Long.parseLong(v))); + ifSet(options, OPT_MAX_PAGES, (v) -> limits.setMaxPages(Integer.parseInt(v))); + ifSet(options, OPT_PAGE_LIMIT, (v) -> limits.setPageLimit(Integer.parseInt(v))); + ifSet(options, OPT_MAX_SOURCE_SIZE_K_BYTES, (v) -> limits.setMaxSourceSizeKBytes(Long.parseLong(v))); + ifSet(options, OPT_READ_LIMIT_K_BYTES, (v) -> limits.setReadLimitKBytes(Long.parseLong(v))); + } + + transformationOptions.setUse(renditionName); + return transformationOptions; + } + + private interface Setter { + void set(String s); + } + + private static void ifSet(Map options, String key, Setter setter) + { + String value = options.get(key); + if (value != null) + { + setter.set(value); + } + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/LocalTransformServiceRegistry.java b/src/main/java/org/alfresco/repo/rendition2/LocalTransformServiceRegistry.java new file mode 100644 index 0000000000..a8d0cee5e5 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/LocalTransformServiceRegistry.java @@ -0,0 +1,63 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.util.PropertyCheck; +import org.springframework.beans.factory.InitializingBean; + +import java.util.Map; + +/** + * Implements {@link TransformServiceRegistry} providing a mechanism of validating if a local transformation request is + * supported. + * + * @author adavis + */ +public class LocalTransformServiceRegistry extends AbstractTransformServiceRegistry implements InitializingBean +{ + private static ContentService contentService; + + public static void setContentService(ContentService contentService) + { + LocalTransformServiceRegistry.contentService = contentService; + } + + @Override + public void afterPropertiesSet() + { + PropertyCheck.mandatory(this, "contentService", contentService); + } + + @Override + public Long getMaxSize(String sourceMimetype, String targetMimetype, String renditionName, Map options) + { + TransformationOptions transformationOptions = LocalTransformClient.getTransformationOptions(renditionName, options); + long maxSize = contentService.getMaxSourceSizeBytes(sourceMimetype, targetMimetype, transformationOptions); + return maxSize == 0 ? null : maxSize; + } +} \ No newline at end of file diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2.java b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2.java new file mode 100644 index 0000000000..a548d965db --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2.java @@ -0,0 +1,103 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.api.AlfrescoPublicApi; + +import java.util.Map; + +/** + * Defines a rendition in terms of name, target mimetype and transform options need to get there. + * {@link RenditionDefinition2}s need to be registered in a {@link RenditionDefinitionRegistry2}. + * + * @author adavis + */ +@AlfrescoPublicApi +public interface RenditionDefinition2 +{ + // ImageMagick options + + public static final String START_PAGE = "startPage"; + public static final String END_PAGE = "endPage"; + + public static final String ALPHA_REMOVE = "alphaRemove"; + public static final String AUTO_ORIENT = "autoOrient"; + + public static final String CROP_GRAVITY = "cropGravity"; + public static final String CROP_WIDTH = "cropWidth"; + public static final String CROP_HEIGHT = "cropHeight"; + public static final String CROP_PERCENTAGE = "cropPercentage"; + public static final String CROP_X_OFFSET = "cropXOffset"; + public static final String CROP_Y_OFFSET = "cropYOffset"; + + /** Indicates whether to resize image to a thumbnail (true or false). */ + public static final String THUMBNAIL = "thumbnail"; + public static final String RESIZE_WIDTH = "resizeWidth"; + public static final String RESIZE_HEIGHT = "resizeHeight"; + public static final String RESIZE_PERCENTAGE = "resizePercentage"; + + + // ImageMagick & PdfRenderer options + + /** Indicates whether scaling operations should scale up or down (true or false). */ + public static final String ALLOW_ENLARGEMENT = "allowEnlargement"; + + /** Indicates whether the aspect ratio of the image should be maintained (true or false). */ + public static final String MAINTAIN_ASPECT_RATIO = "maintainAspectRatio"; + + + // PdfRenderer options + + public static final String PAGE = "page"; + public static final String WIDTH = "width"; + public static final String HEIGHT = "height"; + + + // Video options + + /** Time from start. Format hh:mm:ss[.xxx] */ + public static final String OFFSET = "offset"; + + /** Duration of clip. */ + public static final String DURATION = "duration"; + + /** Indicates if embedded content (such as files within zips or images) should be included (true or false). */ + public static final String INCLUDE_CONTENTS = "includeContents"; + + /** + * @deprecated Will be removed when local transformations are removed, as it is only used tp select + * SWIFTransformationOptions. + */ + @Deprecated + String FLASH_VERSION = "flashVersion"; + + + String getRenditionName(); + + String getTargetMimetype(); + + Map getTransformOptions(); +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2Impl.java b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2Impl.java new file mode 100644 index 0000000000..b6a56cdeff --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinition2Impl.java @@ -0,0 +1,92 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.util.Map; +import java.util.Objects; + +/** + * Standard implementation. + * + * @author adavis + */ +public class RenditionDefinition2Impl implements RenditionDefinition2 +{ + private final String renditionName; + private final String targetMimetype; + private final Map transformOptions; + + public RenditionDefinition2Impl(String renditionName, String targetMimetype, Map transformOptions, + RenditionDefinitionRegistry2Impl registry) + { + this.renditionName = renditionName; + this.targetMimetype = targetMimetype; + this.transformOptions = transformOptions; + if (registry != null) + { + registry.register(this); + } + } + + @Override + public String getRenditionName() + { + return renditionName; + } + + @Override + public String getTargetMimetype() + { + return targetMimetype; + } + + @Override + public Map getTransformOptions() + { + return transformOptions; + } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (!(o instanceof RenditionDefinition2Impl)) + { + return false; + } + RenditionDefinition2Impl that = (RenditionDefinition2Impl) o; + return Objects.equals(renditionName, that.renditionName); + } + + @Override + public int hashCode() + { + return Objects.hash(renditionName); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2.java b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2.java new file mode 100644 index 0000000000..c93995fefa --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2.java @@ -0,0 +1,47 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.util.Set; + +/** + * A registry of rendition definitions. + * + * @author adavis + */ +public interface RenditionDefinitionRegistry2 +{ + Set getRenditionNames(); + + /** + * Obtains the names of renditions that are possible from a given source mimetype. + * @param sourceMimetype the mimetype of the source. + * @param size the size of the source. May be {@code -1} if the size should be ignored. + */ + Set getRenditionNamesFrom(String sourceMimetype, long size); + + RenditionDefinition2 getRenditionDefinition(String renditionName); +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2Impl.java b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2Impl.java new file mode 100644 index 0000000000..e59be7c103 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionDefinitionRegistry2Impl.java @@ -0,0 +1,147 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.util.Pair; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * A registry of rendition definitions. + * + * @author adavis + */ +public class RenditionDefinitionRegistry2Impl implements RenditionDefinitionRegistry2 +{ + private TransformServiceRegistry transformServiceRegistry; + + private final Map renditionDefinitions = new HashMap(); + private final Map>> renditionsFor = new HashMap<>(); + + public void setTransformServiceRegistry(TransformServiceRegistry transformServiceRegistry) + { + this.transformServiceRegistry = transformServiceRegistry; + } + + /** + * Obtains a {@link RenditionDefinition2} by name. + * @param renditionName to be returned + * @return the {@link RenditionDefinition2} or null if not registered. + */ + public RenditionDefinition2 getDefinition(String renditionName) + { + return renditionDefinitions.get(renditionName); + } + + public void register(RenditionDefinition2 renditionDefinition) + { + String renditionName = renditionDefinition.getRenditionName(); + RenditionDefinition2 original = getDefinition(renditionName); + if (original != null) + { + throw new IllegalArgumentException("RenditionDefinition "+renditionName+" was already registered."); + } + renditionDefinitions.put(renditionName, renditionDefinition); + } + + public void unregister(String renditionName) + { + if (renditionDefinitions.remove(renditionName) == null) + { + throw new IllegalArgumentException("RenditionDefinition "+renditionName+" was not registered."); + } + } + + @Override + public Set getRenditionNames() + { + return renditionDefinitions.keySet(); + } + + @Override + public Set getRenditionNamesFrom(String sourceMimetype, long size) + { + Set> renditionNamesWithMaxSize; + synchronized (renditionsFor) + { + renditionNamesWithMaxSize = renditionsFor.get(sourceMimetype); + if (renditionNamesWithMaxSize == null) + { + renditionNamesWithMaxSize = getRenditionNamesWithMaxSize(sourceMimetype); + renditionsFor.put(sourceMimetype, renditionNamesWithMaxSize); + } + } + + if (renditionNamesWithMaxSize.isEmpty()) + { + return Collections.emptySet(); + } + + Set renditionNames = new HashSet<>(); + for (Pair pair : renditionNamesWithMaxSize) + { + Long maxSize = pair.getSecond(); + if (maxSize == -1L || maxSize >= size) + { + String renditionName = pair.getFirst(); + renditionNames.add(renditionName); + } + } + return renditionNames; + } + + // Gets a list of rendition names that can be created from the given sourceMimetype. + // Includes the maxSize for each. + private Set> getRenditionNamesWithMaxSize(String sourceMimetype) + { + Set> renditions = new HashSet(); + for (Map.Entry entry : renditionDefinitions.entrySet()) + { + RenditionDefinition2 renditionDefinition2 = entry.getValue(); + String targetMimetype = renditionDefinition2.getTargetMimetype(); + String renditionName = renditionDefinition2.getRenditionName(); + Map options = renditionDefinition2.getTransformOptions(); + Long maxSize = transformServiceRegistry.getMaxSize(sourceMimetype, targetMimetype, renditionName, options); + if (maxSize != null) + { + String renditionNameMaxSizePair = entry.getKey(); + Pair pair = new Pair<>(renditionNameMaxSizePair, maxSize); + renditions.add(pair); + } + } + return renditions; + } + + @Override + public RenditionDefinition2 getRenditionDefinition(String renditionName) + { + return renditionDefinitions.get(renditionName); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionService2.java b/src/main/java/org/alfresco/repo/rendition2/RenditionService2.java new file mode 100644 index 0000000000..cfb249f5e1 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionService2.java @@ -0,0 +1,101 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.service.NotAuditable; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; + +import java.util.List; + +/** + * The Async Rendition service. Replaces the original rendition services which included synchronous renditions and + * asynchronous methods with Java call backs.

+ * + * Renditions are defined as {@link RenditionDefinition2}s and may be registered and looked by the associated + * {@link RenditionDefinitionRegistry2}.

+ * + * Unlike the original RenditionService this service, it: + *

    + *
  • Performs async renditions without a Java callback, as another node in the cluster may complete the rendition. + * The current node requests a transform, but another node might take the resulting transform and turn it into a + * rendition if the external Transform Service is used.
  • + *
  • Reduces the configurable options to do with with the associations of rendition nodes, their type. They + * are identical to 'hidden' (not normally seen as nodes in their own right in a + * UI) renditions produced by the original service. So, they are always directly under the source node connected by a + * {@code}rn:rendition{@code} association with the name of the rendition.
  • + *
  • The rendition nodes additionally have a {@code}rn:rendition2{@code} aspect and a {@code}contentUrlHashCode{@code} + * property. This property contains a value that allows the service to work out if it holds a rendition of the + * source node's current content.
  • + *
  • Failures are handled by setting the rendition node's content to null.
  • + *
  • When a rendition is requested via the REST API, only the newer service is used.
  • + *
  • Where possible old service renditions migrate automatically over to the new service when content on a + * source node is updated.
  • + *
+ * + * @author adavis + */ +public interface RenditionService2 +{ + /** + * @return the {@link RenditionDefinitionRegistry2} being used by the service. + */ + RenditionDefinitionRegistry2 getRenditionDefinitionRegistry2(); + + /** + * This method asynchronously renders content as specified by the {@code renditionName}. The content to be + * rendered is provided by {@code sourceNodeRef}. + * + * @param sourceNodeRef the node from which the content is retrieved. + * @param renditionName the rendition to be performed. + */ + @NotAuditable + public void render(NodeRef sourceNodeRef, String renditionName); + + /** + * This method gets all the renditions of the {@code sourceNodeRef}. + * + * @return a list of {@link ChildAssociationRef}s which link the {@code sourceNodeRef} to the renditions. + */ + @NotAuditable + List getRenditions(NodeRef sourceNodeRef); + + /** + * This method gets the rendition of the {@code sourceNodeRef} identified by its name. + * + * @param sourceNodeRef the source node for the renditions + * @param renditionName the renditionName used to identify a rendition. + * @return the {@link ChildAssociationRef} which links the source node to the + * rendition or null if there is no rendition or it is not up to date. + */ + @NotAuditable + ChildAssociationRef getRenditionByName(NodeRef sourceNodeRef, String renditionName); + + /** + * Indicates if renditions are enabled. Set using the {@code system.thumbnail.generate} value. + */ + boolean isEnabled(); +} \ No newline at end of file diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionService2Exception.java b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Exception.java new file mode 100644 index 0000000000..5d9bae7c04 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Exception.java @@ -0,0 +1,59 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.error.AlfrescoRuntimeException; + +/** + * Rendition Service 2 Exception Class. + * + * @author adavis + */ +public class RenditionService2Exception extends AlfrescoRuntimeException +{ + private static final long serialVersionUID = -8212685737533192728L; + + /** + * Constructs a Rendition Service 2 Exception with the specified message. + * + * @param message the message string + */ + public RenditionService2Exception(String message) + { + super(message); + } + + /** + * Constructs a Rendition Service Exception 2 with the specified message and source exception. + * + * @param message the message string + * @param source the source exception + */ + public RenditionService2Exception(String message, Throwable source) + { + super(message, source); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java new file mode 100644 index 0000000000..2ebb3e89e8 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionService2Impl.java @@ -0,0 +1,674 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.model.ContentModel; +import org.alfresco.model.RenditionModel; +import org.alfresco.repo.content.ContentServicePolicies; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.rendition.RenditionPreventionRegistry; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.util.PostTxnCallbackScheduler; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.cmr.rule.RuleType; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.namespace.RegexQNamePattern; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.PropertyCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.InitializingBean; + +import java.io.InputStream; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import static org.alfresco.model.ContentModel.PROP_CONTENT; +import static org.alfresco.model.RenditionModel.PROP_RENDITION_CONTENT_URL_HASH_CODE; +import static org.alfresco.service.namespace.QName.createQName; + +/** + * The Async Rendition service. Replaces the original deprecated RenditionService. + * + * @author adavis + */ +public class RenditionService2Impl implements RenditionService2, InitializingBean, ContentServicePolicies.OnContentUpdatePolicy +{ + public static final String TRANSFORMING_ERROR_MESSAGE = "Some error occurred during document transforming. Error message: "; + + public static final QName DEFAULT_RENDITION_CONTENT_PROP = ContentModel.PROP_CONTENT; + public static final String DEFAULT_MIMETYPE = MimetypeMap.MIMETYPE_TEXT_PLAIN; + public static final String DEFAULT_ENCODING = "UTF-8"; + + public static final int SOURCE_HAS_NO_CONTENT = -1; + public static final int RENDITION2_DOES_NOT_EXIST = -2; + + private static Log logger = LogFactory.getLog(RenditionService2Impl.class); + + private TransactionService transactionService; + private NodeService nodeService; + private ContentService contentService; + private RenditionPreventionRegistry renditionPreventionRegistry; + private RenditionDefinitionRegistry2 renditionDefinitionRegistry2; + private TransformClient transformClient; + private PolicyComponent policyComponent; + private BehaviourFilter behaviourFilter; + private RuleService ruleService; + private PostTxnCallbackScheduler renditionRequestSheduler; + private boolean enabled; + private boolean thumbnailsEnabled; + + public void setRenditionRequestSheduler(PostTxnCallbackScheduler renditionRequestSheduler) + { + this.renditionRequestSheduler = renditionRequestSheduler; + } + + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setRenditionPreventionRegistry(RenditionPreventionRegistry renditionPreventionRegistry) + { + this.renditionPreventionRegistry = renditionPreventionRegistry; + } + + public void setRenditionDefinitionRegistry2(RenditionDefinitionRegistry2 renditionDefinitionRegistry2) + { + this.renditionDefinitionRegistry2 = renditionDefinitionRegistry2; + } + + @Override + public RenditionDefinitionRegistry2 getRenditionDefinitionRegistry2() + { + return renditionDefinitionRegistry2; + } + + public void setTransformClient(TransformClient transformClient) + { + this.transformClient = transformClient; + } + + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + public void setBehaviourFilter(BehaviourFilter behaviourFilter) + { + this.behaviourFilter = behaviourFilter; + } + + public void setRuleService(RuleService ruleService) + { + this.ruleService = ruleService; + } + + public void setEnabled(boolean enabled) + { + this.enabled = enabled; + } + + public void setThumbnailsEnabled(boolean thumbnailsEnabled) + { + this.thumbnailsEnabled = thumbnailsEnabled; + } + + public boolean isThumbnailsEnabled() + { + return thumbnailsEnabled; + } + + @Override + public void afterPropertiesSet() throws Exception + { + PropertyCheck.mandatory(this, "transactionService", transactionService); + PropertyCheck.mandatory(this, "nodeService", nodeService); + PropertyCheck.mandatory(this, "contentService", contentService); + PropertyCheck.mandatory(this, "renditionPreventionRegistry", renditionPreventionRegistry); + PropertyCheck.mandatory(this, "renditionDefinitionRegistry2", renditionDefinitionRegistry2); + PropertyCheck.mandatory(this, "transformClient", transformClient); + PropertyCheck.mandatory(this, "policyComponent", policyComponent); + PropertyCheck.mandatory(this, "behaviourFilter", behaviourFilter); + PropertyCheck.mandatory(this, "ruleService", ruleService); + + // TODO use raw events + policyComponent.bindClassBehaviour( + ContentServicePolicies.OnContentUpdatePolicy.QNAME, + RenditionModel.ASPECT_RENDITIONED, + new JavaBehaviour(this, "onContentUpdate")); + } + + public void render(NodeRef sourceNodeRef, String renditionName) + { + try + { + if (!isEnabled()) + { + throw new RenditionService2Exception("Renditions are disabled (system.thumbnail.generate=false or renditionService2.enabled=false)."); + } + + if (!nodeService.exists(sourceNodeRef)) + { + throw new IllegalArgumentException("The supplied sourceNodeRef "+sourceNodeRef+" does not exist."); + } + + checkSourceNodeForPreventionClass(sourceNodeRef); + + RenditionDefinition2 renditionDefinition = renditionDefinitionRegistry2.getRenditionDefinition(renditionName); + if (renditionDefinition == null) + { + throw new IllegalArgumentException("The rendition "+renditionName+" has not been registered."); + } + + if (logger.isDebugEnabled()) + { + logger.debug("Request transform for rendition " + renditionName + " on " +sourceNodeRef); + } + + ContentData contentData = (ContentData) nodeService.getProperty(sourceNodeRef, ContentModel.PROP_CONTENT); + if (contentData != null && contentData.getContentUrl() != null) + { + String contentUrl = contentData.getContentUrl(); + String sourceMimetype = contentData.getMimetype(); + long size = contentData.getSize(); + transformClient.checkSupported(sourceNodeRef, renditionDefinition, sourceMimetype, size, contentUrl); + } + + String user = AuthenticationUtil.getRunAsUser(); + RetryingTransactionHelper.RetryingTransactionCallback callback = () -> + { + // Avoid doing extra transforms that have already been done. + int sourceContentUrlHashCode = getSourceContentUrlHashCode(sourceNodeRef); + NodeRef renditionNode = getRenditionNode(sourceNodeRef, renditionName); + int renditionContentUrlHashCode = getRenditionContentUrlHashCode(renditionNode); + if (renditionContentUrlHashCode == sourceContentUrlHashCode) + { + throw new IllegalStateException("The rendition " + renditionName + " has already been created."); + } + + // If source node has content + if (sourceContentUrlHashCode != SOURCE_HAS_NO_CONTENT) + { + transformClient.transform(sourceNodeRef, renditionDefinition, user, sourceContentUrlHashCode); + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("Rendition of "+renditionName+" had no content."); + } + failure(sourceNodeRef, renditionDefinition, sourceContentUrlHashCode); + } + return null; + }; + renditionRequestSheduler.scheduleRendition(callback, sourceNodeRef + renditionName); + } + catch (Exception e) + { + logger.debug(e.getMessage()); + throw e; + } + } + + public void failure(NodeRef sourceNodeRef, RenditionDefinition2 renditionDefinition, int transformContentUrlHashCode) + { + // The original transaction may have already have failed + AuthenticationUtil.runAsSystem((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + consume(sourceNodeRef, null, renditionDefinition, transformContentUrlHashCode); + return null; + }, false, true)); + } + + /** + * Takes a transformation (InputStream) and attaches it as a rendition to the source node. + * Does nothing if there is already a newer rendition. + * If the transformInputStream is null, this is taken to be a transform failure. + */ + public void consume(NodeRef sourceNodeRef, InputStream transformInputStream, RenditionDefinition2 renditionDefinition, + int transformContentUrlHashCode) + { + String renditionName = renditionDefinition.getRenditionName(); + int sourceContentUrlHashCode = getSourceContentUrlHashCode(sourceNodeRef); + + if (transformContentUrlHashCode != sourceContentUrlHashCode) + { + if (logger.isDebugEnabled()) + { + logger.debug("Ignore transform for rendition " + renditionName + " on " + sourceNodeRef + " as it is no longer needed"); + } + } + else + { + if (logger.isDebugEnabled()) + { + logger.debug("Set the content of rendition " + renditionName + " on " + sourceNodeRef + + (transformInputStream == null ? " to null as the transform failed" : " to the transform result")); + } + + AuthenticationUtil.runAsSystem((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + // Ensure that the creation of a rendition does not cause updates to the modified, modifier properties on the source node + NodeRef renditionNode = getRenditionNode(sourceNodeRef, renditionName); + boolean createRenditionNode = renditionNode == null; + Date sourceModified = (Date) nodeService.getProperty(sourceNodeRef, ContentModel.PROP_MODIFIED); + boolean sourceHasAspectRenditioned = nodeService.hasAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED); + boolean sourceChanges = !sourceHasAspectRenditioned || createRenditionNode || sourceModified != null || transformInputStream == null; + try + { + if (sourceChanges) + { + ruleService.disableRuleType(RuleType.UPDATE); + behaviourFilter.disableBehaviour(sourceNodeRef, ContentModel.ASPECT_AUDITABLE); + behaviourFilter.disableBehaviour(sourceNodeRef, ContentModel.ASPECT_VERSIONABLE); + } + + // If they do not exist create the rendition association and the rendition node. + if (createRenditionNode) + { + renditionNode = createRenditionNode(sourceNodeRef, renditionDefinition); + } + else if (!nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2)) + { + nodeService.addAspect(renditionNode, RenditionModel.ASPECT_RENDITION2, null); + if (logger.isDebugEnabled()) + { + logger.debug("Added rendition2 aspect to rendition " + renditionName + " on " + sourceNodeRef); + } + } + nodeService.setProperty(renditionNode, RenditionModel.PROP_RENDITION_CONTENT_URL_HASH_CODE, transformContentUrlHashCode); + if (sourceModified != null) + { + setThumbnailLastModified(sourceNodeRef, renditionName, sourceModified); + } + + if (transformInputStream != null) + { + try + { + // Set or replace rendition content + ContentWriter contentWriter = contentService.getWriter(renditionNode, DEFAULT_RENDITION_CONTENT_PROP, true); + String targetMimetype = renditionDefinition.getTargetMimetype(); + contentWriter.setMimetype(targetMimetype); + contentWriter.setEncoding(DEFAULT_ENCODING); + ContentWriter renditionWriter = contentWriter; + renditionWriter.putContent(transformInputStream); + } + catch (Exception e) + { + logger.error("Failed to read transform InputStream into rendition " + renditionName + " on " + sourceNodeRef); + throw e; + } + } + else + { + Serializable content = nodeService.getProperty(renditionNode, PROP_CONTENT); + if (content != null) + { + nodeService.removeProperty(renditionNode, PROP_CONTENT); + } + } + + if (!sourceHasAspectRenditioned) + { + nodeService.addAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED, null); + } + } + catch (Exception e) + { + throw new RenditionService2Exception(TRANSFORMING_ERROR_MESSAGE + e.getMessage(), e); + } + finally + { + if (sourceChanges) + { + behaviourFilter.enableBehaviour(sourceNodeRef, ContentModel.ASPECT_AUDITABLE); + behaviourFilter.enableBehaviour(sourceNodeRef, ContentModel.ASPECT_VERSIONABLE); + ruleService.enableRuleType(RuleType.UPDATE); + } + } + return null; + }, false, true)); + } + } + + // Based on original AbstractRenderingEngine.createRenditionNodeAssoc + private NodeRef createRenditionNode(NodeRef sourceNode, RenditionDefinition2 renditionDefinition) + { + String renditionName = renditionDefinition.getRenditionName(); + + Map nodeProps = new HashMap(); + nodeProps.put(ContentModel.PROP_NAME, renditionName); + nodeProps.put(ContentModel.PROP_THUMBNAIL_NAME, renditionName); + nodeProps.put(ContentModel.PROP_CONTENT_PROPERTY_NAME, ContentModel.PROP_CONTENT); + nodeProps.put(ContentModel.PROP_IS_INDEXED, Boolean.FALSE); + + QName assocName = createQName(NamespaceService.CONTENT_MODEL_1_0_URI, renditionName); + QName assocType = RenditionModel.ASSOC_RENDITION; + QName nodeType = ContentModel.TYPE_THUMBNAIL; + + ChildAssociationRef childAssoc = nodeService.createNode(sourceNode, assocType, assocName, nodeType, nodeProps); + NodeRef renditionNode = childAssoc.getChildRef(); + + nodeService.addAspect(renditionNode, RenditionModel.ASPECT_RENDITION2, null); + nodeService.addAspect(renditionNode, RenditionModel.ASPECT_HIDDEN_RENDITION, null); + + if (logger.isDebugEnabled()) + { + logger.debug("Created " + renditionName + " rendition node " + childAssoc.getChildRef() + " as a child of " + sourceNode); + } + + return renditionNode; + } + + // Based on code from org.alfresco.repo.thumbnail.ThumbnailServiceImpl.addThumbnailModificationData + private void setThumbnailLastModified(NodeRef sourceNodeRef, String renditionName, Date sourceModified) + { + String prefix = renditionName + ':'; + final String lastModifiedValue = prefix + sourceModified.getTime(); + + if (logger.isTraceEnabled()) + { + logger.trace("Setting thumbnail last modified date to " + lastModifiedValue +" on source node: " + sourceNodeRef); + } + + if (nodeService.hasAspect(sourceNodeRef, ContentModel.ASPECT_THUMBNAIL_MODIFICATION)) + { + List thumbnailMods = (List) nodeService.getProperty(sourceNodeRef, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA); + String target = null; + for (String currThumbnailMod: thumbnailMods) + { + if (currThumbnailMod.startsWith(prefix)) + { + target = currThumbnailMod; + } + } + if (target != null) + { + thumbnailMods.remove(target); + } + thumbnailMods.add(lastModifiedValue); + nodeService.setProperty(sourceNodeRef, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA, (Serializable) thumbnailMods); + } + else + { + List thumbnailMods = Collections.singletonList(lastModifiedValue); + Map properties = new HashMap<>(); + properties.put(ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA, (Serializable) thumbnailMods); + nodeService.addAspect(sourceNodeRef, ContentModel.ASPECT_THUMBNAIL_MODIFICATION, properties); + } + } + + /** + * Returns the hash code of the source node's content url. As transformations may be returned in a different + * sequences to which they were requested, this is used work out if a rendition should be replaced. + */ + private int getSourceContentUrlHashCode(NodeRef sourceNodeRef) + { + int hashCode = SOURCE_HAS_NO_CONTENT; + ContentData contentData = DefaultTypeConverter.INSTANCE.convert(ContentData.class, nodeService.getProperty(sourceNodeRef, PROP_CONTENT)); + if (contentData != null) + { + String contentUrl = contentData.getContentUrl(); + if (contentUrl != null) + { + hashCode = contentUrl.hashCode(); + } + } + return hashCode; + } + + /** + * Returns the hash code of source node's content url on the rendition node (node may be null) if it does not exist. + * Used work out if a rendition should be replaced. {@code -2} is returned if the rendition does not exist or was + * not created by RenditionService2. + */ + private int getRenditionContentUrlHashCode(NodeRef renditionNode) + { + return renditionNode == null || !nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2) + ? RENDITION2_DOES_NOT_EXIST + : (int)nodeService.getProperty(renditionNode, PROP_RENDITION_CONTENT_URL_HASH_CODE); + } + + private NodeRef getRenditionNode(NodeRef sourceNodeRef, String renditionName) + { + QName renditionQName = createQName(NamespaceService.CONTENT_MODEL_1_0_URI, renditionName); + List renditionAssocs = nodeService.getChildAssocs(sourceNodeRef, RenditionModel.ASSOC_RENDITION, renditionQName); + return renditionAssocs.isEmpty() ? null : renditionAssocs.get(0).getChildRef(); + } + + // Only called by the old service to work out if a rendition was created by the new service. + public boolean isCreatedByRenditionService2(NodeRef sourceNodeRef, String renditionName) + { + boolean result = false; + NodeRef renditionNode = getRenditionNode(sourceNodeRef, renditionName); + if (renditionNode != null) + { + result = nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2); + } + return result; + } + + // Only called by the old service, so that it can take over. Normally RenditionService2 just updates + // rendition nodes to new versions, or to mark them as failed. The older service creates new nodes. + public void deleteRendition(NodeRef sourceNodeRef, String renditionName) + { + NodeRef renditionNode = getRenditionNode(sourceNodeRef, renditionName); + if (renditionNode != null) + { + if (nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2)) + { + nodeService.deleteNode(renditionNode); + } + } + } + + /** + * This method checks whether the specified source node is of a content class which has been registered for + * rendition prevention. + * + * @param sourceNode the node to check. + * @throws RenditionService2PreventedException if the source node is configured for rendition prevention. + */ + // This code is based on the old RenditionServiceImpl.checkSourceNodeForPreventionClass(...) + private void checkSourceNodeForPreventionClass(NodeRef sourceNode) + { + if (sourceNode != null && nodeService.exists(sourceNode)) + { + // A node's content class is its type and all its aspects. + Set nodeContentClasses = nodeService.getAspects(sourceNode); + nodeContentClasses.add(nodeService.getType(sourceNode)); + + for (QName contentClass : nodeContentClasses) + { + if (renditionPreventionRegistry.isContentClassRegistered(contentClass)) + { + String msg = "Node " + sourceNode + " cannot be renditioned as it is of class " + contentClass; + logger.debug(msg); + throw new RenditionService2PreventedException(msg); + } + } + } + } + + private List getRenditionChildAssociations(NodeRef sourceNodeRef) + { + // Copy of code from the original RenditionService. + List result = Collections.emptyList(); + + // Check that the node has the renditioned aspect applied + if (nodeService.hasAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED)) + { + // Get all the renditions that match the given rendition name + result = nodeService.getChildAssocs(sourceNodeRef, RenditionModel.ASSOC_RENDITION, RegexQNamePattern.MATCH_ALL); + } + return result; + } + + @Override + // Only returns valid renditions. These may be from RenditionService2 or original RenditionService. + public List getRenditions(NodeRef sourceNodeRef) + { + List result = new ArrayList<>(); + List childAsocs = getRenditionChildAssociations(sourceNodeRef); + + for (ChildAssociationRef childAssoc : childAsocs) + { + NodeRef renditionNode = childAssoc.getChildRef(); + if (isRenditionAvailable(sourceNodeRef, renditionNode)) + { + result.add(childAssoc); + } + } + return result; + } + + /** + * Indicates if the rendition is available. Failed renditions (there was an error) don't have a contentUrl + * and out of date renditions or those still being created don't have a matching contentUrlHashCode. + */ + public boolean isRenditionAvailable(NodeRef sourceNodeRef, NodeRef renditionNode) + { + boolean available = true; + if (nodeService.hasAspect(renditionNode, RenditionModel.ASPECT_RENDITION2)) + { + Serializable contentUrl = nodeService.getProperty(renditionNode, ContentModel.PROP_CONTENT); + if (contentUrl == null) + { + available = false; + } + else + { + int sourceContentUrlHashCode = getSourceContentUrlHashCode(sourceNodeRef); + int renditionContentUrlHashCode = getRenditionContentUrlHashCode(renditionNode); + if (sourceContentUrlHashCode != renditionContentUrlHashCode) + { + available = false; + } + } + } + return available; + } + + @Override + // Only returns a valid renditions. This may be from RenditionService2 or original RenditionService. + public ChildAssociationRef getRenditionByName(NodeRef sourceNodeRef, String renditionName) + { + // Based on code from the original RenditionService. renditionName is a String rather than a QName. + List renditions = Collections.emptyList(); + + // Thumbnails have a cm: prefix. + QName renditionQName = createQName(NamespaceService.CONTENT_MODEL_1_0_URI, renditionName); + + // Check that the sourceNodeRef has the renditioned aspect applied + if (nodeService.hasAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED)) + { + // Get all the renditions that match the given rendition name - + // there should only be 1 (or 0) + renditions = this.nodeService.getChildAssocs(sourceNodeRef, RenditionModel.ASSOC_RENDITION, renditionQName); + } + if (renditions.isEmpty()) + { + return null; + } + else + { + if (renditions.size() > 1 && logger.isDebugEnabled()) + { + logger.debug("Unexpectedly found " + renditions.size() + " renditions of name " + renditionQName + " on node " + sourceNodeRef); + } + ChildAssociationRef childAssoc = renditions.get(0); + NodeRef renditionNode = childAssoc.getChildRef(); + return !isRenditionAvailable(sourceNodeRef, renditionNode) ? null: childAssoc; + } + } + + @Override + public boolean isEnabled() + { + return enabled && thumbnailsEnabled; + } + + @Override + public void onContentUpdate(NodeRef sourceNodeRef, boolean newContent) + { + if (isEnabled()) + { + logger.debug("onContentUpdate on " + sourceNodeRef); + List childAssocs = getRenditionChildAssociations(sourceNodeRef); + for (ChildAssociationRef childAssoc : childAssocs) + { + NodeRef renditionNodeRef = childAssoc.getChildRef(); + // TODO: This check will not be needed once the original RenditionService is removed. + if (nodeService.hasAspect(renditionNodeRef, RenditionModel.ASPECT_RENDITION2)) + { + QName childAssocQName = childAssoc.getQName(); + String renditionName = childAssocQName.getLocalName(); + RenditionDefinition2 renditionDefinition = renditionDefinitionRegistry2.getRenditionDefinition(renditionName); + if (renditionDefinition != null) + { + render(sourceNodeRef, renditionName); + } + else + { + logger.debug("onContentUpdate rendition " + renditionName + " only exists in the original rendition service."); + } + } + } + } + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/RenditionService2PreventedException.java b/src/main/java/org/alfresco/repo/rendition2/RenditionService2PreventedException.java new file mode 100644 index 0000000000..978be27da4 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/RenditionService2PreventedException.java @@ -0,0 +1,42 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.repo.rendition.RenditionPreventionRegistry; + +/** + * This exception is thrown if an attempt is made to render a node which has a {@link RenditionPreventionRegistry content class} + * registered to prevent rendition.

+ * + * Based on the deprecated RenditionPreventedException which contained the deprecated RenditionDefinition. + */ +public class RenditionService2PreventedException extends RenditionService2Exception +{ + public RenditionService2PreventedException(String message) + { + super(message); + } +} diff --git a/src/main/java/org/alfresco/repo/rendition2/TransformClient.java b/src/main/java/org/alfresco/repo/rendition2/TransformClient.java new file mode 100644 index 0000000000..7198a239bc --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/TransformClient.java @@ -0,0 +1,59 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.service.cmr.repository.NodeRef; + +/** + * Request rendition transforms. + * + * @author adavis + */ +public interface TransformClient +{ + /** + * Checks the transformation required for the rendition is supported. + * @param sourceNodeRef the source node + * @param renditionDefinition which rendition to perform + * @param sourceMimetype the mometype of the source + * @param size the size in bytes of the source + * @param contentUrl the url of the source (used in debug). + * @return and object that contains information that will be passed to + * {@link #transform(NodeRef, RenditionDefinition2, String, int)} as the {@code transformInfo} parameter to + * avoid having to work it out again. + * @throws UnsupportedOperationException if the transform is not supported. + */ + void checkSupported(NodeRef sourceNodeRef, RenditionDefinition2 renditionDefinition, String sourceMimetype, long size, String contentUrl); + + /** + * Requests an asynchronous transform and the subsequent linkage of that transform as a rendition. + * @param sourceNodeRef the source node + * @param renditionDefinition which rendition to perform + * @param user that requested the transform. + * @param sourceContentUrlHashCode the hash code of the source node's content URL. Used to check the transform result + */ + void transform(NodeRef sourceNodeRef, RenditionDefinition2 renditionDefinition, String user, int sourceContentUrlHashCode); +} diff --git a/src/main/java/org/alfresco/repo/rendition2/TransformServiceRegistry.java b/src/main/java/org/alfresco/repo/rendition2/TransformServiceRegistry.java new file mode 100644 index 0000000000..3b55333b54 --- /dev/null +++ b/src/main/java/org/alfresco/repo/rendition2/TransformServiceRegistry.java @@ -0,0 +1,59 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.util.Map; + +/** + * This interface is responsible for determining if the a transformation request can be routed to the Transform Service + * + * @author aepure + */ + +public interface TransformServiceRegistry +{ + /** + * Validate if a transformation request can pe processed by Transformation Service. + * @param sourceMimetype Source mimetype of the content. + * @param size in bytes of the source content. May be {@code -1} if the size should be ignored. + * @param targetMimetype Target mimetype of the content. + * @param renditionName the name of the rendition. + * @param options Transformation request parameters. + * @return true if the transformation can be processed by Transformation Service. + * false otherwise. + */ + public boolean isSupported(String sourceMimetype, long size, String targetMimetype, String renditionName, Map options); + + /** + * Returns the maximum size the source may be in bytes to still be supported. + * @param sourceMimetype Source mimetype of the content. + * @param targetMimetype Target mimetype of the content. + * @param renditionName the name of the rendition. + * @param options Transformation request parameters. + * @return the number of bytes, {@code -1} if not limited or {@code null} if not supported. + */ + public Long getMaxSize(String sourceMimetype, String targetMimetype, String renditionName, Map options); +} diff --git a/src/main/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java b/src/main/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java index 6f0b0d971d..e122d97ec2 100644 --- a/src/main/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java +++ b/src/main/java/org/alfresco/repo/service/ServiceDescriptorRegistry.java @@ -355,7 +355,13 @@ public class ServiceDescriptorRegistry { return (MultilingualContentService) getService(MULTILINGUAL_CONTENT_SERVICE); } - + + /** + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 + * or other external libraries. + */ + @Deprecated @Override public ThumbnailService getThumbnailService() { @@ -373,7 +379,12 @@ public class ServiceDescriptorRegistry { return (FormService)getService(FORM_SERVICE); } - + + /** + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ + @Deprecated @Override public RenditionService getRenditionService() { diff --git a/src/main/java/org/alfresco/repo/template/BaseContentNode.java b/src/main/java/org/alfresco/repo/template/BaseContentNode.java index 941082f3e2..b7b5772b88 100644 --- a/src/main/java/org/alfresco/repo/template/BaseContentNode.java +++ b/src/main/java/org/alfresco/repo/template/BaseContentNode.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.template; import java.io.Serializable; @@ -34,7 +34,7 @@ import java.util.Set; import org.alfresco.model.ApplicationModel; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.content.transform.UnsupportedTransformationException; +import org.alfresco.repo.content.transform.UnsupportedTransformationException; import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ChildAssociationRef; diff --git a/src/main/java/org/alfresco/repo/thumbnail/AddFailedThumbnailActionExecuter.java b/src/main/java/org/alfresco/repo/thumbnail/AddFailedThumbnailActionExecuter.java index e120e09ebd..96cf050861 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/AddFailedThumbnailActionExecuter.java +++ b/src/main/java/org/alfresco/repo/thumbnail/AddFailedThumbnailActionExecuter.java @@ -1,55 +1,55 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.action.executer.ActionExecuter; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.thumbnail.conditions.NodeEligibleForRethumbnailingEvaluator; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DataTypeDefinition; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.thumbnail.FailedThumbnailInfo; -import org.alfresco.service.cmr.thumbnail.ThumbnailService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; +import java.io.Serializable; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.action.ParameterDefinitionImpl; +import org.alfresco.repo.action.executer.ActionExecuter; +import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.thumbnail.conditions.NodeEligibleForRethumbnailingEvaluator; +import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.action.ParameterDefinition; +import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.thumbnail.FailedThumbnailInfo; +import org.alfresco.service.cmr.thumbnail.ThumbnailService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** @@ -79,7 +79,10 @@ import org.apache.commons.logging.LogFactory; * @see FailedThumbnailInfo * @see NodeEligibleForRethumbnailingEvaluator * @see ThumbnailServiceImpl#init() + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class AddFailedThumbnailActionExecuter extends ActionExecuterAbstractBase { private static Log log = LogFactory.getLog(AddFailedThumbnailActionExecuter.class); @@ -143,13 +146,13 @@ public class AddFailedThumbnailActionExecuter extends ActionExecuterAbstractBase public void setBehaviourFilter(BehaviourFilter behaviourFilter) { this.behaviourFilter = behaviourFilter; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.action.Action, NodeRef) - */ - public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef) - { + } + + /** + * @see org.alfresco.repo.action.executer.ActionExecuter#execute(org.alfresco.service.cmr.action.Action, NodeRef) + */ + public void executeImpl(final Action ruleAction, final NodeRef actionedUponNodeRef) + { // This logic must always be executed as the 'system' user as it is possible that // a user with read-only access to a node will trigger a thumbnail failure and thereby // trigger the execution of this action. @@ -210,11 +213,11 @@ public class AddFailedThumbnailActionExecuter extends ActionExecuterAbstractBase // Does the actionedUponNodeRef already have a child for this thumbnail definition? if (childNode == null) - { - if(log.isDebugEnabled()) - { - log.debug("childNode is null " + actionedUponNodeRef); - } + { + if(log.isDebugEnabled()) + { + log.debug("childNode is null " + actionedUponNodeRef); + } // No existing failedThumbnail child, so this is a first time failure to render this source node with the current // thumbnail definition. @@ -225,15 +228,15 @@ public class AddFailedThumbnailActionExecuter extends ActionExecuterAbstractBase behaviourFilter.disableBehaviour(actionedUponNodeRef, ContentModel.ASPECT_AUDITABLE); try - { + { // The association is named after the failed thumbnail definition. NodeRef thumbnailNodeRef = nodeService.createNode(actionedUponNodeRef, ContentModel.ASSOC_FAILED_THUMBNAIL, - thumbDefQName, ContentModel.TYPE_FAILED_THUMBNAIL, props).getChildRef(); - - if(log.isDebugEnabled()) - { - log.debug("Create failed thumbnail " + thumbnailNodeRef + " (" + thumbDefQName + ") for " - + actionedUponNodeRef + ", props " + props); + thumbDefQName, ContentModel.TYPE_FAILED_THUMBNAIL, props).getChildRef(); + + if(log.isDebugEnabled()) + { + log.debug("Create failed thumbnail " + thumbnailNodeRef + " (" + thumbDefQName + ") for " + + actionedUponNodeRef + ", props " + props); } } finally @@ -242,11 +245,11 @@ public class AddFailedThumbnailActionExecuter extends ActionExecuterAbstractBase } } else - { - if(log.isDebugEnabled()) - { - log.debug("Already a failed thumbnail " + thumbDefQName + " for " + actionedUponNodeRef); - } + { + if(log.isDebugEnabled()) + { + log.debug("Already a failed thumbnail " + thumbDefQName + " for " + actionedUponNodeRef); + } // There is already an existing failedThumbnail child, so this is a repeat failure to perform the same // thumbnail definition. diff --git a/src/main/java/org/alfresco/repo/thumbnail/CreateThumbnailActionExecuter.java b/src/main/java/org/alfresco/repo/thumbnail/CreateThumbnailActionExecuter.java index bccf052018..9bd8a65864 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/CreateThumbnailActionExecuter.java +++ b/src/main/java/org/alfresco/repo/thumbnail/CreateThumbnailActionExecuter.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.io.Serializable; @@ -54,7 +54,10 @@ import org.apache.commons.logging.LogFactory; * * @author Roy Wetherall * @author Ph Dubois (optional thumbnail creation by mimetype and in general) + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class CreateThumbnailActionExecuter extends ActionExecuterAbstractBase { private static Log logger = LogFactory.getLog(CreateThumbnailActionExecuter.class); diff --git a/src/main/java/org/alfresco/repo/thumbnail/FailedThumbnailSourceAspect.java b/src/main/java/org/alfresco/repo/thumbnail/FailedThumbnailSourceAspect.java index c44522b706..24f949824b 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/FailedThumbnailSourceAspect.java +++ b/src/main/java/org/alfresco/repo/thumbnail/FailedThumbnailSourceAspect.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.util.Map; @@ -60,7 +60,10 @@ import org.apache.commons.logging.LogFactory; * @author Neil Mc Erlean * @since 3.5.0 + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class FailedThumbnailSourceAspect implements NodeServicePolicies.OnDeleteNodePolicy, ContentServicePolicies.OnContentUpdatePolicy { diff --git a/src/main/java/org/alfresco/repo/thumbnail/FailureHandlingOptions.java b/src/main/java/org/alfresco/repo/thumbnail/FailureHandlingOptions.java index 2eb03b9b14..a61f81b0c8 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/FailureHandlingOptions.java +++ b/src/main/java/org/alfresco/repo/thumbnail/FailureHandlingOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import org.alfresco.repo.thumbnail.conditions.NodeEligibleForRethumbnailingEvaluator; @@ -35,7 +35,10 @@ import org.alfresco.repo.thumbnail.conditions.NodeEligibleForRethumbnailingEvalu * @author Neil Mc Erlean * @since 3.5.0 * @see NodeEligibleForRethumbnailingEvaluator for a description of how these configuration parameters are used. + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class FailureHandlingOptions { public static final int DEFAULT_PERIOD = 0; @@ -81,13 +84,13 @@ public class FailureHandlingOptions { this.quietPeriodRetriesEnabled = quietPeriodRetriesEnabled; } - - /** - * Sets the initial minimum retry period for thumbnail creation/update. - * @param retryPeriod minimum retry period in ms. - */ - public void setRetryPeriod(long retryPeriod) - { + + /** + * Sets the initial minimum retry period for thumbnail creation/update. + * @param retryPeriod minimum retry period in ms. + */ + public void setRetryPeriod(long retryPeriod) + { this.retryPeriod = retryPeriod; } @@ -95,13 +98,13 @@ public class FailureHandlingOptions { return this.retryPeriod; } - - /** - * Sets the minimum retry period for thumbnail creation/update. - * @param quietPeriod minimum retry period in ms. - */ - public void setQuietPeriod(long quietPeriod) - { + + /** + * Sets the minimum retry period for thumbnail creation/update. + * @param quietPeriod minimum retry period in ms. + */ + public void setQuietPeriod(long quietPeriod) + { this.quietPeriod = quietPeriod; } diff --git a/src/main/java/org/alfresco/repo/thumbnail/SimpleThumbnailer.java b/src/main/java/org/alfresco/repo/thumbnail/SimpleThumbnailer.java index 3ab8bdfe1a..b6616fc8ad 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/SimpleThumbnailer.java +++ b/src/main/java/org/alfresco/repo/thumbnail/SimpleThumbnailer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.io.Serializable; @@ -54,7 +54,10 @@ import org.springframework.beans.factory.InitializingBean; * synchronously, this is not recommended for production use. * * @author dward + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class SimpleThumbnailer extends TransactionListenerAdapter implements ContentServicePolicies.OnContentUpdatePolicy, InitializingBean { diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java index 77429f91a6..bc6227f454 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinition.java @@ -36,7 +36,10 @@ import java.util.Objects; * This class provides the thumbnail details to the thumbnail service. * * @author Roy Wetherall + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailDefinition { diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinitionSpringRegisterer.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinitionSpringRegisterer.java index 656bfc393a..f06a50beb8 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinitionSpringRegisterer.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailDefinitionSpringRegisterer.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import org.alfresco.service.cmr.repository.TransformationOptions; @@ -37,7 +37,10 @@ import org.springframework.beans.factory.InitializingBean; * the same way as other Alfresco beans to their registrys. * * @author Nick Burch + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailDefinitionSpringRegisterer implements InitializingBean { private ThumbnailRegistry thumbnailRegistry; diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailHelper.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailHelper.java index 9e91914610..34b1e9c9bc 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailHelper.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailHelper.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.io.Serializable; @@ -42,7 +42,10 @@ import org.alfresco.service.cmr.action.ActionService; * * @author Neil Mc Erlean * @since 3.5.0 + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailHelper { public static Action createCreateThumbnailAction(ThumbnailDefinition thumbnailDef, ServiceRegistry services) diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRegistry.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRegistry.java index 78ce96ff6e..e03883abdd 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRegistry.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRegistry.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.util.ArrayList; @@ -59,7 +59,10 @@ import org.springframework.extensions.surf.util.AbstractLifecycleBean; * * @author Roy Wetherall * @author Neil McErlean + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailRegistry implements ApplicationContextAware, ApplicationListener { /** Logger */ diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRenditionConvertor.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRenditionConvertor.java index 688c8f44ec..9fc3f69279 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRenditionConvertor.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailRenditionConvertor.java @@ -1,33 +1,34 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import java.util.StringJoiner; import org.alfresco.model.ContentModel; import org.alfresco.repo.content.transform.magick.ImageResizeOptions; @@ -37,8 +38,10 @@ import org.alfresco.repo.rendition.executer.AbstractRenderingEngine; import org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine; import org.alfresco.repo.rendition.executer.ImageRenderingEngine; import org.alfresco.repo.rendition.executer.ReformatRenderingEngine; +import org.alfresco.repo.rendition2.RenditionDefinition2; import org.alfresco.service.cmr.rendition.RenditionDefinition; import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.TransformationOptionLimits; import org.alfresco.service.cmr.repository.TransformationOptions; import org.alfresco.service.cmr.repository.TransformationSourceOptions; import org.alfresco.service.cmr.thumbnail.ThumbnailParentAssociationDetails; @@ -46,6 +49,13 @@ import org.alfresco.service.cmr.thumbnail.ThumbnailService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_MAX_PAGES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_MAX_SOURCE_SIZE_K_BYTES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_PAGE_LIMIT; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_READ_LIMIT_K_BYTES; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_READ_LIMIT_TIME_MS; +import static org.alfresco.service.cmr.repository.TransformationOptionLimits.OPT_TIMEOUT_MS; + /** * A helper class to convert {@link ThumbnailDefinition thumbnail definition} and * {@link TransformationOptions transformationOptions} (thumbnail-specific @@ -62,7 +72,10 @@ import org.alfresco.service.namespace.QName; * @see RenditionDefinition * * @author Neil McErlean + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailRenditionConvertor { private RenditionService renditionService; @@ -251,13 +264,13 @@ public class ThumbnailRenditionConvertor Serializable xsize = renditionDefinition.getParameterValue(ImageRenderingEngine.PARAM_RESIZE_WIDTH); if (xsize != null) { - resizeOptions.setWidth(((Long) xsize).intValue()); + resizeOptions.setWidth(((Integer) xsize).intValue()); } Serializable ysize = renditionDefinition.getParameterValue(ImageRenderingEngine.PARAM_RESIZE_HEIGHT); if (ysize != null) { - resizeOptions.setHeight(((Long) ysize).intValue()); + resizeOptions.setHeight(((Integer) ysize).intValue()); } Serializable maintainAspectRatio = renditionDefinition.getParameterValue(ImageRenderingEngine.PARAM_MAINTAIN_ASPECT_RATIO); @@ -282,6 +295,38 @@ public class ThumbnailRenditionConvertor } thDefn.setTransformationOptions(transformationOptions); + TransformationOptionLimits limits = transformationOptions.getLimits(); + + Serializable v = params.get(OPT_TIMEOUT_MS); + if (v != null) + { + limits.setTimeoutMs((Long)v); + } + v = params.get(OPT_READ_LIMIT_TIME_MS); + if (v != null) + { + limits.setReadLimitTimeMs((Long)v); + } + v = params.get(OPT_MAX_SOURCE_SIZE_K_BYTES); + if (v != null) + { + limits.setMaxSourceSizeKBytes((Long)v); + } + v = params.get(OPT_READ_LIMIT_K_BYTES); + if (v != null) + { + limits.setReadLimitKBytes((Long)v); + } + v = params.get(OPT_MAX_PAGES); + if (v != null) + { + limits.setMaxPages((Integer)v); + } + v = params.get(OPT_PAGE_LIMIT); + if (v != null) + { + limits.setPageLimit((Integer)v); + } return thDefn; } diff --git a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailServiceImpl.java b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailServiceImpl.java index d120c6ad12..c4aa2ba10c 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/ThumbnailServiceImpl.java +++ b/src/main/java/org/alfresco/repo/thumbnail/ThumbnailServiceImpl.java @@ -86,7 +86,10 @@ import org.springframework.extensions.surf.util.ParameterCheck; /** * @author Roy Wetherall * @author Neil McErlean + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailServiceImpl implements ThumbnailService, NodeServicePolicies.BeforeCreateNodePolicy, NodeServicePolicies.OnCreateNodePolicy, diff --git a/src/main/java/org/alfresco/repo/thumbnail/UpdateThumbnailActionExecuter.java b/src/main/java/org/alfresco/repo/thumbnail/UpdateThumbnailActionExecuter.java index 4247ec9625..3371eb775d 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/UpdateThumbnailActionExecuter.java +++ b/src/main/java/org/alfresco/repo/thumbnail/UpdateThumbnailActionExecuter.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; import java.io.Serializable; @@ -54,7 +54,10 @@ import org.apache.commons.logging.LogFactory; * @author Roy Wetherall * @author Neil McErlean * @author Ph Dubois (optional thumbnail creation by mimetype and in general) + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class UpdateThumbnailActionExecuter extends ActionExecuterAbstractBase { /** Logger */ diff --git a/src/main/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluator.java b/src/main/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluator.java index c0a5b873fb..58ed854a55 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluator.java +++ b/src/main/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluator.java @@ -77,7 +77,10 @@ import org.apache.commons.logging.LogFactory; * * @author Neil Mc Erlean. * @since 3.5.0 + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class NodeEligibleForRethumbnailingEvaluator extends ActionConditionEvaluatorAbstractBase { private static Log logger = LogFactory.getLog(NodeEligibleForRethumbnailingEvaluator.class); diff --git a/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnail.java b/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnail.java index ed19c47fe1..b0a6b8eb7f 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnail.java +++ b/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnail.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail.script; import java.util.List; @@ -42,6 +42,7 @@ import org.mozilla.javascript.Scriptable; /** * @author Roy Wetherall * @author Neil McErlean + * */ public class ScriptThumbnail extends ScriptNode { diff --git a/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnailService.java b/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnailService.java index e066440845..acc03eaaa6 100644 --- a/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnailService.java +++ b/src/main/java/org/alfresco/repo/thumbnail/script/ScriptThumbnailService.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail.script; import java.text.MessageFormat; @@ -37,7 +37,10 @@ import org.alfresco.service.ServiceRegistry; * Script object representing the site service. * * @author Roy Wetherall + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ScriptThumbnailService extends BaseScopableProcessorExtension { /** Service Registry */ diff --git a/src/main/java/org/alfresco/repo/util/PostTxnCallbackScheduler.java b/src/main/java/org/alfresco/repo/util/PostTxnCallbackScheduler.java new file mode 100644 index 0000000000..7d7dff3047 --- /dev/null +++ b/src/main/java/org/alfresco/repo/util/PostTxnCallbackScheduler.java @@ -0,0 +1,109 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.util; + +import java.util.Objects; +import org.alfresco.repo.transaction.AlfrescoTransactionSupport; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.transaction.TransactionListenerAdapter; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * Schedules a callback to a post-commit phase. + * + * @author alex.mukha + */ +public class PostTxnCallbackScheduler +{ + private static Log logger = LogFactory.getLog(PostTxnCallbackScheduler.class); + + private TransactionService transactionService; + + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + + /** + * @param callback The callback to be scheduled in a post-commit phase + * @param uniqueId The unique id of the callback. Consecutive requests to schedule the callback with the same id + * will overwrite the previously scheduled one. + */ + public void scheduleRendition(RetryingTransactionHelper.RetryingTransactionCallback callback, String uniqueId) + { + AlfrescoTransactionSupport.bindListener(new PostTxTransactionListener(callback, uniqueId)); + } + + private class PostTxTransactionListener extends TransactionListenerAdapter + { + private final RetryingTransactionHelper.RetryingTransactionCallback callback; + private final String id; + + PostTxTransactionListener(RetryingTransactionHelper.RetryingTransactionCallback callback, String uniqueId) + { + this.callback = callback; + this.id = uniqueId; + logger.debug("Created lister with id = " + id); + } + + @Override + public void afterCommit() + { + try + { + transactionService.getRetryingTransactionHelper().doInTransaction(callback); + } + catch (Exception e) + { + logger.debug("The after commit callback " + id + " failed to execute: " + e.getMessage()); + // consume exception in afterCommit + } + } + + @Override + public boolean equals(Object o) + { + if (this == o) + { + return true; + } + if (o == null || getClass() != o.getClass()) + { + return false; + } + PostTxTransactionListener that = (PostTxTransactionListener) o; + return Objects.equals(id, that.id); + } + + @Override + public int hashCode() + { + return Objects.hash(id); + } + } +} diff --git a/src/main/java/org/alfresco/service/ServiceRegistry.java b/src/main/java/org/alfresco/service/ServiceRegistry.java index 0d6f30b3f3..dfc11d6605 100644 --- a/src/main/java/org/alfresco/service/ServiceRegistry.java +++ b/src/main/java/org/alfresco/service/ServiceRegistry.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service; import java.util.Collection; @@ -428,10 +428,11 @@ public interface ServiceRegistry EditionService getEditionService(); /** - * Get the Thumbnail Service - * @deprecated This method has been deprecated as it would return a service that is not part of the public API. - * The service itself is not deprecated, but access to it via the ServiceRegistry will be removed in the future. + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 + * or other external libraries. */ + @Deprecated @NotAuditable ThumbnailService getThumbnailService(); @@ -451,7 +452,10 @@ public interface ServiceRegistry /** * Get the rendition service (or null if one is not provided) + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ + @Deprecated @NotAuditable RenditionService getRenditionService(); diff --git a/src/main/java/org/alfresco/service/cmr/rendition/CompositeRenditionDefinition.java b/src/main/java/org/alfresco/service/cmr/rendition/CompositeRenditionDefinition.java index ec8b20b299..8f53dd544d 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/CompositeRenditionDefinition.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/CompositeRenditionDefinition.java @@ -23,22 +23,25 @@ * along with Alfresco. If not, see . * #L% */ - -package org.alfresco.service.cmr.rendition; - -import org.alfresco.service.cmr.action.ActionList; - -/** - * This is a special {@link RenditionDefinition} which allows sequential - * execution of a list of other {@link RenditionDefinition}s. For example, it - * might be used to transform a PDF file to a JPEG imaged and then resize that - * image. This would be achieved by creating a - * {@link CompositeRenditionDefinition} that has two sub-definitions, one to - * reformat the PDF to a JPEG image and the second to resize the JPEG image. - * - * @author Nick Smith - */ -public interface CompositeRenditionDefinition extends RenditionDefinition, ActionList -{ - // Intentionally empty! -} + +package org.alfresco.service.cmr.rendition; + +import org.alfresco.service.cmr.action.ActionList; + +/** + * This is a special {@link RenditionDefinition} which allows sequential + * execution of a list of other {@link RenditionDefinition}s. For example, it + * might be used to transform a PDF file to a JPEG imaged and then resize that + * image. This would be achieved by creating a + * {@link CompositeRenditionDefinition} that has two sub-definitions, one to + * reformat the PDF to a JPEG image and the second to resize the JPEG image. + * + * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ +@Deprecated +public interface CompositeRenditionDefinition extends RenditionDefinition, ActionList +{ + // Intentionally empty! +} diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenderCallback.java b/src/main/java/org/alfresco/service/cmr/rendition/RenderCallback.java index 6eee0472b4..af91fd8956 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenderCallback.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenderCallback.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; @@ -34,7 +34,10 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef; * * @author Neil McErlean * @see RenditionService#render(org.alfresco.service.cmr.repository.NodeRef, RenditionDefinition, RenderCallback) + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public interface RenderCallback { /** diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenderingEngineDefinition.java b/src/main/java/org/alfresco/service/cmr/rendition/RenderingEngineDefinition.java index 55cca4ce30..e17bdb276b 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenderingEngineDefinition.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenderingEngineDefinition.java @@ -23,18 +23,21 @@ * along with Alfresco. If not, see . * #L% */ - -package org.alfresco.service.cmr.rendition; - -import org.alfresco.service.cmr.action.ActionDefinition; - -/** - * This class describes a rendering engine and defines what parameters can/must - * be specified for that rendering engine. - * - * @author Nick Smith - */ -public interface RenderingEngineDefinition extends ActionDefinition -{ - // Intentionally empty -} + +package org.alfresco.service.cmr.rendition; + +import org.alfresco.service.cmr.action.ActionDefinition; + +/** + * This class describes a rendering engine and defines what parameters can/must + * be specified for that rendering engine. + * + * @author Nick Smith + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. + */ +@Deprecated +public interface RenderingEngineDefinition extends ActionDefinition +{ + // Intentionally empty +} diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenditionCancelledException.java b/src/main/java/org/alfresco/service/cmr/rendition/RenditionCancelledException.java index 1fc10d049f..83c21701dd 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenditionCancelledException.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenditionCancelledException.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; /** @@ -30,7 +30,10 @@ package org.alfresco.service.cmr.rendition; * * @author Neil McErlean * @author Ray Gauss II + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionCancelledException extends RenditionServiceException { private static final long serialVersionUID = 6369478812653824042L; diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenditionDefinition.java b/src/main/java/org/alfresco/service/cmr/rendition/RenditionDefinition.java index 783fc4cd8c..60ee26473f 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenditionDefinition.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenditionDefinition.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; @@ -43,7 +43,10 @@ import org.alfresco.service.namespace.QName; * * @author Nick Smith * @author Neil McErlean + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated @AlfrescoPublicApi public interface RenditionDefinition extends Action, Serializable { diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenditionPreventedException.java b/src/main/java/org/alfresco/service/cmr/rendition/RenditionPreventedException.java index ae71d6145e..fab494b647 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenditionPreventedException.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenditionPreventedException.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; import org.alfresco.repo.rendition.RenditionPreventionRegistry; diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenditionService.java b/src/main/java/org/alfresco/service/cmr/rendition/RenditionService.java index fe86e934fd..26b00f51ab 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenditionService.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenditionService.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; @@ -40,7 +40,10 @@ import org.alfresco.service.namespace.QName; * The Rendition service. * @author Nick Smith * @author Neil McErlean + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated @AlfrescoPublicApi public interface RenditionService extends RenditionDefinitionPersister { @@ -277,4 +280,20 @@ public interface RenditionService extends RenditionDefinitionPersister */ @NotAuditable void cancelRenditions(NodeRef sourceNode, String type); + + /** + * If a rendition has been created by the newer RenditionService2, this method will return true. In this case the + * original RenditionService should not be used to update an existing rendition if the content changes. These + * renditions can be identified by the existence of the rendition2 aspect. RenditionService2 also listens for + * content changes and will perform the rendition.

+ * + * If RenditionService2 has a definition with the same name (matched on the local part of the supplied rendDef's + * name) and the target mimetype matches, RenditionService2 will also be used. This is being done to help with the + * conversion of custom transformers and renditions. The basic definitions (called "medium", "doclib", + * "imgpreview", "avatar", "avatar32", "webpreview", "pdf") already exist. Rather than writing a converter form one + * definition to the newer one, it is suggested that a newer RenditionDefinition2 is simply defined to avoid having + * to worry about any complexities in converting TransformationOptions into a simple flat Map structure. + */ + @NotAuditable + boolean usingRenditionService2(NodeRef sourceNodeRef, RenditionDefinition rendDefn); } diff --git a/src/main/java/org/alfresco/service/cmr/rendition/RenditionServiceException.java b/src/main/java/org/alfresco/service/cmr/rendition/RenditionServiceException.java index 1da6dfcbde..00c242ea86 100644 --- a/src/main/java/org/alfresco/service/cmr/rendition/RenditionServiceException.java +++ b/src/main/java/org/alfresco/service/cmr/rendition/RenditionServiceException.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.rendition; import org.alfresco.error.AlfrescoRuntimeException; @@ -31,7 +31,10 @@ import org.alfresco.error.AlfrescoRuntimeException; * Rendition Service Exception Class * * @author Neil McErlean + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated public class RenditionServiceException extends AlfrescoRuntimeException { private static final long serialVersionUID = -6947067735970465937L; diff --git a/src/main/java/org/alfresco/service/cmr/repository/AbstractTransformationSourceOptions.java b/src/main/java/org/alfresco/service/cmr/repository/AbstractTransformationSourceOptions.java index 541d66a471..960ff3722d 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/AbstractTransformationSourceOptions.java +++ b/src/main/java/org/alfresco/service/cmr/repository/AbstractTransformationSourceOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.io.Serializable; @@ -34,7 +34,10 @@ import java.util.Map; * and handles merge of options. * * @author Ray Gauss II + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class AbstractTransformationSourceOptions implements TransformationSourceOptions, Cloneable { diff --git a/src/main/java/org/alfresco/service/cmr/repository/ContentService.java b/src/main/java/org/alfresco/service/cmr/repository/ContentService.java index df2febd4cb..1027fafdf2 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/ContentService.java +++ b/src/main/java/org/alfresco/service/cmr/repository/ContentService.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.util.List; @@ -170,7 +170,10 @@ public interface ContentService * @throws NoTransformerException if no transformer exists for the * given source and target mimetypes of the reader and writer * @throws ContentIOException if the transformation fails + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"reader", "writer"}) public void transform(ContentReader reader, ContentWriter writer) throws NoTransformerException, ContentIOException; @@ -193,8 +196,8 @@ public interface ContentService * As of release 3.0 the TransformOptions class should be used to pass transformation options * to a transformation execution. */ - @Auditable(parameters = {"reader", "writer", "options"}) @Deprecated + @Auditable(parameters = {"reader", "writer", "options"}) public void transform(ContentReader reader, ContentWriter writer, Map options) throws NoTransformerException, ContentIOException; @@ -209,7 +212,10 @@ public interface ContentService * @throws NoTransformerException if no transformer exists for the * given source and target mimetypes of the reader and writer * @throws ContentIOException if the transformation fails + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"reader", "writer", "options"}) public void transform(ContentReader reader, ContentWriter writer, TransformationOptions options) throws NoTransformerException, ContentIOException; @@ -227,7 +233,10 @@ public interface ContentService * * @see ContentService#getTransformer(String, String, long, String, TransformationOptions) * @see ContentAccessor#getMimetype() + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"sourceMimetype", "targetMimetype"}) public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype); @@ -246,7 +255,10 @@ public interface ContentService * @param options the transformation options * * @return ContentTransformer the transformers that can be used, or null if none are available + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"sourceMimetype", "sourceSize", "targetMimetype", "options"}) public List getTransformers(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options); @@ -267,13 +279,17 @@ public interface ContentService * @return ContentTransformer a transformer that can be used, or null if one was not available * * @see ContentAccessor#getMimetype() + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"sourceMimetype", "sourceSize", "targetMimetype", "options"}) public ContentTransformer getTransformer(String sourceUrl, String sourceMimetype, long sourceSize, String targetMimetype, TransformationOptions options); /** * @deprecated use overloaded method with sourceSize parameter. */ + @Deprecated public ContentTransformer getTransformer(String sourceMimetype, String targetMimetype, TransformationOptions options); /** @@ -283,7 +299,10 @@ public interface ContentService * @param targetMimetype target mime type * @param options transformation options * @return 0 if there are no transformers, -1 if there is no limit or if positive number the size in bytes. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"sourceMimetype", "targetMimetype", "options"}) public long getMaxSourceSizeBytes(String sourceMimetype, String targetMimetype, TransformationOptions options); @@ -303,13 +322,17 @@ public interface ContentService * Fetch the transformer that is capable of transforming image content. * * @return Returns a transformer that can be used, or null if one was not available + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable public ContentTransformer getImageTransformer(); /** * @deprecated use {@link #isTransformable(ContentReader, ContentWriter, TransformationOptions)}. */ + @Deprecated @Auditable(parameters = {"reader", "writer"}) public boolean isTransformable(ContentReader reader, ContentWriter writer); @@ -330,7 +353,10 @@ public interface ContentService * @param writer the target content location and mimetype * @param options the transformation options * @return boolean true if a transformer exists, false otherwise + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ + @Deprecated @Auditable(parameters = {"reader", "writer", "options"}) public boolean isTransformable(ContentReader reader, ContentWriter writer, TransformationOptions options); } diff --git a/src/main/java/org/alfresco/service/cmr/repository/SerializedTransformationOptionsAccessor.java b/src/main/java/org/alfresco/service/cmr/repository/SerializedTransformationOptionsAccessor.java index 9b4e99f24b..5497f20df1 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/SerializedTransformationOptionsAccessor.java +++ b/src/main/java/org/alfresco/service/cmr/repository/SerializedTransformationOptionsAccessor.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import org.alfresco.api.AlfrescoPublicApi; @@ -33,7 +33,10 @@ import org.alfresco.service.cmr.rendition.RenditionServiceException; * transformation options. * * @author Ray Gauss II + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public interface SerializedTransformationOptionsAccessor { diff --git a/src/main/java/org/alfresco/service/cmr/repository/TemporalSourceOptions.java b/src/main/java/org/alfresco/service/cmr/repository/TemporalSourceOptions.java index 0141648500..b252358050 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TemporalSourceOptions.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TemporalSourceOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.io.Serializable; @@ -43,7 +43,10 @@ import org.alfresco.service.cmr.repository.AbstractTransformationSourceOptions; * a transform from the start until that duration is reached if possible. * * @author Ray Gauss II + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TemporalSourceOptions extends AbstractTransformationSourceOptions { diff --git a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimits.java b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimits.java index e648c6ce45..cf3c6d3ec6 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimits.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimits.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.io.Serializable; @@ -36,22 +36,27 @@ import org.alfresco.util.EqualsHelper; * Represents maximum source values (that result in exceptions if exceeded) or * limits on source values (that result in EOF (End Of File) being returned * early). Options exist for elapse time, KBytes read or number of pages read. - * + * + * @deprecated with the introduction of RenditionService2 the OPT_... public static final values + * have been deprecated as they will no longer form part of the rendition definition and will be + * removed when local transformations are removed. + * * @author Alan Davis */ @AlfrescoPublicApi +@Deprecated public class TransformationOptionLimits implements Serializable { private static final long serialVersionUID = 1L; - public static final String OPT_TIMEOUT_MS = "timeoutMs"; - public static final String OPT_READ_LIMIT_TIME_MS = "readLimitTimeMs"; - - public static final String OPT_MAX_SOURCE_SIZE_K_BYTES = "maxSourceSizeKBytes"; - public static final String OPT_READ_LIMIT_K_BYTES = "readLimitKBytes"; - - public static final String OPT_MAX_PAGES = "maxPages"; - public static final String OPT_PAGE_LIMIT = "pageLimit"; + @Deprecated public static final String OPT_TIMEOUT_MS = "timeoutMs"; + @Deprecated public static final String OPT_READ_LIMIT_TIME_MS = "readLimitTimeMs"; + + @Deprecated public static final String OPT_MAX_SOURCE_SIZE_K_BYTES = "maxSourceSizeKBytes"; + @Deprecated public static final String OPT_READ_LIMIT_K_BYTES = "readLimitKBytes"; + + @Deprecated public static final String OPT_MAX_PAGES = "maxPages"; + @Deprecated public static final String OPT_PAGE_LIMIT = "pageLimit"; public static final String TIME_MESSAGE = "Both timeoutMs and readLimitTimeMs should not be set."; public static final String KBYTES_MESSAGE = "Both maxSourceSizeKBytes and readLimitKBytes should not be set."; diff --git a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsMap.java b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsMap.java index 8aef7deb04..505f6e9852 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsMap.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsMap.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.util.AbstractMap; @@ -60,7 +60,10 @@ import org.apache.commons.logging.LogFactory; * * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformationOptionLimitsMap extends AbstractMap> { diff --git a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionPair.java b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionPair.java index 3e62e86d8e..c645f685f6 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionPair.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptionPair.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.io.IOException; @@ -46,7 +46,10 @@ import org.alfresco.repo.content.transform.TransformerDebug; * using the lowest of the four values. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public class TransformationOptionPair implements Serializable { diff --git a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptions.java b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptions.java index 41a18f12a7..abb86fd944 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TransformationOptions.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TransformationOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.util.Collection; @@ -43,7 +43,10 @@ import org.alfresco.service.namespace.QName; * * @author Roy Wetherall * @since 3.0.0 + * + * @deprecated The RenditionService is being replace by the simpler async RenditionService2. */ +@Deprecated @AlfrescoPublicApi public class TransformationOptions implements Cloneable { @@ -590,7 +593,21 @@ public class TransformationOptions implements Cloneable { return toMap().toString(); } - + + public String toStringAll() + { + return "TransformationOptions{" + + "sourceNodeRef=" + sourceNodeRef + + ", sourceContentProperty=" + sourceContentProperty + + ", targetNodeRef=" + targetNodeRef + + ", targetContentProperty=" + targetContentProperty + + ", includeEmbedded=" + includeEmbedded + + ", use='" + use + '\'' + + ", limits=" + limits + + ", sourceOptionsMap=" + sourceOptionsMap + + '}'; + } + public static TypeConverter.Converter relaxedBooleanTypeConverter = new TypeConverter.Converter() { public Boolean convert(String source) diff --git a/src/main/java/org/alfresco/service/cmr/repository/TransformationSourceOptions.java b/src/main/java/org/alfresco/service/cmr/repository/TransformationSourceOptions.java index 6e9f0c8b4a..d66fadde3a 100644 --- a/src/main/java/org/alfresco/service/cmr/repository/TransformationSourceOptions.java +++ b/src/main/java/org/alfresco/service/cmr/repository/TransformationSourceOptions.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import java.io.Serializable; @@ -42,7 +42,10 @@ import org.alfresco.service.cmr.repository.PagedSourceOptions; * describes the page number that should be used from the source content. * * @author Ray Gauss II + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @AlfrescoPublicApi public interface TransformationSourceOptions { diff --git a/src/main/java/org/alfresco/service/cmr/thumbnail/FailedThumbnailInfo.java b/src/main/java/org/alfresco/service/cmr/thumbnail/FailedThumbnailInfo.java index 2449dbeb65..bae461543c 100644 --- a/src/main/java/org/alfresco/service/cmr/thumbnail/FailedThumbnailInfo.java +++ b/src/main/java/org/alfresco/service/cmr/thumbnail/FailedThumbnailInfo.java @@ -1,35 +1,35 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.thumbnail; -import java.util.Date; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter; -import org.alfresco.repo.thumbnail.ThumbnailDefinition; +import java.util.Date; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter; +import org.alfresco.repo.thumbnail.ThumbnailDefinition; import org.alfresco.service.cmr.repository.NodeRef; /** @@ -40,7 +40,10 @@ import org.alfresco.service.cmr.repository.NodeRef; * * @author Neil Mc Erlean * @since 3.5.0 + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class FailedThumbnailInfo { private final String thumbnailDefinitionName; @@ -90,13 +93,13 @@ public class FailedThumbnailInfo public NodeRef getFailedThumbnailNode() { return failedThumbnailNode; - } - - @Override - public String toString() - { - return "FailedThumbnailInfo [thumbnailDefinitionName=" + thumbnailDefinitionName + ", mostRecentFailure=" - + mostRecentFailure + ", failureCount=" + failureCount + ", failedThumbnailNode=" + failedThumbnailNode - + "]"; - } + } + + @Override + public String toString() + { + return "FailedThumbnailInfo [thumbnailDefinitionName=" + thumbnailDefinitionName + ", mostRecentFailure=" + + mostRecentFailure + ", failureCount=" + failureCount + ", failedThumbnailNode=" + failedThumbnailNode + + "]"; + } } diff --git a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailException.java b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailException.java index dae18b4dfb..0cba310665 100644 --- a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailException.java +++ b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailException.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.thumbnail; import org.alfresco.error.AlfrescoRuntimeException; @@ -31,7 +31,10 @@ import org.alfresco.error.AlfrescoRuntimeException; * Thumbnail service exception class * * @author Roy Wetherall + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class ThumbnailException extends AlfrescoRuntimeException { /** diff --git a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailParentAssociationDetails.java b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailParentAssociationDetails.java index f6ec42665d..f834296ee0 100644 --- a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailParentAssociationDetails.java +++ b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailParentAssociationDetails.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.thumbnail; import org.alfresco.service.cmr.repository.NodeRef; @@ -33,7 +33,10 @@ import org.springframework.extensions.surf.util.ParameterCheck; * Encapsulates the details of a thumbnails parent association * * @author Roy Wetherall + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class ThumbnailParentAssociationDetails { /** The parent node reference */ diff --git a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailService.java b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailService.java index d10237bab1..2185be3cde 100644 --- a/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailService.java +++ b/src/main/java/org/alfresco/service/cmr/thumbnail/ThumbnailService.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.thumbnail; import java.util.List; @@ -40,7 +40,10 @@ import org.alfresco.service.namespace.QName; * Thumbnail Service API * * @author Roy Wetherall (based on original contribution by Ray Gauss II) + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public interface ThumbnailService { /** diff --git a/src/main/resources/alfresco/application-context-highlevel.xml b/src/main/resources/alfresco/application-context-highlevel.xml index bdcacfa275..ed32bbc0f3 100644 --- a/src/main/resources/alfresco/application-context-highlevel.xml +++ b/src/main/resources/alfresco/application-context-highlevel.xml @@ -21,6 +21,7 @@ + diff --git a/src/main/resources/alfresco/minimal-context.xml b/src/main/resources/alfresco/minimal-context.xml index 2345194422..8b603d2ad2 100644 --- a/src/main/resources/alfresco/minimal-context.xml +++ b/src/main/resources/alfresco/minimal-context.xml @@ -19,6 +19,7 @@ + diff --git a/src/main/resources/alfresco/model/contentModel.xml b/src/main/resources/alfresco/model/contentModel.xml index 99f90e650e..459e3773b4 100644 --- a/src/main/resources/alfresco/model/contentModel.xml +++ b/src/main/resources/alfresco/model/contentModel.xml @@ -1393,11 +1393,21 @@ - - + + Rendition + + + Rendition2 + + + Hash code of the source content url + d:int + + + Hidden Rendition diff --git a/src/main/resources/alfresco/rendition-services-context.xml b/src/main/resources/alfresco/rendition-services-context.xml index e0bc87f687..51849d394d 100644 --- a/src/main/resources/alfresco/rendition-services-context.xml +++ b/src/main/resources/alfresco/rendition-services-context.xml @@ -49,11 +49,12 @@ + - - @@ -89,14 +90,14 @@ - - + + - + - + - - + + - + @@ -194,7 +195,7 @@ - + @@ -202,9 +203,9 @@ - + - + @@ -220,7 +221,7 @@ - + diff --git a/src/main/resources/alfresco/rendition-services2-context.xml b/src/main/resources/alfresco/rendition-services2-context.xml new file mode 100644 index 0000000000..b5091e07c4 --- /dev/null +++ b/src/main/resources/alfresco/rendition-services2-context.xml @@ -0,0 +1,217 @@ + + + + + + + + + org.alfresco.repo.rendition2.RenditionService2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${server.transaction.mode.default} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/alfresco/repository.properties b/src/main/resources/alfresco/repository.properties index b559fb51c7..9eb146d430 100644 --- a/src/main/resources/alfresco/repository.properties +++ b/src/main/resources/alfresco/repository.properties @@ -569,6 +569,9 @@ img.url= # before retrying the connection to allow a docker container to (re)start. img.startupRetryPeriodSeconds=60 +# Rendition Service 2 +renditionService2.enabled=true + # Thumbnail Service system.thumbnail.generate=true diff --git a/src/test/java/org/alfresco/AllUnitTestsSuite.java b/src/test/java/org/alfresco/AllUnitTestsSuite.java index ed0ba8206e..b977afe3bd 100644 --- a/src/test/java/org/alfresco/AllUnitTestsSuite.java +++ b/src/test/java/org/alfresco/AllUnitTestsSuite.java @@ -200,7 +200,8 @@ import org.junit.runners.Suite; org.alfresco.util.BeanExtenderUnitTest.class, org.alfresco.util.bean.HierarchicalBeanLoaderTest.class, org.alfresco.util.resource.HierarchicalResourceLoaderTest.class, - org.alfresco.repo.events.ClientUtilTest.class + org.alfresco.repo.events.ClientUtilTest.class, + org.alfresco.repo.rendition2.RenditionService2Test.class }) public class AllUnitTestsSuite { diff --git a/src/test/java/org/alfresco/AppContext01TestSuite.java b/src/test/java/org/alfresco/AppContext01TestSuite.java index b2a3fe960b..647d74763e 100644 --- a/src/test/java/org/alfresco/AppContext01TestSuite.java +++ b/src/test/java/org/alfresco/AppContext01TestSuite.java @@ -66,7 +66,7 @@ import org.junit.runners.Suite; org.alfresco.filesys.repo.ContentDiskDriverTest.class, org.alfresco.filesys.repo.LockKeeperImplTest.class, org.alfresco.repo.activities.ActivityServiceImplTest.class, - org.alfresco.repo.admin.registry.RegistryServiceImplTest.class, + org.alfresco.repo.admin.registry.RegistryServiceImplTest.class }) public class AppContext01TestSuite { diff --git a/src/test/java/org/alfresco/AppContext06TestSuite.java b/src/test/java/org/alfresco/AppContext06TestSuite.java index 779bfb6274..4d67954121 100644 --- a/src/test/java/org/alfresco/AppContext06TestSuite.java +++ b/src/test/java/org/alfresco/AppContext06TestSuite.java @@ -51,7 +51,8 @@ import org.junit.runners.Suite; org.alfresco.repo.tenant.MultiTServiceImplTest.class, org.alfresco.repo.search.SearcherComponentTest.class, org.alfresco.repo.blog.BlogServiceImplTest.class, - org.alfresco.repo.action.scheduled.ScheduledPersistedActionServiceTest.class + org.alfresco.repo.action.scheduled.ScheduledPersistedActionServiceTest.class, + org.alfresco.repo.rendition2.RenditionDefinitionTest.class }) public class AppContext06TestSuite { diff --git a/src/test/java/org/alfresco/MiscContextTestSuite.java b/src/test/java/org/alfresco/MiscContextTestSuite.java index 1e7a90690d..4d27d4cb61 100644 --- a/src/test/java/org/alfresco/MiscContextTestSuite.java +++ b/src/test/java/org/alfresco/MiscContextTestSuite.java @@ -143,7 +143,10 @@ import org.springframework.context.ApplicationContext; // TODO enable in REPO-3811 //org.alfresco.messaging.camel.CamelRoutesTest.class, // Requires a running ActiveMQ - org.alfresco.repo.rawevents.EventBehaviorTest.class + org.alfresco.repo.rawevents.EventBehaviorTest.class, + // Requires running transformers + org.alfresco.repo.rendition2.RenditionService2IntegrationTest.class, + org.alfresco.repo.rendition2.LocalTransformClientIntegrationTest.class }) public class MiscContextTestSuite { diff --git a/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimitsTest.java b/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimitsTest.java index edca03f112..6f3269f732 100644 --- a/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimitsTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerLimitsTest.java @@ -52,7 +52,10 @@ import org.springframework.context.ApplicationContext; /** * Test methods that control limits in {@link AbstractContentTransformerLimits} + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class AbstractContentTransformerLimitsTest { private static final String A = MimetypeMap.MIMETYPE_XML; diff --git a/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerTest.java index e4b1de2065..730ad544fa 100644 --- a/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/AbstractContentTransformerTest.java @@ -63,7 +63,10 @@ import org.springframework.util.ResourceUtils; * implementations. * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class AbstractContentTransformerTest extends TestCase { protected static String QUICK_CONTENT = "The quick brown fox jumps over the lazy dog"; diff --git a/src/test/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformerTest.java index f611fa0a27..c8bc7b4160 100644 --- a/src/test/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/AppleIWorksContentTransformerTest.java @@ -33,7 +33,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * * @author Neil Mc Erlean * @since 4.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class AppleIWorksContentTransformerTest extends AbstractContentTransformerTest { private AppleIWorksContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java index 2f4f2ed808..3c2d1b5440 100644 --- a/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/ArchiveContentTransformerTest.java @@ -44,7 +44,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.ArchiveContentTransformer * * @author Neil McErlean + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ArchiveContentTransformerTest extends AbstractContentTransformerTest { private ArchiveContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformerTest.java index fe8d1dc9ae..ecc9118c35 100644 --- a/src/test/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/BinaryPassThroughContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.repo.content.MimetypeMap; @@ -32,7 +32,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * @see org.alfresco.repo.content.transform.BinaryPassThroughContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class BinaryPassThroughContentTransformerTest extends AbstractContentTransformerTest { private BinaryPassThroughContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/ComplexContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/ComplexContentTransformerTest.java index 7f049d3aed..60e425d320 100644 --- a/src/test/java/org/alfresco/repo/content/transform/ComplexContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/ComplexContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.ArrayList; @@ -38,7 +38,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * @see org.alfresco.repo.content.transform.ComplexContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ComplexContentTransformerTest extends AbstractContentTransformerTest { private ComplexContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/ContentTransformerRegistryTest.java b/src/test/java/org/alfresco/repo/content/transform/ContentTransformerRegistryTest.java index 9ef66d7b1f..5248d15ac6 100644 --- a/src/test/java/org/alfresco/repo/content/transform/ContentTransformerRegistryTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/ContentTransformerRegistryTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.util.Collections; @@ -41,7 +41,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.ContentTransformerRegistry * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ContentTransformerRegistryTest extends AbstractContentTransformerTest { private static final String A = MimetypeMap.MIMETYPE_TEXT_PLAIN; diff --git a/src/test/java/org/alfresco/repo/content/transform/DifferrentMimeTypeTest.java b/src/test/java/org/alfresco/repo/content/transform/DifferrentMimeTypeTest.java index 15832807e8..d196d914fa 100644 --- a/src/test/java/org/alfresco/repo/content/transform/DifferrentMimeTypeTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/DifferrentMimeTypeTest.java @@ -69,7 +69,10 @@ import junit.framework.TestCase; * mimetype of the node matches the content. This is the opposite of what this * test class was originally written to prove for MNT-11015. The current version * was reworked for MNT-16381. + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class DifferrentMimeTypeTest extends TestCase { private static Log log = LogFactory.getLog(DifferrentMimeTypeTest.class); diff --git a/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java index a070223fa7..d0161da515 100644 --- a/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/EMLTransformerTest.java @@ -42,7 +42,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.EMLTransformer * * @author Jamal Kaabi-Mofrad + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class EMLTransformerTest extends AbstractContentTransformerTest { private static final String QUICK_EML_CONTENT = "Gym class featuring a brown fox and lazy dog"; diff --git a/src/test/java/org/alfresco/repo/content/transform/FailoverContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/FailoverContentTransformerTest.java index 9a2eb436cd..a1f44e5963 100644 --- a/src/test/java/org/alfresco/repo/content/transform/FailoverContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/FailoverContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.error.AlfrescoRuntimeException; @@ -43,7 +43,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * @see org.alfresco.repo.content.transform.FailoverContentTransformer * * @author Neil McErlean + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class FailoverContentTransformerTest extends AbstractContentTransformerTest { private static final String sourceMimeType = MimetypeMap.MIMETYPE_PDF; @@ -88,7 +91,10 @@ public class FailoverContentTransformerTest extends AbstractContentTransformerTe * This dummy class is used only for test purposes within this source file. * * @author Neil McErlean + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated class DummyTestContentTransformer extends AbstractContentTransformer2 implements BeanNameAware { private static Log logger = LogFactory.getLog(DummyTestContentTransformer.class); diff --git a/src/test/java/org/alfresco/repo/content/transform/FailoverUnsupportedSubtransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/FailoverUnsupportedSubtransformerTest.java index d8dd640d3f..d3526d2141 100644 --- a/src/test/java/org/alfresco/repo/content/transform/FailoverUnsupportedSubtransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/FailoverUnsupportedSubtransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.File; @@ -46,7 +46,10 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * @see org.alfresco.repo.content.transform.FailoverContentTransformer * * @author Viachaslau Tsikhanovich + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class FailoverUnsupportedSubtransformerTest extends AbstractContentTransformerTest { private static final String sourceMimeType = MimetypeMap.MIMETYPE_EXCEL; @@ -136,6 +139,7 @@ public class FailoverUnsupportedSubtransformerTest extends AbstractContentTransf /** * To share with DummyTestComplexSubtransformer to detect if html2pdf was triggered */ +@Deprecated class TestHtml2PdfTriggeredFlag { private boolean value; @@ -151,6 +155,7 @@ class TestHtml2PdfTriggeredFlag } } +@Deprecated class TestFailoverContentTransformer extends FailoverContentTransformer { private TestHtml2PdfTriggeredFlag triggered; @@ -169,6 +174,7 @@ class TestFailoverContentTransformer extends FailoverContentTransformer /** * This dummy class is used only for test purposes within this source file. */ +@Deprecated class DummyTestComplexSubtransformer extends ComplexContentTransformer { @@ -210,6 +216,7 @@ class DummyTestComplexSubtransformer extends ComplexContentTransformer * * Supported source mimetype can be set */ +@Deprecated class DummyAnyToPDFTestSubtransformer extends DummyTestContentTransformer { @Override diff --git a/src/test/java/org/alfresco/repo/content/transform/HtmlParserContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/HtmlParserContentTransformerTest.java index 3647b69e50..fabd983b79 100644 --- a/src/test/java/org/alfresco/repo/content/transform/HtmlParserContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/HtmlParserContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.ByteArrayInputStream; @@ -37,7 +37,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * @see org.alfresco.repo.content.transform.HtmlParserContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class HtmlParserContentTransformerTest extends AbstractContentTransformerTest { private HtmlParserContentTransformer transformer; @@ -76,24 +79,24 @@ public class HtmlParserContentTransformerTest extends AbstractContentTransformer /** * Checks that we correctly handle text in different encodings, * no matter if the encoding is specified on the Content Property - * or in a meta tag within the HTML itself. (ALF-10466) - * - * On Windows, org.htmlparser.beans.StringBean.carriageReturn() appends a new system dependent new line + * or in a meta tag within the HTML itself. (ALF-10466) + * + * On Windows, org.htmlparser.beans.StringBean.carriageReturn() appends a new system dependent new line * so we must be careful when checking the returned text */ public void testEncodingHandling() throws Exception - { + { final String NEWLINE = System.getProperty ("line.separator"); final String TITLE = "Testing!"; final String TEXT_P1 = "This is some text in English"; final String TEXT_P2 = "This is more text in English"; final String TEXT_P3 = "C'est en Fran\u00e7ais et Espa\u00f1ol"; String partA = "" + TITLE + "" + NEWLINE; - String partB = "

" + TEXT_P1 + "

" + NEWLINE + - "

" + TEXT_P2 + "

" + NEWLINE + + String partB = "

" + TEXT_P1 + "

" + NEWLINE + + "

" + TEXT_P2 + "

" + NEWLINE + "

" + TEXT_P3 + "

" + NEWLINE; String partC = ""; - final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE; + final String expected = TITLE + NEWLINE + TEXT_P1 + NEWLINE + TEXT_P2 + NEWLINE + TEXT_P3 + NEWLINE; ContentWriter content; ContentWriter dest; @@ -114,7 +117,7 @@ public class HtmlParserContentTransformerTest extends AbstractContentTransformer dest.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); transformer.transform(content.getReader(), dest); - + assertEquals(expected, dest.getReader().getContentString()); tmpS.delete(); tmpD.delete(); diff --git a/src/test/java/org/alfresco/repo/content/transform/JodContentTransformerOOoTest.java b/src/test/java/org/alfresco/repo/content/transform/JodContentTransformerOOoTest.java index 0f0ae7f288..2a4c37c9b0 100644 --- a/src/test/java/org/alfresco/repo/content/transform/JodContentTransformerOOoTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/JodContentTransformerOOoTest.java @@ -41,7 +41,10 @@ import org.junit.Test; * * @author Neil McErlean * @since 3.2 SP1 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class JodContentTransformerOOoTest extends AbstractJodConverterBasedTest { private static Log log = LogFactory.getLog(JodContentTransformerOOoTest.class); diff --git a/src/test/java/org/alfresco/repo/content/transform/MailContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/MailContentTransformerTest.java index 996f819f83..2b2f9e3849 100644 --- a/src/test/java/org/alfresco/repo/content/transform/MailContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/MailContentTransformerTest.java @@ -39,7 +39,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.MailContentTransformer * * @author Kevin Roast + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class MailContentTransformerTest extends AbstractContentTransformerTest { private MailContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/MediaWikiContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/MediaWikiContentTransformerTest.java index e8f0fea688..980c42bc70 100644 --- a/src/test/java/org/alfresco/repo/content/transform/MediaWikiContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/MediaWikiContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.BufferedReader; @@ -42,7 +42,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.MediaWikiContentTransformer * * @author Roy Wetherall + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class MediaWikiContentTransformerTest extends AbstractContentTransformerTest { private MediaWikiContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformerTest.java index 3dbb11a444..2d907046a7 100644 --- a/src/test/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/OOXMLThumbnailContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.repo.content.MimetypeMap; @@ -33,7 +33,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * * @author Nick Burch * @since 4.0.1 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class OOXMLThumbnailContentTransformerTest extends AbstractContentTransformerTest { private ContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformerTest.java index fb1e88206a..e267fe5b00 100644 --- a/src/test/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/OpenOfficeContentTransformerTest.java @@ -42,7 +42,10 @@ import org.junit.Ignore; * from the Enterprise Edition. * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class OpenOfficeContentTransformerTest extends AbstractContentTransformerTest { private static String MIMETYPE_RUBBISH = "text/rubbish"; diff --git a/src/test/java/org/alfresco/repo/content/transform/PdfBoxContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/PdfBoxContentTransformerTest.java index 6cbb90dee3..a9741a1de2 100644 --- a/src/test/java/org/alfresco/repo/content/transform/PdfBoxContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/PdfBoxContentTransformerTest.java @@ -46,7 +46,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.PdfBoxContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PdfBoxContentTransformerTest extends AbstractContentTransformerTest { private PdfBoxContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/PoiContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/PoiContentTransformerTest.java index a7f8ebcf0d..48530284a2 100644 --- a/src/test/java/org/alfresco/repo/content/transform/PoiContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/PoiContentTransformerTest.java @@ -32,7 +32,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * @see org.alfresco.repo.content.transform.PoiContentTransformer * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiContentTransformerTest extends AbstractContentTransformerTest { private PoiContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/PoiHssfContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/PoiHssfContentTransformerTest.java index 7fb12ae8aa..17b8461173 100644 --- a/src/test/java/org/alfresco/repo/content/transform/PoiHssfContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/PoiHssfContentTransformerTest.java @@ -40,7 +40,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.PoiHssfContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiHssfContentTransformerTest extends TikaPoweredContentTransformerTest { private PoiHssfContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformerTest.java index aacd683413..5a2cb1c30d 100644 --- a/src/test/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/PoiOOXMLContentTransformerTest.java @@ -44,7 +44,10 @@ import org.alfresco.service.cmr.repository.TransformationOptions; * * @author Nick Burch * @author Dmitry Velichkevich + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class PoiOOXMLContentTransformerTest extends AbstractContentTransformerTest { private static final int SMALL_TIMEOUT = 30; diff --git a/src/test/java/org/alfresco/repo/content/transform/RemoteTransformerClientTest.java b/src/test/java/org/alfresco/repo/content/transform/RemoteTransformerClientTest.java index a3917ed531..db574bf756 100644 --- a/src/test/java/org/alfresco/repo/content/transform/RemoteTransformerClientTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/RemoteTransformerClientTest.java @@ -57,7 +57,10 @@ import static org.springframework.test.util.AssertionErrors.assertTrue; * Tests the retry mechanism in the RemoteTransformerClient. * * @since 6.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class RemoteTransformerClientTest { public static final int STARTUP_RETRY_PERIOD_SECONDS = 2; diff --git a/src/test/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerTest.java index ed39c1eb7e..43b1e0a213 100644 --- a/src/test/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/RuntimeExecutableContentTransformerTest.java @@ -44,7 +44,10 @@ import org.alfresco.util.exec.RuntimeExec; * @see org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class RuntimeExecutableContentTransformerTest extends BaseAlfrescoTestCase { private ContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/StringExtractingContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/StringExtractingContentTransformerTest.java index cdb34095ef..730f9d25e4 100644 --- a/src/test/java/org/alfresco/repo/content/transform/StringExtractingContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/StringExtractingContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import java.io.BufferedOutputStream; @@ -46,7 +46,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.StringExtractingContentTransformer * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class StringExtractingContentTransformerTest extends AbstractContentTransformerTest { private static final String SOME_CONTENT; diff --git a/src/test/java/org/alfresco/repo/content/transform/TextMiningContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/TextMiningContentTransformerTest.java index 81c6a9eaf4..db3714e7e6 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TextMiningContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TextMiningContentTransformerTest.java @@ -40,7 +40,10 @@ import org.alfresco.util.TempFileProvider; * old and unsupported Text Mining library! * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TextMiningContentTransformerTest extends AbstractContentTransformerTest { private TextMiningContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/TextToPdfContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/TextToPdfContentTransformerTest.java index 9de8e5c69f..73dfff94ff 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TextToPdfContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TextToPdfContentTransformerTest.java @@ -44,7 +44,10 @@ import org.apache.pdfbox.text.PDFTextStripper; * * @author Derek Hulley * @since 2.1.0 + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TextToPdfContentTransformerTest extends AbstractContentTransformerTest { private TextToPdfContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/TikaAutoContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/TikaAutoContentTransformerTest.java index 29d295d102..b1aa675f3d 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TikaAutoContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TikaAutoContentTransformerTest.java @@ -36,7 +36,10 @@ import org.apache.tika.config.TikaConfig; * @see org.alfresco.repo.content.transform.TikaAutoContentTransformer * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TikaAutoContentTransformerTest extends TikaPoweredContentTransformerTest { private TikaAutoContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformerTest.java index 7eeef64dac..1d995e68dc 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TikaPoweredContentTransformerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.repo.content.MimetypeMap; @@ -31,7 +31,10 @@ import org.alfresco.repo.content.MimetypeMap; * Parent test for Tika powered transformer tests * * @author Nick Burch + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public abstract class TikaPoweredContentTransformerTest extends AbstractContentTransformerTest { protected boolean isQuickPhraseExpected(String targetMimetype) diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformersTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformersTest.java index 14b99b1c92..499c96a661 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformersTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigDynamicTransformersTest.java @@ -1,54 +1,57 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; -import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; -import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockProperties; -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.when; - -import java.util.Properties; - -import org.alfresco.service.cmr.module.ModuleDetails; -import org.alfresco.service.cmr.module.ModuleService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.MimetypeService; -import org.alfresco.service.cmr.repository.TransformationOptions; -import org.alfresco.service.descriptor.Descriptor; -import org.alfresco.service.descriptor.DescriptorService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.Mock; +import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; +import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockProperties; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; + +import java.util.Properties; + +import org.alfresco.service.cmr.module.ModuleDetails; +import org.alfresco.service.cmr.module.ModuleService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.MimetypeService; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.service.descriptor.Descriptor; +import org.alfresco.service.descriptor.DescriptorService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; import org.mockito.MockitoAnnotations; /** * Tests the TransformerConfigDynamicTransformers class. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigDynamicTransformersTest { @Mock @@ -136,9 +139,9 @@ public class TransformerConfigDynamicTransformersTest assertEquals("transformer.transformer3", transformer.getIntermediateTransformers().get(2).getName()); // - transformer.isTransformable("application/pdf", -1, "text/txt", new TransformationOptions()); - } - + transformer.isTransformable("application/pdf", -1, "text/txt", new TransformationOptions()); + } + @Test // Pipeline - too few components in the value public void pipelineTooFewCompsTest() @@ -404,82 +407,82 @@ public class TransformerConfigDynamicTransformersTest ampTransformer("testAmp"); assertEquals(4, transformerRegistry.getAllTransformers().size()); - } - - // for MNT-16381 + } + + // for MNT-16381 - @Test - public void failoverPropertyFFTest() - { - internalPropertyTest(false, false, false); - } - - @Test - public void failoverPropertyFTTest() - { - internalPropertyTest(false, false, true); - } - - @Test - public void failoverPropertyTFTest() - { - internalPropertyTest(false, true, false); - } - - @Test - public void failoverPropertyTTTest() - { - internalPropertyTest(false, true, true); - } - - @Test - public void pipelinePropertyFFTest() - { - internalPropertyTest(true, false, false); - } - - @Test - public void pipelinePropertyFTTest() - { - internalPropertyTest(true, false, true); - } - - @Test - public void pipelinePropertyTFTest() - { - internalPropertyTest(true, true, false); - } - - @Test - public void pipelinePropertyTTTest() - { - internalPropertyTest(true, true, true); - } - - private void internalPropertyTest(boolean pipeline, boolean expectedRetry, boolean expectedCheck) - { - String[] transformerNamesAndValues = pipeline - ? new String[] {"content.transformer.transformerA.pipeline", "transformer1|pdf|transformer2"} - : new String[] {"content.transformer.transformerA.failover", "transformer1|transformer2|transformer3"}; - - Properties properties = new Properties(); - if (expectedRetry) - { - properties.setProperty("content.transformer.retryOn.different.mimetype", "true"); - } - if (expectedCheck) - { - properties.setProperty("transformer.strict.mimetype.check", "true"); - } - - mockProperties(transformerProperties, transformerNamesAndValues); - - assertEquals(0, new TransformerConfigDynamicTransformers(transformerConfig, transformerProperties, mimetypeService, contentService, - transformerRegistry, transformerDebug, null, null, properties).getErrorCount()); - - // Throws an exception if it does not exist - AbstractContentTransformer2 transformer = (AbstractContentTransformer2)transformerRegistry.getTransformer("transformer.transformerA"); - assertEquals("retryTransformOnDifferentMimeType was not set", expectedRetry, transformer.getRetryTransformOnDifferentMimeType()); - assertEquals("strictMimetypeCheck was not set", expectedCheck, transformer.getStrictMimeTypeCheck()); - } + @Test + public void failoverPropertyFFTest() + { + internalPropertyTest(false, false, false); + } + + @Test + public void failoverPropertyFTTest() + { + internalPropertyTest(false, false, true); + } + + @Test + public void failoverPropertyTFTest() + { + internalPropertyTest(false, true, false); + } + + @Test + public void failoverPropertyTTTest() + { + internalPropertyTest(false, true, true); + } + + @Test + public void pipelinePropertyFFTest() + { + internalPropertyTest(true, false, false); + } + + @Test + public void pipelinePropertyFTTest() + { + internalPropertyTest(true, false, true); + } + + @Test + public void pipelinePropertyTFTest() + { + internalPropertyTest(true, true, false); + } + + @Test + public void pipelinePropertyTTTest() + { + internalPropertyTest(true, true, true); + } + + private void internalPropertyTest(boolean pipeline, boolean expectedRetry, boolean expectedCheck) + { + String[] transformerNamesAndValues = pipeline + ? new String[] {"content.transformer.transformerA.pipeline", "transformer1|pdf|transformer2"} + : new String[] {"content.transformer.transformerA.failover", "transformer1|transformer2|transformer3"}; + + Properties properties = new Properties(); + if (expectedRetry) + { + properties.setProperty("content.transformer.retryOn.different.mimetype", "true"); + } + if (expectedCheck) + { + properties.setProperty("transformer.strict.mimetype.check", "true"); + } + + mockProperties(transformerProperties, transformerNamesAndValues); + + assertEquals(0, new TransformerConfigDynamicTransformers(transformerConfig, transformerProperties, mimetypeService, contentService, + transformerRegistry, transformerDebug, null, null, properties).getErrorCount()); + + // Throws an exception if it does not exist + AbstractContentTransformer2 transformer = (AbstractContentTransformer2)transformerRegistry.getTransformer("transformer.transformerA"); + assertEquals("retryTransformOnDifferentMimeType was not set", expectedRetry, transformer.getRetryTransformOnDifferentMimeType()); + assertEquals("strictMimetypeCheck was not set", expectedCheck, transformer.getStrictMimeTypeCheck()); + } } diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigImplTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigImplTest.java index ab84e62b88..22674b0e92 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigImplTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigImplTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -55,7 +55,10 @@ import org.springframework.context.ApplicationContext; * the real method is called. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigImplTest { @Mock @@ -168,11 +171,11 @@ public class TransformerConfigImplTest "# ===========================\n" + "# Use small values as these logs are held in memory. 0 to disable.\n" + "transformer.log.entries=0 # default=50\n" + - "# transformer.debug.entries=0\n" + - "\n" + - "# Miscellaneous settings\n" + - "# ======================\n" + - "# transformer.strict.mimetype.check.whitelist.mimetypes=application/eps;application/postscript;application/illustrator;application/pdf;application/x-tar;application/x-gtar;application/acp;application/zip;application/vnd.stardivision.math;application/x-tika-msoffice\n", + "# transformer.debug.entries=0\n" + + "\n" + + "# Miscellaneous settings\n" + + "# ======================\n" + + "# transformer.strict.mimetype.check.whitelist.mimetypes=application/eps;application/postscript;application/illustrator;application/pdf;application/x-tar;application/x-gtar;application/acp;application/zip;application/vnd.stardivision.math;application/x-tika-msoffice\n", actual); } diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigLimitsTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigLimitsTest.java index c8c003f174..ac609e391e 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigLimitsTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigLimitsTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -40,7 +40,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerConfigLimits. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigLimitsTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImplTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImplTest.java index 2bdf3c8681..28b7361e7e 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImplTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigMBeanImplTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -49,7 +49,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerConfigMBeanImpl. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigMBeanImplTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigPropertyTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigPropertyTest.java index e947d6a32c..cd3776a6cd 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigPropertyTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigPropertyTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerConfig.ANY; @@ -45,7 +45,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerConfigProperty. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigPropertyTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigStatisticsTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigStatisticsTest.java index 8b72659228..6f53150ced 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigStatisticsTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigStatisticsTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -40,7 +40,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerConfigStatistics. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigStatisticsTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigSupportedTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigSupportedTest.java index 9592d057d8..e610e726f7 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigSupportedTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigSupportedTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -40,7 +40,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerConfigSupported. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigSupportedTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigTestSuite.java b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigTestSuite.java index 926f21d3c0..ea6653d8bf 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerConfigTestSuite.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerConfigTestSuite.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import org.alfresco.util.LogAdapterTest; @@ -63,7 +63,10 @@ import org.junit.runners.Suite.SuiteClasses; * Test classes in the Transformers subsystem * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerConfigTestSuite { } diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerDebugLogTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerDebugLogTest.java index ac5365f434..79a88920a5 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerDebugLogTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerDebugLogTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.junit.Assert.*; @@ -41,7 +41,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerDebugLog. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerDebugLogTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerDebugTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerDebugTest.java index c4191131f9..34255bec4a 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerDebugTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerDebugTest.java @@ -49,7 +49,10 @@ import static org.mockito.Mockito.when; * Test class for TransformerDebug. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerDebugTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerLogTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerLogTest.java index 339e8fba22..9281a593c4 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerLogTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerLogTest.java @@ -39,7 +39,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerLog. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerLogTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerLoggerTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerLoggerTest.java index 5b27ed6492..7906c8c608 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerLoggerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerLoggerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.junit.Assert.assertArrayEquals; @@ -44,7 +44,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerLogger. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerLoggerTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertiesTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertiesTest.java index 937d22a772..4a634cd82b 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertiesTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertiesTest.java @@ -44,7 +44,10 @@ import static org.mockito.Mockito.when; * are aliased to JodConverter settings if they are not set up. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerPropertiesTest { @Mock diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyGetterTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyGetterTest.java index 92e70252b1..3b97a4b388 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyGetterTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyGetterTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.alfresco.repo.content.transform.TransformerPropertyNameExtractorTest.mockMimetypes; @@ -48,7 +48,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerPropertyGetter. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerPropertyGetterTest { @Mock @@ -120,49 +123,49 @@ public class TransformerPropertyGetterTest when(transformerRegistry.getAllTransformers()).thenReturn(allTransformers); } - @Test - public void logEntriesTest() - { - String actual = new TransformerPropertyGetter(false, transformerProperties, - mimetypeService, transformerRegistry, transformerLog, transformerDebugLog).toString(); - - assertEquals("# LOG and DEBUG history sizes\n" + - "# ===========================\n" + - "# Use small values as these logs are held in memory. 0 to disable.\n" + - "# transformer.log.entries=0\n" + - "# transformer.debug.entries=0\n", actual); - } - - @Test - public void miscTest() - { - Properties defaultProperties = new Properties(); - defaultProperties.setProperty("transformer.another", "aValue"); - defaultProperties.setProperty("transformer.yet.another", "77"); - defaultProperties.setProperty("transformer.strict.mimetype.check.whitelist.mimetypes", "application/eps;application/postscript;application/illustrator;application/pdf"); - when(transformerProperties.getDefaultProperties()).thenReturn(defaultProperties); - - mockProperties(transformerProperties, - "transformer.strict.mimetype.check.whitelist.mimetypes", "application/eps;application/postscript;application/illustrator;application/pdf", // same value - "transformer.another", "aNewValue"); // changed value - - String actual = new TransformerPropertyGetter(false, transformerProperties, - mimetypeService, transformerRegistry, transformerLog, transformerDebugLog).toString(); - - assertEquals("# LOG and DEBUG history sizes\n" + - "# ===========================\n" + - "# Use small values as these logs are held in memory. 0 to disable.\n" + - "# transformer.log.entries=0\n" + - "# transformer.debug.entries=0\n" + - "\n" + - "# Miscellaneous settings\n" + - "# ======================\n" + - "transformer.another=aNewValue # default=aValue\n" + - "# transformer.strict.mimetype.check.whitelist.mimetypes=application/eps;application/postscript;application/illustrator;application/pdf\n" + - "# transformer.yet.another=77\n", - actual); - } - + @Test + public void logEntriesTest() + { + String actual = new TransformerPropertyGetter(false, transformerProperties, + mimetypeService, transformerRegistry, transformerLog, transformerDebugLog).toString(); + + assertEquals("# LOG and DEBUG history sizes\n" + + "# ===========================\n" + + "# Use small values as these logs are held in memory. 0 to disable.\n" + + "# transformer.log.entries=0\n" + + "# transformer.debug.entries=0\n", actual); + } + + @Test + public void miscTest() + { + Properties defaultProperties = new Properties(); + defaultProperties.setProperty("transformer.another", "aValue"); + defaultProperties.setProperty("transformer.yet.another", "77"); + defaultProperties.setProperty("transformer.strict.mimetype.check.whitelist.mimetypes", "application/eps;application/postscript;application/illustrator;application/pdf"); + when(transformerProperties.getDefaultProperties()).thenReturn(defaultProperties); + + mockProperties(transformerProperties, + "transformer.strict.mimetype.check.whitelist.mimetypes", "application/eps;application/postscript;application/illustrator;application/pdf", // same value + "transformer.another", "aNewValue"); // changed value + + String actual = new TransformerPropertyGetter(false, transformerProperties, + mimetypeService, transformerRegistry, transformerLog, transformerDebugLog).toString(); + + assertEquals("# LOG and DEBUG history sizes\n" + + "# ===========================\n" + + "# Use small values as these logs are held in memory. 0 to disable.\n" + + "# transformer.log.entries=0\n" + + "# transformer.debug.entries=0\n" + + "\n" + + "# Miscellaneous settings\n" + + "# ======================\n" + + "transformer.another=aNewValue # default=aValue\n" + + "# transformer.strict.mimetype.check.whitelist.mimetypes=application/eps;application/postscript;application/illustrator;application/pdf\n" + + "# transformer.yet.another=77\n", + actual); + } + @Test public void defaultTest() { diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractorTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractorTest.java index af872c61fe..0aefc1c251 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractorTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertyNameExtractorTest.java @@ -1,31 +1,31 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; -import static org.alfresco.repo.content.transform.TransformerConfig.ANY; +import static org.alfresco.repo.content.transform.TransformerConfig.ANY; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; @@ -38,7 +38,7 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; +import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicInteger; @@ -53,7 +53,11 @@ import org.mockito.MockitoAnnotations; * Test class for some of the regex methods and TransformerPropertyNameExtractor in general. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated +@SuppressWarnings("deprecation") public class TransformerPropertyNameExtractorTest { @Mock @@ -95,18 +99,18 @@ public class TransformerPropertyNameExtractorTest throw new java.lang.IllegalStateException("There should be a value for every property"); } - final Set propertyNames = new TreeSet(); + final Set propertyNames = new TreeSet(); for (int i=0; i < namesAndValues.length; i+=2) - { - String name = namesAndValues[i]; - String value = namesAndValues[i+1]; - if (name.startsWith(TransformerConfig.PREFIX)) - { - propertyNames.add(name); - } + { + String name = namesAndValues[i]; + String value = namesAndValues[i+1]; + if (name.startsWith(TransformerConfig.PREFIX)) + { + propertyNames.add(name); + } when(transformerProperties.getProperty(name)).thenReturn(value); } - when(transformerProperties.getPropertyNames()).thenReturn(propertyNames); + when(transformerProperties.getPropertyNames()).thenReturn(propertyNames); } /** @@ -698,6 +702,8 @@ public class TransformerPropertyNameExtractorTest } } +@Deprecated +@SuppressWarnings("deprecation") class TestTransformerPropertyNameExtractor extends TransformerPropertyNameExtractor { public Collection callGetTransformerSourceTargetValues(Collection suffixes, diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertySetterTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertySetterTest.java index 296eb0bc22..a4feb06b93 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerPropertySetterTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerPropertySetterTest.java @@ -54,7 +54,10 @@ import org.mockito.MockitoAnnotations; * Tests TransformerPropertySetter. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerPropertySetterTest { @Mock @@ -641,6 +644,7 @@ public class TransformerPropertySetterTest } } +@Deprecated class DummyContentTransformer implements ContentTransformer { private final String name; diff --git a/src/test/java/org/alfresco/repo/content/transform/TransformerSelectorImplTest.java b/src/test/java/org/alfresco/repo/content/transform/TransformerSelectorImplTest.java index 2434fd3497..b17ae254f3 100644 --- a/src/test/java/org/alfresco/repo/content/transform/TransformerSelectorImplTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/TransformerSelectorImplTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.content.transform; import static org.junit.Assert.*; @@ -42,7 +42,10 @@ import org.mockito.MockitoAnnotations; * Test class for TransformerSelectorImpl. * * @author Alan Davis + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformerSelectorImplTest { private static final String PNG = "image/png"; @@ -299,6 +302,7 @@ public class TransformerSelectorImplTest } } +@Deprecated class DummyTransformerStatistics extends TransformerStatisticsImpl { private final long count; diff --git a/src/test/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerTest.java b/src/test/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerTest.java index 9c1573992c..ca1da0fa3a 100644 --- a/src/test/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerTest.java +++ b/src/test/java/org/alfresco/repo/content/transform/magick/ImageMagickContentTransformerTest.java @@ -47,7 +47,10 @@ import org.alfresco.util.TempFileProvider; * @see org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker * * @author Derek Hulley + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ImageMagickContentTransformerTest extends AbstractContentTransformerTest { private ProxyContentTransformer transformer; diff --git a/src/test/java/org/alfresco/repo/rendition/MockedTestServiceRegistry.java b/src/test/java/org/alfresco/repo/rendition/MockedTestServiceRegistry.java index 19e226147e..f7bafd4642 100644 --- a/src/test/java/org/alfresco/repo/rendition/MockedTestServiceRegistry.java +++ b/src/test/java/org/alfresco/repo/rendition/MockedTestServiceRegistry.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; import static org.mockito.Mockito.mock; @@ -89,6 +89,11 @@ import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; +/** + * + * @deprecated We are introducing the new async RenditionService2. + */ +@Deprecated public class MockedTestServiceRegistry implements ServiceRegistry { private final ActionService actionService = mock(ActionService.class); diff --git a/src/test/java/org/alfresco/repo/rendition/MultiUserRenditionTest.java b/src/test/java/org/alfresco/repo/rendition/MultiUserRenditionTest.java index e4996a016a..a136075a21 100644 --- a/src/test/java/org/alfresco/repo/rendition/MultiUserRenditionTest.java +++ b/src/test/java/org/alfresco/repo/rendition/MultiUserRenditionTest.java @@ -1,66 +1,66 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - -import java.io.File; -import java.io.Serializable; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.model.ContentModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.content.transform.AbstractContentTransformerTest; -import org.alfresco.repo.model.Repository; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.transaction.RetryingTransactionHelper; -import org.alfresco.service.cmr.rendition.RenditionService; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.security.MutableAuthenticationService; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.security.PersonService; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.transaction.TransactionService; -import org.alfresco.util.ApplicationContextHelper; -import org.alfresco.util.Pair; -import org.alfresco.util.PropertyMap; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.Serializable; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.content.transform.AbstractContentTransformerTest; +import org.alfresco.repo.model.Repository; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.OwnableService; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.ApplicationContextHelper; +import org.alfresco.util.Pair; +import org.alfresco.util.PropertyMap; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.springframework.context.ApplicationContext; /** @@ -68,7 +68,10 @@ import org.springframework.context.ApplicationContext; * * @author Neil McErlean * @since 3.3.4 + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class MultiUserRenditionTest { private ApplicationContext appContext; @@ -76,37 +79,37 @@ public class MultiUserRenditionTest private static String ADMIN_USER; private static final String NON_ADMIN_USER = "nonAdmin"; - private MutableAuthenticationService authenticationService; - private ContentService contentService; - private NodeService nodeService; - private PermissionService permissionService; - private PersonService personService; - private RenditionService renditionService; - private Repository repositoryHelper; - private RetryingTransactionHelper txnHelper; - private TransactionService transactionService; + private MutableAuthenticationService authenticationService; + private ContentService contentService; + private NodeService nodeService; + private PermissionService permissionService; + private PersonService personService; + private RenditionService renditionService; + private Repository repositoryHelper; + private RetryingTransactionHelper txnHelper; + private TransactionService transactionService; private OwnableService ownableService; private List nodesToBeTidiedUp = new ArrayList(); private NodeRef testFolder; - - @Before public void createTestFolder() - { - initContextAndCreateUser(); - AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); - final NodeRef companyHome = repositoryHelper.getCompanyHome(); - - Map props = new HashMap(); - props.put(ContentModel.PROP_NAME, this.getClass() + "_testFolder"); - testFolder = nodeService.createNode(companyHome, - ContentModel.ASSOC_CONTAINS, - ContentModel.ASSOC_CONTAINS, - ContentModel.TYPE_FOLDER, - props).getChildRef(); - // Let anyone (meaning non-admin) do anything (meaning create new content) - permissionService.setPermission(testFolder, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true); - this.nodesToBeTidiedUp.add(testFolder); - } + + @Before public void createTestFolder() + { + initContextAndCreateUser(); + AuthenticationUtil.setFullyAuthenticatedUser(ADMIN_USER); + final NodeRef companyHome = repositoryHelper.getCompanyHome(); + + Map props = new HashMap(); + props.put(ContentModel.PROP_NAME, this.getClass() + "_testFolder"); + testFolder = nodeService.createNode(companyHome, + ContentModel.ASSOC_CONTAINS, + ContentModel.ASSOC_CONTAINS, + ContentModel.TYPE_FOLDER, + props).getChildRef(); + // Let anyone (meaning non-admin) do anything (meaning create new content) + permissionService.setPermission(testFolder, PermissionService.ALL_AUTHORITIES, PermissionService.ALL_PERMISSIONS, true); + this.nodesToBeTidiedUp.add(testFolder); + } public void initContextAndCreateUser() { diff --git a/src/test/java/org/alfresco/repo/rendition/RenditionNodeManagerTest.java b/src/test/java/org/alfresco/repo/rendition/RenditionNodeManagerTest.java index f06a7ea400..7c279aad4d 100644 --- a/src/test/java/org/alfresco/repo/rendition/RenditionNodeManagerTest.java +++ b/src/test/java/org/alfresco/repo/rendition/RenditionNodeManagerTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -51,7 +51,10 @@ import org.alfresco.service.namespace.QName; /** * @author Nick Smith + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class RenditionNodeManagerTest extends TestCase { private final NodeService nodeService = mock(NodeService.class); diff --git a/src/test/java/org/alfresco/repo/rendition/RenditionServiceImplTest.java b/src/test/java/org/alfresco/repo/rendition/RenditionServiceImplTest.java index 6c09b48944..a33d8d485b 100644 --- a/src/test/java/org/alfresco/repo/rendition/RenditionServiceImplTest.java +++ b/src/test/java/org/alfresco/repo/rendition/RenditionServiceImplTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -45,7 +45,10 @@ import org.alfresco.service.namespace.QName; /** * @author Nick Smith + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class RenditionServiceImplTest extends TestCase { private final static String ENGINE_NAME = "Engine Name"; diff --git a/src/test/java/org/alfresco/repo/rendition/RenditionServiceIntegrationTest.java b/src/test/java/org/alfresco/repo/rendition/RenditionServiceIntegrationTest.java index e764e7f8f0..1603a9e1ec 100644 --- a/src/test/java/org/alfresco/repo/rendition/RenditionServiceIntegrationTest.java +++ b/src/test/java/org/alfresco/repo/rendition/RenditionServiceIntegrationTest.java @@ -26,21 +26,6 @@ package org.alfresco.repo.rendition; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.Serializable; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import javax.imageio.ImageIO; - import org.alfresco.model.ContentModel; import org.alfresco.model.RenditionModel; import org.alfresco.repo.action.RuntimeActionService; @@ -101,11 +86,28 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.test.context.transaction.TestTransaction; import org.springframework.transaction.annotation.Transactional; +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + /** * @author Neil McErlean * @author Nick Smith * @since 3.3 + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @SuppressWarnings("deprecation") @Category({OwnJVMTestsCategory.class}) @Transactional diff --git a/src/test/java/org/alfresco/repo/rendition/RenditionServicePermissionsTest.java b/src/test/java/org/alfresco/repo/rendition/RenditionServicePermissionsTest.java index 4197d44903..4d268bc53d 100644 --- a/src/test/java/org/alfresco/repo/rendition/RenditionServicePermissionsTest.java +++ b/src/test/java/org/alfresco/repo/rendition/RenditionServicePermissionsTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition; @@ -82,7 +82,10 @@ import static org.junit.Assert.*; /** * @author Neil McErlean * @since 3.3 + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @Category(OwnJVMTestsCategory.class) public class RenditionServicePermissionsTest { diff --git a/src/test/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverTest.java b/src/test/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverTest.java index 51081f9fa4..c40dbec015 100644 --- a/src/test/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverTest.java +++ b/src/test/java/org/alfresco/repo/rendition/StandardRenditionLocationResolverTest.java @@ -51,7 +51,10 @@ import org.springframework.transaction.annotation.Transactional; /** * @author Brian Remmington * @author Nick Smith + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @Category(BaseSpringTestsCategory.class) @Transactional public class StandardRenditionLocationResolverTest extends BaseAlfrescoSpringTest diff --git a/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java b/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java index 8794869737..dbac3a04a7 100644 --- a/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java +++ b/src/test/java/org/alfresco/repo/rendition/executer/AbstractRenderingEngineTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.rendition.executer; import static org.mockito.Matchers.any; @@ -55,7 +55,10 @@ import org.mockito.ArgumentCaptor; /** * @author Nick Smith + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated public class AbstractRenderingEngineTest extends TestCase { private final NodeRef source = new NodeRef("http://test/sourceId"); diff --git a/src/test/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java b/src/test/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java index fa8bdc9433..c98c70f9c2 100644 --- a/src/test/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java +++ b/src/test/java/org/alfresco/repo/rendition/executer/HTMLRenderingEngineTest.java @@ -62,7 +62,10 @@ import org.springframework.transaction.annotation.Transactional; * Unit tests for the HTML Rendering Engine * * @author Nick Burch + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @Category(BaseSpringTestsCategory.class) @Transactional public class HTMLRenderingEngineTest extends BaseAlfrescoSpringTest diff --git a/src/test/java/org/alfresco/repo/rendition/executer/XSLTFunctionsTest.java b/src/test/java/org/alfresco/repo/rendition/executer/XSLTFunctionsTest.java index ccfbf6fb99..ab3227c687 100644 --- a/src/test/java/org/alfresco/repo/rendition/executer/XSLTFunctionsTest.java +++ b/src/test/java/org/alfresco/repo/rendition/executer/XSLTFunctionsTest.java @@ -58,7 +58,10 @@ import org.w3c.dom.NodeList; /** * @author Brian * + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @Category({BaseSpringTestsCategory.class}) @Transactional public class XSLTFunctionsTest extends BaseAlfrescoSpringTest diff --git a/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java b/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java index 8d489a6552..b11561c863 100644 --- a/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java +++ b/src/test/java/org/alfresco/repo/rendition/executer/XSLTRenderingEngineTest.java @@ -58,8 +58,11 @@ import org.springframework.transaction.annotation.Transactional; /** * @author Brian - * + * + * + * @deprecated We are introducing the new async RenditionService2. */ +@Deprecated @Category(BaseSpringTestsCategory.class) @Transactional public class XSLTRenderingEngineTest extends BaseAlfrescoSpringTest diff --git a/src/test/java/org/alfresco/repo/rendition2/AbstractRenditionIntegrationTest.java b/src/test/java/org/alfresco/repo/rendition2/AbstractRenditionIntegrationTest.java new file mode 100644 index 0000000000..ddbded1866 --- /dev/null +++ b/src/test/java/org/alfresco/repo/rendition2/AbstractRenditionIntegrationTest.java @@ -0,0 +1,148 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Collections; +import org.alfresco.model.ContentModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.MimetypeService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.security.AuthenticationService; +import org.alfresco.service.cmr.security.MutableAuthenticationService; +import org.alfresco.service.cmr.security.PersonService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.alfresco.util.BaseSpringTest; +import org.alfresco.util.GUID; +import org.alfresco.util.PropertyMap; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ResourceUtils; + +/** + * Class unites common utility methods for {@link org.alfresco.repo.rendition2} package tests. + */ +public abstract class AbstractRenditionIntegrationTest extends BaseSpringTest +{ + @Autowired + NodeService nodeService; + + @Autowired + ContentService contentService; + + @Autowired + MimetypeService mimetypeService; + + @Autowired + TransactionService transactionService; + + @Autowired + PersonService personService; + + @Autowired + MutableAuthenticationService authenticationService; + + static String PASSWORD = "password"; + + NodeRef createContentNodeFromQuickFile(String fileName) throws FileNotFoundException + { + NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); + NodeRef folderNodeRef = nodeService.createNode( + rootNodeRef, + ContentModel.ASSOC_CHILDREN, + QName.createQName(getName() + GUID.generate()), + ContentModel.TYPE_FOLDER).getChildRef(); + + File file = ResourceUtils.getFile("classpath:quick/" + fileName); + NodeRef contentRef = nodeService.createNode( + folderNodeRef, + ContentModel.ASSOC_CONTAINS, + ContentModel.ASSOC_CONTAINS, + ContentModel.TYPE_CONTENT, + Collections.singletonMap(ContentModel.PROP_NAME, fileName)) + .getChildRef(); + ContentWriter contentWriter = contentService.getWriter(contentRef, ContentModel.PROP_CONTENT, true); + contentWriter.setMimetype(mimetypeService.guessMimetype(fileName)); + contentWriter.putContent(file); + + return contentRef; + } + + static String generateNewUsernameString() + { + return "user-" + GUID.generate(); + } + + String createRandomUser() + { + return AuthenticationUtil.runAs(() -> + { + String username = generateNewUsernameString(); + createUser(username); + return username; + }, AuthenticationUtil.getAdminUserName()); + } + + void createUser(String username) + { + createUser(username, "firstName", "lastName", "jobTitle", 0); + } + + void createUser(final String username, + final String firstName, + final String lastName, + final String jobTitle, + final long quota) + { + RetryingTransactionHelper.RetryingTransactionCallback createUserCallback = () -> + { + authenticationService.createAuthentication(username, PASSWORD.toCharArray()); + + PropertyMap personProperties = new PropertyMap(); + personProperties.put(ContentModel.PROP_USERNAME, username); + personProperties.put(ContentModel.PROP_AUTHORITY_DISPLAY_NAME, "title" + username); + personProperties.put(ContentModel.PROP_FIRSTNAME, firstName); + personProperties.put(ContentModel.PROP_LASTNAME, lastName); + personProperties.put(ContentModel.PROP_EMAIL, username+"@example.com"); + personProperties.put(ContentModel.PROP_JOBTITLE, jobTitle); + if (quota > 0) + { + personProperties.put(ContentModel.PROP_SIZE_QUOTA, quota); + } + personService.createPerson(personProperties); + return null; + }; + + RetryingTransactionHelper txnHelper = transactionService.getRetryingTransactionHelper(); + txnHelper.doInTransaction(createUserCallback); + } +} diff --git a/src/test/java/org/alfresco/repo/rendition2/LocalTransformClientIntegrationTest.java b/src/test/java/org/alfresco/repo/rendition2/LocalTransformClientIntegrationTest.java new file mode 100644 index 0000000000..6b8db1beb5 --- /dev/null +++ b/src/test/java/org/alfresco/repo/rendition2/LocalTransformClientIntegrationTest.java @@ -0,0 +1,181 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.alfresco.model.ContentModel.PROP_CONTENT; + +/** + * Integration tests for {@link LocalTransformClient} + */ +public class LocalTransformClientIntegrationTest extends AbstractRenditionIntegrationTest +{ + @Autowired + private TransformClient transformClient; + + @Autowired + private RenditionDefinitionRegistry2 renditionDefinitionRegistry2; + + @Autowired + private RenditionService2 renditionService2; + + @Before + public void setUp() + { + AuthenticationUtil.setRunAsUser(AuthenticationUtil.getAdminUserName()); + assertTrue("A wrong type of transform client detected", transformClient instanceof LocalTransformClient); + } + + + // PDF transformation + + @Test + public void testLocalRenderPdfToJpegMedium() throws Exception + { + checkRendition("quick.pdf", "medium", true); + } + + @Test + public void testLocalRenderPdfToDoclib() throws Exception + { + checkRendition("quick.pdf", "doclib", true); + } + + @Test + public void testLocalRenderPdfJpegImgpreview() throws Exception + { + checkRendition("quick.pdf", "imgpreview", true); + } + + @Test + public void testLocalRenderPdfPngAvatar() throws Exception + { + checkRendition("quick.pdf", "avatar", true); + } + + @Test + public void testLocalRenderPdfPngAvatar32() throws Exception + { + checkRendition("quick.pdf", "avatar32", true); + } + + @Test + public void testLocalRenderPdfFlashWebpreview() throws Exception + { + checkRendition("quick.pdf", "webpreview", false); + } + + // DOCX transformation + + @Test + public void testLocalRenderDocxJpegMedium() throws Exception + { + checkRendition("quick.docx", "medium", true); + } + + @Test + public void testLocalRenderDocxDoclib() throws Exception + { + checkRendition("quick.docx", "doclib", true); + } + + @Test + public void testLocalRenderDocxJpegImgpreview() throws Exception + { + checkRendition("quick.docx", "imgpreview", true); + } + + @Test + public void testLocalRenderDocxPngAvatar() throws Exception + { + checkRendition("quick.docx", "avatar", true); + } + + @Test + public void testLocalRenderDocxPngAvatar32() throws Exception + { + checkRendition("quick.docx", "avatar32", true); + } + + @Test + public void testLocalRenderDocxFlashWebpreview() throws Exception + { + checkRendition("quick.docx", "webpreview", false); + } + + @Test + public void testLocalRenderDocxPdf() throws Exception + { + checkRendition("quick.docx", "pdf", false); + } + + private void checkRendition(String testFileName, String renditionDefinitionName, boolean expectedToPass) throws InterruptedException + { + if (expectedToPass) + { + // split into separate transactions as the client is async + NodeRef sourceNode = transactionService.getRetryingTransactionHelper().doInTransaction(() -> + createContentNodeFromQuickFile(testFileName)); + int sourceContentUrlHash = DefaultTypeConverter.INSTANCE.convert( + ContentData.class, + nodeService.getProperty(sourceNode, PROP_CONTENT)) + .getContentUrl().hashCode(); + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + RenditionDefinition2 renditionDefinition = + renditionDefinitionRegistry2.getRenditionDefinition(renditionDefinitionName); + transformClient.transform( + sourceNode, + renditionDefinition, + AuthenticationUtil.getAdminUserName(), + sourceContentUrlHash); + return null; + }); + ChildAssociationRef childAssociationRef = null; + for (int i = 0; i < 20; i++) + { + childAssociationRef = renditionService2.getRenditionByName(sourceNode, renditionDefinitionName); + if (childAssociationRef != null) + { + break; + } + else + { + Thread.sleep(500); + } + } + assertNotNull("The " + renditionDefinitionName + " rendition failed for " + testFileName, childAssociationRef); + } + } +} diff --git a/src/test/java/org/alfresco/repo/rendition2/RenditionDefinitionTest.java b/src/test/java/org/alfresco/repo/rendition2/RenditionDefinitionTest.java new file mode 100644 index 0000000000..fa082bb8b3 --- /dev/null +++ b/src/test/java/org/alfresco/repo/rendition2/RenditionDefinitionTest.java @@ -0,0 +1,140 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import junit.framework.TestCase; +import org.alfresco.repo.rendition.RenditionServiceImpl; +import org.alfresco.repo.security.authentication.AuthenticationComponent; +import org.alfresco.repo.thumbnail.ThumbnailDefinition; +import org.alfresco.repo.thumbnail.ThumbnailRenditionConvertor; +import org.alfresco.service.cmr.rendition.RenditionDefinition; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.TransformationOptions; +import org.alfresco.util.ApplicationContextHelper; +import org.springframework.context.ApplicationContext; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringJoiner; + +/** + * Tests that the replacement {@link RenditionDefinition2} generates the same {@link TransformationOptions} as the + * original {@link RenditionDefinition} and that there are the same definitions available. + * + * @deprecated will be removed when the original {@link RenditionService} is removed. + * + * @author adavis + */ +@Deprecated +public class RenditionDefinitionTest extends TestCase +{ + private RenditionServiceImpl renditionService; + private RenditionDefinitionRegistry2 renditionDefinitionRegistry2; + + private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); + + private AuthenticationComponent authenticationComponent; + + @Override + protected void setUp() throws Exception + { + authenticationComponent = (AuthenticationComponent) ctx.getBean("AuthenticationComponent"); + renditionService = (RenditionServiceImpl) ctx.getBean("renditionService"); + renditionDefinitionRegistry2 = (RenditionDefinitionRegistry2) ctx.getBean("renditionDefinitionRegistry2"); + authenticationComponent.setSystemUserAsCurrentUser(); + } + + @Override + protected void tearDown() throws Exception + { + try + { + authenticationComponent.clearCurrentSecurityContext(); + } + catch (Throwable e) + { + e.printStackTrace(); + } + } + + private RenditionDefinition getRenditionDefinition(List renditionDefinitions, String renditionName) + { + for (RenditionDefinition renditionDefinition: renditionDefinitions) + { + String name = renditionDefinition.getRenditionName().getLocalName(); + if (name.equals(renditionName)) + { + return renditionDefinition; + } + } + return null; + } + + public void testGetRenderingEngineDefinition() throws Exception + { + ThumbnailRenditionConvertor converter = new ThumbnailRenditionConvertor(); + List renditionDefinitions = new ArrayList(renditionService.loadRenditionDefinitions()); + Set renditionNames = renditionDefinitionRegistry2.getRenditionNames(); + + for (String renditionName: renditionNames) + { + System.out.println("renditionName="+renditionName); + + RenditionDefinition definition = getRenditionDefinition(renditionDefinitions, renditionName); + assertNotNull("There is no RenditionDefinition for "+renditionName, definition); + renditionDefinitions.remove(definition); + + ThumbnailDefinition thumbnailDefinition = converter.convert(definition); + TransformationOptions transformationOptions = thumbnailDefinition.getTransformationOptions(); + + RenditionDefinition2 definition2 = renditionDefinitionRegistry2.getRenditionDefinition(renditionName); + Map options = definition2.getTransformOptions(); + TransformationOptions transformationOptions2 = LocalTransformClient.getTransformationOptions(renditionName, options); + transformationOptions2.setUse(null); // The use is not set in the original until much later + + // These 2 original thumbnails are wrong, as they don't include the 'limits' and in the + // case of 'pdf' used the wrong TransformationOptions subclass, so don't use them. + if (!renditionName.equals("pdf") && !renditionName.equals("webpreview")) + { + assertEquals("The TransformationOptions used in transforms for " + renditionName + " should be the same", + transformationOptions.toStringAll(), transformationOptions2.toStringAll()); + } + } + + if (!renditionDefinitions.isEmpty()) + { + StringJoiner sj = new StringJoiner(", "); + for (RenditionDefinition renditionDefinition : renditionDefinitions) + { + String name = renditionDefinition.getRenditionName().getLocalName(); + sj.add(name); + } + fail("There is no RenditionDefinition2 for existing RenditionDefinitions "+sj); + } + } +} diff --git a/src/test/java/org/alfresco/repo/rendition2/RenditionService2IntegrationTest.java b/src/test/java/org/alfresco/repo/rendition2/RenditionService2IntegrationTest.java new file mode 100644 index 0000000000..d88603e9d2 --- /dev/null +++ b/src/test/java/org/alfresco/repo/rendition2/RenditionService2IntegrationTest.java @@ -0,0 +1,619 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import java.util.List; +import org.alfresco.model.ContentModel; +import org.alfresco.model.RenditionModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.permissions.AccessDeniedException; +import org.alfresco.service.cmr.rendition.RenditionService; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.PermissionService; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.ResourceUtils; + +import java.io.File; +import java.io.FileNotFoundException; + +import static java.lang.Thread.sleep; +import static org.alfresco.model.ContentModel.PROP_CONTENT; + +/** + * Integration tests for {@link RenditionService2} + */ +public class RenditionService2IntegrationTest extends AbstractRenditionIntegrationTest +{ + @Autowired + private RenditionService2Impl renditionService2; + @Autowired + private TransformClient transformClient; + @Autowired + private PermissionService permissionService; + @Autowired + private RenditionService renditionService; + + private static final String ADMIN = "admin"; + private static final String DOC_LIB = "doclib"; + + @Before + public void setUp() + { + assertTrue("The RenditionService2 needs to be enabled", renditionService2.isEnabled()); + assertTrue("A wrong type of transform client detected", transformClient instanceof LocalTransformClient); + } + + @After + public void cleanUp() + { + AuthenticationUtil.clearCurrentSecurityContext(); + } + + private void checkRendition(String testFileName, String renditionName, boolean expectedToPass) + { + try + { + NodeRef sourceNodeRef = createSource(ADMIN, testFileName); + render(ADMIN, sourceNodeRef, renditionName); + waitForRendition(ADMIN, sourceNodeRef, renditionName); + } + catch(UnsupportedOperationException uoe) + { + if (expectedToPass) + { + fail("The " + renditionName + " rendition should be supported for " + testFileName); + } + } + } + + // Creates a new source node as the given user in its own transaction. + private NodeRef createSource(String user, String testFileName) + { + return AuthenticationUtil.runAs(() -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + createSource(testFileName)), user); + } + + // Creates a new source node as the current user in the current transaction. + private NodeRef createSource(String testFileName) throws FileNotFoundException + { + return createContentNodeFromQuickFile(testFileName); + } + + // Changes the content of a source node as the given user in its own transaction. + private void updateContent(String user, NodeRef sourceNodeRef, String testFileName) + { + AuthenticationUtil.runAs((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + updateContent(sourceNodeRef, testFileName); + return null; + }), user); + } + + // Changes the content of a source node as the current user in the current transaction. + private NodeRef updateContent(NodeRef sourceNodeRef, String testFileName) throws FileNotFoundException + { + File file = ResourceUtils.getFile("classpath:quick/" + testFileName); + nodeService.setProperty(sourceNodeRef, ContentModel.PROP_NAME, testFileName); + + ContentWriter contentWriter = contentService.getWriter(sourceNodeRef, ContentModel.PROP_CONTENT, true); + contentWriter.setMimetype(mimetypeService.guessMimetype(testFileName)); + contentWriter.putContent(file); + + return sourceNodeRef; + } + + // Clears the content of a source node as the given user in its own transaction. + private void clearContent(String user, NodeRef sourceNodeRef) + { + AuthenticationUtil.runAs((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + clearContent(sourceNodeRef); + return null; + }), user); + } + + // Clears the content of a source node as the current user in the current transaction. + private void clearContent(NodeRef sourceNodeRef) + { + nodeService.removeProperty(sourceNodeRef, PROP_CONTENT); + } + + // Requests a new rendition as the given user in its own transaction. + private void render(String user, NodeRef sourceNode, String renditionName) + { + AuthenticationUtil.runAs((AuthenticationUtil.RunAsWork) () -> + transactionService.getRetryingTransactionHelper().doInTransaction(() -> + { + render(sourceNode, renditionName); + return null; + }), user); + } + + // Requests a new rendition as the current user in the current transaction. + private void render(NodeRef sourceNodeRef, String renditionName) + { + renditionService2.render(sourceNodeRef, renditionName); + } + + // As a given user waitForRendition for a rendition to appear. Creates new transactions to do this. + private NodeRef waitForRendition(String user, NodeRef sourceNodeRef, String renditionName) + { + return AuthenticationUtil.runAs(() -> waitForRendition(sourceNodeRef, renditionName), user); + } + + // As the current user waitForRendition for a rendition to appear. Creates new transactions to do this. + private NodeRef waitForRendition(NodeRef sourceNodeRef, String renditionName) throws InterruptedException + { + long maxMillis = 20000; + ChildAssociationRef assoc = null; + for (int i = (int)(maxMillis / 500); i >= 0; i--) + { + // Must create a new transaction in order to see changes that take place after this method started. + assoc = transactionService.getRetryingTransactionHelper().doInTransaction(() -> + renditionService2.getRenditionByName(sourceNodeRef, renditionName), true, true); + if (assoc != null) + { + break; + } + logger.debug("RenditionService2.getRenditionByName(...) sleep "+i); + sleep(500); + } + assertNotNull("Rendition " + renditionName + " failed", assoc); + return assoc.getChildRef(); + } + + // PDF transformation + + @Test + public void testLocalRenderPdfToJpegMedium() + { + checkRendition("quick.pdf", "medium", true); + } + + @Test + public void testLocalRenderPdfToDoclib() + { + checkRendition("quick.pdf", "doclib", true); + } + + @Test + public void testLocalRenderPdfJpegImgpreview() + { + checkRendition("quick.pdf", "imgpreview", true); + } + + @Test + public void testLocalRenderPdfPngAvatar() + { + checkRendition("quick.pdf", "avatar", true); + } + + @Test + public void testLocalRenderPdfPngAvatar32() + { + checkRendition("quick.pdf", "avatar32", true); + } + + @Test + public void testLocalRenderPdfFlashWebpreview() + { + checkRendition("quick.pdf", "webpreview", false); + } + + // DOCX transformation + + @Test + public void testLocalRenderDocxJpegMedium() + { + checkRendition("quick.docx", "medium", true); + } + + @Test + public void testLocalRenderDocxDoclib() + { + checkRendition("quick.docx", "doclib", true); + } + + @Test + public void testLocalRenderDocxJpegImgpreview() + { + checkRendition("quick.docx", "imgpreview", true); + } + + @Test + public void testLocalRenderDocxPngAvatar() + { + checkRendition("quick.docx", "avatar", true); + } + + @Test + public void testLocalRenderDocxPngAvatar32() + { + checkRendition("quick.docx", "avatar32", true); + } + + @Test + public void testLocalRenderDocxFlashWebpreview() + { + checkRendition("quick.docx", "webpreview", false); + } + + @Test + public void testLocalRenderDocxPdf() + { + checkRendition("quick.docx", "pdf", true); + } + + @Test + public void basicRendition() + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + render(ADMIN, sourceNodeRef, DOC_LIB); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + } + + @Test + public void changedSourceToNullContent() + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + render(ADMIN, sourceNodeRef, DOC_LIB); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + + clearContent(ADMIN, sourceNodeRef); + render(ADMIN, sourceNodeRef, DOC_LIB); + ChildAssociationRef assoc = AuthenticationUtil.runAs(() -> + renditionService2.getRenditionByName(sourceNodeRef, DOC_LIB), ADMIN); + assertNull("There should be no rendition as there was no content", assoc); + } + + @Test + public void changedSourceToNonNull() + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + render(ADMIN, sourceNodeRef, DOC_LIB); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + + clearContent(ADMIN, sourceNodeRef); + render(ADMIN, sourceNodeRef, DOC_LIB); + ChildAssociationRef assoc = AuthenticationUtil.runAs(() -> + renditionService2.getRenditionByName(sourceNodeRef, DOC_LIB), ADMIN); + assertNull("There should be no rendition as there was no content", assoc); + + updateContent(ADMIN, sourceNodeRef, "quick.png"); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + } + + @Test + public void testCreateRenditionByUser() + { + String userName = createRandomUser(); + NodeRef sourceNodeRef = createSource(userName, "quick.jpg"); + render(userName, sourceNodeRef, DOC_LIB); + NodeRef renditionNodeRef = waitForRendition(userName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition was not generated for non-admin user", renditionNodeRef); + } + + @Test + public void testReadRenditionByOtherUser() + { + String ownerUserName = createRandomUser(); + NodeRef sourceNodeRef = createSource(ownerUserName, "quick.jpg"); + String otherUserName = createRandomUser(); + permissionService.setPermission(sourceNodeRef, otherUserName, PermissionService.READ, true); + render(ownerUserName, sourceNodeRef, DOC_LIB); + NodeRef renditionNodeRef = waitForRendition(ownerUserName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition is not visible for owner of source node", renditionNodeRef); + renditionNodeRef = waitForRendition(otherUserName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition is not visible for non-owner user with read permissions", renditionNodeRef); + assertEquals("The creator of the rendition is not correct", + ownerUserName, nodeService.getProperty(sourceNodeRef, ContentModel.PROP_CREATOR)); + } + + @Test + public void testRenderByReader() + { + String ownerUserName = createRandomUser(); + NodeRef sourceNodeRef = createSource(ownerUserName, "quick.jpg"); + String otherUserName = createRandomUser(); + permissionService.setPermission(sourceNodeRef, otherUserName, PermissionService.READ, true); + render(otherUserName, sourceNodeRef, DOC_LIB); + NodeRef renditionNodeRef = waitForRendition(ownerUserName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition is not visible for owner of source node", renditionNodeRef); + renditionNodeRef = waitForRendition(otherUserName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition is not visible for owner of rendition node", renditionNodeRef); + assertEquals("The creator of the rendition is not correct", + ownerUserName, nodeService.getProperty(sourceNodeRef, ContentModel.PROP_CREATOR)); + } + + @Test + public void testAccessWithNoPermissions() + { + String ownerUserName = createRandomUser(); + NodeRef sourceNodeRef = createSource(ownerUserName, "quick.jpg"); + render(ownerUserName, sourceNodeRef, DOC_LIB); + String noPermissionsUser = createRandomUser(); + permissionService.setPermission(sourceNodeRef, noPermissionsUser, PermissionService.ALL_PERMISSIONS, false); + try + { + waitForRendition(noPermissionsUser, sourceNodeRef, DOC_LIB); + fail("The rendition should not be visible for user with no permissions"); + } + catch (AccessDeniedException ade) + { + // expected + } + } + + @Test + public void testUpgradeRenditionService() throws InterruptedException + { + String ownerUserName = createRandomUser(); + NodeRef sourceNodeRef = createSource(ownerUserName, "quick.jpg"); + final QName doclibRendDefQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); + transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + renditionService.render(sourceNodeRef, doclibRendDefQName), ownerUserName)); + + NodeRef oldRendition = AuthenticationUtil.runAs(() -> + renditionService.getRenditionByName(sourceNodeRef, doclibRendDefQName).getChildRef(), ownerUserName); + assertFalse("The rendition should be generated by old Rendition Service", + AuthenticationUtil.runAs(() -> nodeService.hasAspect(oldRendition, RenditionModel.ASPECT_RENDITION2), ownerUserName)); + + updateContent(ownerUserName, sourceNodeRef, "quick.png"); + NodeRef newRendition = waitForRendition(ownerUserName, sourceNodeRef, DOC_LIB); + assertNotNull("The rendition should be reported via RenditionService2", newRendition); + Thread.sleep(200); + boolean hasRenditionedAspect = false; + for (int i = 0; i < 5; i++) + { + hasRenditionedAspect = AuthenticationUtil.runAs(() -> nodeService.hasAspect(newRendition, RenditionModel.ASPECT_RENDITION2), ownerUserName); + if (hasRenditionedAspect) + { + break; + } + else + { + Thread.sleep(500); + } + } + assertTrue("The rendition should be generated by new Rendition Service", hasRenditionedAspect); + } + + /** + * @deprecated can be removed when we remove the original RenditionService + */ + @Deprecated + @Test + public void testUseOldService() throws InterruptedException + { + renditionService2.setEnabled(false); + try + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + final QName doclibRendDefQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); + transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + renditionService.render(sourceNodeRef, doclibRendDefQName), ADMIN)); + assertNotNull("The old renditions service did not render", waitForRendition(ADMIN, sourceNodeRef, DOC_LIB)); + List lastThumbnailModification = transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + (List) nodeService.getProperty(sourceNodeRef, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA), ADMIN)); + updateContent(ADMIN, sourceNodeRef, "quick.png"); + List newThumbnailModification = null; + for (int i = 0; i < 5; i++) + { + newThumbnailModification = transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + (List) nodeService.getProperty(sourceNodeRef, ContentModel.PROP_LAST_THUMBNAIL_MODIFICATION_DATA), ADMIN)); + if (!newThumbnailModification.equals(lastThumbnailModification)) + { + break; + } + else + { + Thread.sleep(500); + } + } + assertFalse("The old rendition service did not update the rendition.", newThumbnailModification.equals(lastThumbnailModification)); + NodeRef renditionNodeRef = AuthenticationUtil.runAs(() -> renditionService.getRenditionByName(sourceNodeRef, doclibRendDefQName).getChildRef(), ADMIN); + assertFalse("The rendition should be rendered by the old rendition service", + AuthenticationUtil.runAs(() -> nodeService.hasAspect(renditionNodeRef, RenditionModel.ASPECT_RENDITION2), ADMIN)); + } + finally + { + renditionService2.setEnabled(true); + } + } + + /** + * @deprecated can be removed when we remove the original RenditionService + */ + @Deprecated + @Test + public void testSwitchBackToOldService() throws InterruptedException + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + render(ADMIN, sourceNodeRef, DOC_LIB); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + + renditionService2.setEnabled(false); + try + { + updateContent(ADMIN, sourceNodeRef, "quick.png"); + Thread.sleep(200); + NodeRef renditionNodeRef = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + boolean hasRendition2Aspect = true; + for (int i = 0; i < 5; i++) + { + hasRendition2Aspect = AuthenticationUtil.runAs(() -> nodeService.hasAspect(renditionNodeRef, RenditionModel.ASPECT_RENDITION2), ADMIN); + if (!hasRendition2Aspect) + { + break; + } + else + { + Thread.sleep(500); + } + } + assertFalse("Should have switched to the old rendition service", hasRendition2Aspect); + } + finally + { + renditionService2.setEnabled(true); + } + } + + /** + * @deprecated can be removed when we remove the original RenditionService + */ + @Deprecated + @Test + public void testSwitchToNewServiceViaContentUpdate() + { + renditionService2.setEnabled(false); + try + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + final QName doclibRendDefQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); + transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + renditionService.render(sourceNodeRef, doclibRendDefQName), ADMIN)); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + + renditionService2.setEnabled(true); + + updateContent(ADMIN, sourceNodeRef, "quick.png"); + NodeRef renditionNodeRef = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + boolean hasAspect = nodeService.hasAspect(renditionNodeRef, RenditionModel.ASPECT_RENDITION2); + assertFalse("Should have switched to the old rendition service", hasAspect); + } + finally + { + renditionService2.setEnabled(true); + } + } + + /** + * @deprecated can be removed when we remove the original RenditionService + */ + @Deprecated + @Test + public void testDowngradeRenditionService() throws InterruptedException + { + String ownerUserName = createRandomUser(); + NodeRef sourceNodeRef = createSource(ownerUserName, "quick.jpg"); + render(ownerUserName, sourceNodeRef, DOC_LIB); + NodeRef newRendition = waitForRendition(ownerUserName, sourceNodeRef, DOC_LIB); + boolean hasRendition2Aspect = AuthenticationUtil.runAs(() -> nodeService.hasAspect(newRendition, RenditionModel.ASPECT_RENDITION2), ownerUserName); + assertTrue("The source should have the old renditioned aspect", + AuthenticationUtil.runAs(() -> nodeService.hasAspect(sourceNodeRef, RenditionModel.ASPECT_RENDITIONED), ownerUserName)); + assertTrue("The rendition2 aspect should be present", hasRendition2Aspect); + try + { + renditionService2.setEnabled(false); + updateContent(ownerUserName, sourceNodeRef, "quick.png"); + NodeRef oldRendition = waitForRendition(ownerUserName, sourceNodeRef, DOC_LIB); + Thread.sleep(200); + hasRendition2Aspect = false; + for (int i = 0; i < 5; i++) + { + hasRendition2Aspect = AuthenticationUtil.runAs(() -> nodeService.hasAspect(oldRendition, RenditionModel.ASPECT_RENDITION2), ownerUserName); + if (!hasRendition2Aspect) + { + break; + } + else + { + Thread.sleep(500); + } + } + assertFalse("The rendition should be generated by old Rendition Service", hasRendition2Aspect); + } + finally + { + renditionService2.setEnabled(true); + } + } + + /** + * @deprecated can be removed when we remove the original RenditionService + */ + @Deprecated + @Test + public void testUpgradeRenditionViaRender() throws InterruptedException + { + renditionService2.setEnabled(false); + try + { + NodeRef sourceNodeRef = createSource(ADMIN, "quick.jpg"); + final QName doclibRendDefQName = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "doclib"); + transactionService.getRetryingTransactionHelper() + .doInTransaction(() -> + AuthenticationUtil.runAs(() -> + renditionService.render(sourceNodeRef, doclibRendDefQName), ADMIN)); + waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + + renditionService2.setEnabled(true); + render(ADMIN, sourceNodeRef, DOC_LIB); + Thread.sleep(200); + NodeRef renditionNodeRef = waitForRendition(ADMIN, sourceNodeRef, DOC_LIB); + boolean hasRendition2Aspect = false; + for (int i = 0; i < 5; i++) + { + hasRendition2Aspect = AuthenticationUtil.runAs(() -> nodeService.hasAspect(renditionNodeRef, RenditionModel.ASPECT_RENDITION2), ADMIN); + if (hasRendition2Aspect) + { + break; + } + else + { + Thread.sleep(500); + } + } + + assertTrue("Should have switched to the new rendition service", hasRendition2Aspect); + } + finally + { + renditionService2.setEnabled(true); + } + } +} \ No newline at end of file diff --git a/src/test/java/org/alfresco/repo/rendition2/RenditionService2Test.java b/src/test/java/org/alfresco/repo/rendition2/RenditionService2Test.java new file mode 100644 index 0000000000..cd67fae84f --- /dev/null +++ b/src/test/java/org/alfresco/repo/rendition2/RenditionService2Test.java @@ -0,0 +1,177 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2018 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.repo.rendition2; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.policy.BehaviourFilter; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.repo.rendition.RenditionPreventionRegistry; +import org.alfresco.repo.transaction.RetryingTransactionHelper; +import org.alfresco.repo.util.PostTxnCallbackScheduler; +import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.rule.RuleService; +import org.alfresco.service.namespace.QName; +import org.alfresco.service.transaction.TransactionService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.anyLong; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +/** + * Tests the RenditionService2 in a Community context where we only have local transformers. + * + * Also see EnterpriseRenditionService2Test. + * + * @author adavis + */ +@RunWith(MockitoJUnitRunner.class) +public class RenditionService2Test +{ + private RenditionService2Impl renditionService2; + private RenditionDefinitionRegistry2Impl renditionDefinitionRegistry2; + + @Mock private TransformClient transformClient; + @Mock private TransactionService transactionService; + @Mock private NodeService nodeService; + @Mock private ContentService contentService; + @Mock private RenditionPreventionRegistry renditionPreventionRegistry; + @Mock private ContentData contentData; + @Mock private PolicyComponent policyComponent; + @Mock private BehaviourFilter behaviourFilter; + @Mock private RuleService ruleService; + + private NodeRef nodeRef = new NodeRef("workspace://spacesStore/test-id"); + private static final String IMGPREVIEW = "imgpreview"; + private static final String JPEG = "image/jpeg"; + private String contentUrl = "test-content-url"; + + @Before + public void setup() throws Exception + { + renditionService2 = new RenditionService2Impl(); + renditionDefinitionRegistry2 = new RenditionDefinitionRegistry2Impl(); + + Map options = new HashMap<>(); + options.put("width", "960"); + options.put("height", "1024"); + new RenditionDefinition2Impl(IMGPREVIEW, JPEG, options, renditionDefinitionRegistry2); + + when(nodeService.exists(nodeRef)).thenReturn(true); + when(nodeService.getProperty(nodeRef, ContentModel.PROP_CONTENT)).thenReturn(contentData); + when(nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED)).thenReturn(new Date()); + when(contentData.getContentUrl()).thenReturn(contentUrl); + + renditionService2.setTransactionService(transactionService); + renditionService2.setNodeService(nodeService); + renditionService2.setContentService(contentService); + renditionService2.setRenditionPreventionRegistry(renditionPreventionRegistry); + renditionService2.setRenditionDefinitionRegistry2(renditionDefinitionRegistry2); + renditionService2.setTransformClient(transformClient); + renditionService2.setPolicyComponent(policyComponent); + renditionService2.setBehaviourFilter(behaviourFilter); + renditionService2.setRuleService(ruleService); + renditionService2.setTransactionService(transactionService); + renditionService2.setEnabled(true); + renditionService2.setThumbnailsEnabled(true); + renditionService2.setRenditionRequestSheduler(new RenditionRequestSchedulerMock()); + renditionService2.afterPropertiesSet(); + } + + private class RenditionRequestSchedulerMock extends PostTxnCallbackScheduler + { + @Override + public void scheduleRendition(RetryingTransactionHelper.RetryingTransactionCallback callback, String uniqueId) + { + try + { + callback.execute(); + } + catch (Throwable throwable) + { + fail("The rendition callback failed: " + throwable); + } + } + } + + @Test(expected = RenditionService2Exception.class) + public void disabled() + { + renditionService2.setEnabled(false); + renditionService2.render(nodeRef, IMGPREVIEW); + } + + @Test(expected = RenditionService2Exception.class) + public void thumbnailsDisabled() + { + renditionService2.setThumbnailsEnabled(false); + renditionService2.render(nodeRef, IMGPREVIEW); + } + + @Test + public void useLocalTransform() + { + renditionService2.render(nodeRef, IMGPREVIEW); + verify(transformClient, times(1)).transform(any(), any(), anyString(), anyInt()); + } + + @Test(expected = UnsupportedOperationException.class) + public void noTransform() + { + doThrow(UnsupportedOperationException.class).when(transformClient).checkSupported(any(), any(), any(), anyLong(), any()); + renditionService2.render(nodeRef, IMGPREVIEW); + } + + @Test(expected = RenditionService2PreventedException.class) + public void checkSourceNodeForPreventionClass() + { + when(renditionPreventionRegistry.isContentClassRegistered((QName)any())).thenReturn(true); + renditionService2.render(nodeRef, IMGPREVIEW); + } + + @Test(expected = IllegalArgumentException.class) + public void noDefinition() + { + renditionService2.render(nodeRef, "doesNotExist"); + } +} diff --git a/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplParameterTest.java b/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplParameterTest.java index 07983b44a4..75925b03d1 100644 --- a/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplParameterTest.java +++ b/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplParameterTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.repo.thumbnail; @@ -71,7 +71,10 @@ import org.mockito.ArgumentCaptor; * Thumbnail service implementation unit test * * @author Neil McErlean + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class ThumbnailServiceImplParameterTest { // Mocked services. diff --git a/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplTest.java b/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplTest.java index c17c9152a6..ca2e5634a9 100644 --- a/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplTest.java +++ b/src/test/java/org/alfresco/repo/thumbnail/ThumbnailServiceImplTest.java @@ -111,7 +111,10 @@ import org.springframework.transaction.annotation.Transactional; * * @author Roy Wetherall * @author Neil McErlean + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @Category(OwnJVMTestsCategory.class) @Transactional @ContextConfiguration({"classpath:alfresco/application-context.xml", diff --git a/src/test/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluatorTest.java b/src/test/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluatorTest.java index 1c4c18977f..a008d7b923 100644 --- a/src/test/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluatorTest.java +++ b/src/test/java/org/alfresco/repo/thumbnail/conditions/NodeEligibleForRethumbnailingEvaluatorTest.java @@ -54,7 +54,10 @@ import org.springframework.transaction.annotation.Transactional; * * @author Neil Mc Erlean * @since 3.5.0 + * + * @deprecated The thumbnails code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated @Category(OwnJVMTestsCategory.class) @Transactional public class NodeEligibleForRethumbnailingEvaluatorTest extends BaseSpringTest diff --git a/src/test/java/org/alfresco/repo/version/ContentServiceImplTest.java b/src/test/java/org/alfresco/repo/version/ContentServiceImplTest.java index 531293efb0..6981801fba 100644 --- a/src/test/java/org/alfresco/repo/version/ContentServiceImplTest.java +++ b/src/test/java/org/alfresco/repo/version/ContentServiceImplTest.java @@ -107,6 +107,7 @@ public class ContentServiceImplTest extends BaseVersionStoreTest } @Test + @Deprecated public void testTransformAndNulls() { NodeRef versionableNode = createNewVersionableNode(); diff --git a/src/test/java/org/alfresco/service/cmr/repository/TemporalSourceOptionsTest.java b/src/test/java/org/alfresco/service/cmr/repository/TemporalSourceOptionsTest.java index 3e6642fed3..c38bcde2d7 100644 --- a/src/test/java/org/alfresco/service/cmr/repository/TemporalSourceOptionsTest.java +++ b/src/test/java/org/alfresco/service/cmr/repository/TemporalSourceOptionsTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; import static org.junit.Assert.*; @@ -35,7 +35,10 @@ import org.junit.Test; * Test {@link TemporalSourceOptions}. * * @author Ray Gauss II + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TemporalSourceOptionsTest { private TemporalSourceOptions temporalSourceOptions; diff --git a/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsTest.java b/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsTest.java index e2c59bde5a..3ff73191de 100644 --- a/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsTest.java +++ b/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionLimitsTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; @@ -36,7 +36,10 @@ import org.junit.Test; /** * Test TransformationOptionLimits + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformationOptionLimitsTest { private TransformationOptionLimits limits; diff --git a/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionPairTest.java b/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionPairTest.java index 3855336345..75cb2667a5 100644 --- a/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionPairTest.java +++ b/src/test/java/org/alfresco/service/cmr/repository/TransformationOptionPairTest.java @@ -1,28 +1,28 @@ -/* - * #%L - * Alfresco Repository - * %% - * Copyright (C) 2005 - 2016 Alfresco Software Limited - * %% - * This file is part of the Alfresco software. - * If the software was purchased under a paid Alfresco license, the terms of - * the paid license agreement will prevail. Otherwise, the software is - * provided under the following open source license terms: - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - * #L% - */ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2016 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ package org.alfresco.service.cmr.repository; @@ -37,7 +37,10 @@ import static org.junit.Assert.assertEquals; /** * Test TransformationOptionPair + * + * @deprecated The transformations code is being moved out of the codebase and replaced by the new async RenditionService2 or other external libraries. */ +@Deprecated public class TransformationOptionPairTest { TransformationOptionPair pair; diff --git a/src/test/resources/alfresco/extension/model/testContentModel.xml b/src/test/resources/alfresco/extension/model/testContentModel.xml index d82ee296eb..0b71dd35f7 100644 --- a/src/test/resources/alfresco/extension/model/testContentModel.xml +++ b/src/test/resources/alfresco/extension/model/testContentModel.xml @@ -1322,6 +1322,16 @@ Rendition + + + Rendition2 + + + Source Modified Date + d:int + + + Hidden Rendition