Compare commits

...

4 Commits

Author SHA1 Message Date
Travis CI User
357ac27552 [maven-release-plugin][skip ci] prepare release 14.118.1 2022-03-01 13:13:47 +00:00
alandavis
656aaa230b Switch to 14.118.1-SNAPSHOT for this branch
[skip tests][no downstream]
2022-03-01 13:03:25 +00:00
alandavis
171fe54eb9 Using attachment = true after talking with Sara, as it can be used for all types.
* Made addDirectAccessUrlToOptionsIfPossible identical in both Local*TransformClients
2022-03-01 10:51:45 +00:00
alandavis
057cfb55a2 ACS-2493/ACS-2494 Repo Transform requests using a DAU
* First cut at code using directAccessUrl in transform options.
* Using t-model 1.4.11, which includes this option in the t-config if supported
2022-03-01 07:17:08 +00:00
30 changed files with 109 additions and 30 deletions

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-automation-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-parent</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-governance-services-community-repo-parent</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<build>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -8,7 +8,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-amps</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<dependencies>

View File

@@ -9,6 +9,6 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
</project>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<properties>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<modules>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<developers>

View File

@@ -9,7 +9,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-tests</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<developers>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo-packaging</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<properties>

View File

@@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
<packaging>pom</packaging>
<name>Alfresco Community Repo Parent</name>
@@ -146,7 +146,7 @@
<connection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</connection>
<developerConnection>scm:git:https://github.com/Alfresco/alfresco-community-repo.git</developerConnection>
<url>https://github.com/Alfresco/alfresco-community-repo</url>
<tag>HEAD</tag>
<tag>14.118.1</tag>
</scm>
<distributionManagement>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<dependencies>

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.alfresco</groupId>
<artifactId>alfresco-community-repo</artifactId>
<version>14.118-SNAPSHOT</version>
<version>14.118.1</version>
</parent>
<dependencies>

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019 Alfresco Software Limited
* Copyright (C) 2019-2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -39,6 +39,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
/**
* Transformer that passes a document through a pipeline of transformations to arrive at an target mimetype.
*
@@ -118,6 +120,8 @@ public class LocalPipelineTransform extends AbstractLocalTransform
transformer.intermediateTransformer.transform(currentReader, currentWriter, transformOptions, renditionName, sourceNodeRef);
removeDirectAccessUrlAfterFirstTransform(transformOptions);
// Clear the sourceNodeRef after the first transformation to avoid later transformers thinking the
// intermediate file is the original node.
if (i == 0)
@@ -132,4 +136,9 @@ public class LocalPipelineTransform extends AbstractLocalTransform
}
}
}
private void removeDirectAccessUrlAfterFirstTransform(Map<String, String> transformOptions)
{
transformOptions.remove(DIRECT_ACCESS_URL);
}
}

View File

@@ -483,7 +483,7 @@ public class LocalTransformServiceRegistry extends TransformServiceRegistryImpl
* @param transform the local transform.
* @return {@code true} is supported, {@code false} otherwise.
*/
boolean isSupported(CoreFunction function, LocalTransform transform)
public boolean isSupported(CoreFunction function, LocalTransform transform)
{
return isSupported(function, transform.getName());
}

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2021 Alfresco Software Limited
* Copyright (C) 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -29,15 +29,22 @@ import org.alfresco.repo.content.transform.LocalTransform;
import org.alfresco.repo.content.transform.LocalTransformServiceRegistry;
import org.alfresco.repo.content.transform.UnsupportedTransformationException;
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.DirectAccessUrl;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.transform.client.model.config.CoreFunction;
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.util.HashMap;
import java.util.Map;
import static org.alfresco.model.ContentModel.PROP_CONTENT;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
/**
* Request synchronous transforms.
*
@@ -51,16 +58,30 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
private static Log logger = LogFactory.getLog(LocalTransformClient.class);
private LocalTransformServiceRegistry localTransformServiceRegistry;
private ContentService contentService;
private boolean directAccessUrlEnabled;
public void setLocalTransformServiceRegistry(LocalTransformServiceRegistry localTransformServiceRegistry)
{
this.localTransformServiceRegistry = localTransformServiceRegistry;
}
public void setContentService(ContentService contentService)
{
this.contentService = contentService;
}
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
{
this.directAccessUrlEnabled = directAccessUrlEnabled;
}
@Override
public void afterPropertiesSet() throws Exception
{
PropertyCheck.mandatory(this, "localTransformServiceRegistry", localTransformServiceRegistry);
PropertyCheck.mandatory(this, "contentService", contentService);
PropertyCheck.mandatory(this, "transformDirectAccessUrlEnabled", directAccessUrlEnabled);
}
@Override
@@ -123,6 +144,7 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
logger.debug(TRANSFORM + "requested " + renditionName);
}
actualOptions = addDirectAccessUrlToOptionsIfPossible(actualOptions, sourceNodeRef, transform);
transform.transform(reader, writer, actualOptions, renditionName, sourceNodeRef);
if (logger.isDebugEnabled())
@@ -140,6 +162,20 @@ public class LocalSynchronousTransformClient implements SynchronousTransformClie
}
}
private Map<String, String> addDirectAccessUrlToOptionsIfPossible(Map<String, String> actualOptions,
NodeRef sourceNodeRef, LocalTransform transform)
{
if (directAccessUrlEnabled &&
localTransformServiceRegistry.isSupported(CoreFunction.DIRECT_ACCESS_URL, transform) &&
contentService.isContentDirectUrlEnabled(sourceNodeRef, PROP_CONTENT))
{
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(sourceNodeRef, PROP_CONTENT, true);
actualOptions = new HashMap<>(actualOptions);
actualOptions.put(DIRECT_ACCESS_URL, directAccessUrl.getContentUrl());
}
return actualOptions;
}
@Override
public String getName()
{

View File

@@ -2,7 +2,7 @@
* #%L
* Alfresco Repository
* %%
* Copyright (C) 2019 Alfresco Software Limited
* Copyright (C) 2022 Alfresco Software Limited
* %%
* This file is part of the Alfresco software.
* If the software was purchased under a paid Alfresco license, the terms of
@@ -32,18 +32,24 @@ 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.DirectAccessUrl;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.transform.client.model.config.CoreFunction;
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.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static org.alfresco.model.ContentModel.PROP_CONTENT;
import static org.alfresco.transform.client.util.RequestParamMap.DIRECT_ACCESS_URL;
/**
* Requests rendition transforms take place using transforms available on the local machine (based on
* {@link LocalTransform}. The transform and consumption of the
@@ -61,6 +67,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
private TransactionService transactionService;
private ContentService contentService;
private RenditionService2Impl renditionService2;
private boolean directAccessUrlEnabled;
private ExecutorService executorService;
private ThreadLocal<LocalTransform> transform = new ThreadLocal<>();
@@ -85,6 +92,11 @@ public class LocalTransformClient implements TransformClient, InitializingBean
this.renditionService2 = renditionService2;
}
public void setDirectAccessUrlEnabled(boolean directAccessUrlEnabled)
{
this.directAccessUrlEnabled = directAccessUrlEnabled;
}
public void setExecutorService(ExecutorService executorService)
{
this.executorService = executorService;
@@ -97,6 +109,7 @@ public class LocalTransformClient implements TransformClient, InitializingBean
PropertyCheck.mandatory(this, "transactionService", transactionService);
PropertyCheck.mandatory(this, "contentService", contentService);
PropertyCheck.mandatory(this, "renditionService2", renditionService2);
PropertyCheck.mandatory(this, "directAccessUrlEnabled", directAccessUrlEnabled);
if (executorService == null)
{
executorService = Executors.newCachedThreadPool();
@@ -130,8 +143,9 @@ public class LocalTransformClient implements TransformClient, InitializingBean
{
String renditionName = renditionDefinition.getRenditionName();
String targetMimetype = renditionDefinition.getTargetMimetype();
Map<String, String> actualOptions = renditionDefinition.getTransformOptions();
Map<String, String> renditionOptions = renditionDefinition.getTransformOptions();
LocalTransform localTransform = transform.get();
Map<String, String> actualOptions = addDirectAccessUrlToOptionsIfPossible(renditionOptions, sourceNodeRef, localTransform);
executorService.submit(() ->
{
@@ -187,4 +201,18 @@ public class LocalTransformClient implements TransformClient, InitializingBean
}), user);
});
}
private Map<String, String> addDirectAccessUrlToOptionsIfPossible(Map<String, String> actualOptions,
NodeRef sourceNodeRef, LocalTransform transform)
{
if (directAccessUrlEnabled &&
localTransformServiceRegistry.isSupported(CoreFunction.DIRECT_ACCESS_URL, transform) &&
contentService.isContentDirectUrlEnabled(sourceNodeRef, PROP_CONTENT))
{
DirectAccessUrl directAccessUrl = contentService.requestContentDirectUrl(sourceNodeRef, PROP_CONTENT, true);
actualOptions = new HashMap<>(actualOptions);
actualOptions.put(DIRECT_ACCESS_URL, directAccessUrl.getContentUrl());
}
return actualOptions;
}
}

View File

@@ -81,12 +81,15 @@
<property name="transactionService" ref="transactionService" />
<property name="contentService" ref="contentService" />
<property name="renditionService2" ref="renditionService2" />
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
</bean>
<bean id="synchronousTransformClient" parent="localSynchronousTransformClient" />
<bean id="localSynchronousTransformClient" class="org.alfresco.repo.rendition2.LocalSynchronousTransformClient">
<property name="localTransformServiceRegistry" ref="localTransformServiceRegistry" />
<property name="contentService" ref="contentService" />
<property name="directAccessUrlEnabled" value="${local.transform.directAccessUrl.enabled}"/>
</bean>
<!-- Deprecated bean that converts transform properties to the deprecated TransformationOptions format -->

View File

@@ -1313,6 +1313,9 @@ restApi.directAccessUrl.enabled=false
# Direct Access Url REST API calls cannot request an explicit expiry time.
restApi.directAccessUrl.defaultExpiryTimeInSec=30
# Controls whether direct access url URLs may be used in transforms.
local.transform.directAccessUrl.enabled=true
# Creates additional indexes on alf_node and alf_transaction. Recommended for large repositories.
system.new-node-transaction-indexes.ignored=true