diff --git a/CHANGELOG.md b/CHANGELOG.md
index de75fb7d0e..73df46db75 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com)
-
## Unreleased ([details][unreleased changes details])
+- #3426 - Content Sync: view history of completed jobs
+
+### Changed
+
+- #3420 - Redirect Map Manager - enable Redirect Map Manager in AEM CS (would require a specific - not public yet - AEM CS release version, TBA)
+- #3423 - Redirect Manager - status code is not retaining its value in the dialog after authoring
## 6.6.4 - 2024-08-14
- #3417 - Configurable recursion in Content Sync
diff --git a/all/pom.xml b/all/pom.xml
index f64f842662..34cc5532e1 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/bundle-cloud/pom.xml b/bundle-cloud/pom.xml
index bd89af91fb..6d0ae138ca 100644
--- a/bundle-cloud/pom.xml
+++ b/bundle-cloud/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/bundle-onprem/pom.xml b/bundle-onprem/pom.xml
index c542483d9f..6f7c26f43a 100644
--- a/bundle-onprem/pom.xml
+++ b/bundle-onprem/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/bundle/pom.xml b/bundle/pom.xml
index b9791dfbe2..6fb278bf25 100644
--- a/bundle/pom.xml
+++ b/bundle/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/bundle/src/main/java/com/adobe/acs/commons/contentsync/ConfigurationUtils.java b/bundle/src/main/java/com/adobe/acs/commons/contentsync/ConfigurationUtils.java
index 7ca4fe229a..ec83f0c4f4 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/contentsync/ConfigurationUtils.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/contentsync/ConfigurationUtils.java
@@ -20,13 +20,17 @@
package com.adobe.acs.commons.contentsync;
import com.adobe.acs.commons.contentsync.impl.LastModifiedStrategy;
+import org.apache.jackrabbit.JcrConstants;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceUtil;
+import java.io.ByteArrayInputStream;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.UUID;
import static com.adobe.acs.commons.contentsync.RemoteInstance.CONNECT_TIMEOUT;
import static com.adobe.acs.commons.contentsync.RemoteInstance.SOCKET_TIMEOUT;
@@ -64,4 +68,34 @@ public static Resource getHostsResource(ResourceResolver resourceResolver) throw
resourceProperties.put(JCR_PRIMARYTYPE, NT_UNSTRUCTURED);
return ResourceUtil.getOrCreateResource(resourceResolver, HOSTS_PATH, resourceProperties, NT_SLING_FOLDER, true);
}
+
+ public static void persistAuditLog(ResourceResolver resourceResolver, String path, long count, String data) throws PersistenceException {
+
+ String auditHome = CONFIG_PATH + "/audit";
+ ResourceUtil.getOrCreateResource(resourceResolver, auditHome,
+ Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED), JcrConstants.NT_FOLDER, false);
+
+ Map auditProps = new HashMap<>();
+ auditProps.put(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_UNSTRUCTURED);
+ auditProps.put("syncPath", path);
+ auditProps.put(JcrConstants.JCR_MIXINTYPES, "mix:created");
+ auditProps.put("count", count);
+ String auditResourcePath = auditHome + "/" + UUID.randomUUID();
+ ResourceUtil.getOrCreateResource(resourceResolver, auditResourcePath, auditProps, null, false);
+
+ String auditLogPath = auditResourcePath + "/log";
+ ResourceUtil.getOrCreateResource(resourceResolver, auditLogPath,
+ Collections.singletonMap(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_FILE), null, false);
+
+ Map props = new HashMap<>();
+ props.put(JcrConstants.JCR_PRIMARYTYPE, JcrConstants.NT_RESOURCE);
+ props.put(JcrConstants.JCR_MIMETYPE, "text/plain");
+
+ props.put(JcrConstants.JCR_DATA, new ByteArrayInputStream(data.getBytes()));
+
+ ResourceUtil.getOrCreateResource(resourceResolver, auditLogPath + "/" + JcrConstants.JCR_CONTENT,
+ props, null, false);
+
+ resourceResolver.commit();
+ }
}
diff --git a/bundle/src/main/java/com/adobe/acs/commons/contentsync/package-info.java b/bundle/src/main/java/com/adobe/acs/commons/contentsync/package-info.java
index f00aea48c6..7350e1cc41 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/contentsync/package-info.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/contentsync/package-info.java
@@ -17,5 +17,5 @@
* limitations under the License.
* #L%
*/
-@org.osgi.annotation.versioning.Version("1.1.0")
+@org.osgi.annotation.versioning.Version("1.2.0")
package com.adobe.acs.commons.contentsync;
diff --git a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/AddEntryServlet.java b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/AddEntryServlet.java
index aa8decc1e4..dc02a4326d 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/AddEntryServlet.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/AddEntryServlet.java
@@ -22,7 +22,6 @@
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -30,8 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.adobe.acs.commons.util.RequireAem;
-
/**
* Servlet for adding a line into the redirect map text file
*/
@@ -43,10 +40,6 @@ public class AddEntryServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = -1704915461516132101L;
private static final Logger log = LoggerFactory.getLogger(AddEntryServlet.class);
- // Disable this feature on AEM as a Cloud Service
- @Reference(target="(distribution=classic)")
- transient RequireAem requireAem;
-
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
diff --git a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectEntriesServlet.java b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectEntriesServlet.java
index e7128fab44..95229c4eaa 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectEntriesServlet.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectEntriesServlet.java
@@ -21,7 +21,6 @@
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -29,8 +28,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.adobe.acs.commons.util.RequireAem;
-
/**
* Servlet rendering the redirect map to a JSON Array
*/
@@ -38,10 +35,6 @@
"redirectentries" }, extensions = { "json" }, metatype = false)
public class RedirectEntriesServlet extends SlingSafeMethodsServlet {
- // Disable this feature on AEM as a Cloud Service
- @Reference(target="(distribution=classic)")
- transient RequireAem requireAem;
-
private static final long serialVersionUID = -2825679173210628699L;
private static final Logger log = LoggerFactory.getLogger(RedirectEntriesServlet.class);
diff --git a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectMapServlet.java b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectMapServlet.java
index ddb4255aa0..5c8709e649 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectMapServlet.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RedirectMapServlet.java
@@ -22,7 +22,6 @@
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -31,7 +30,6 @@
import org.slf4j.LoggerFactory;
import com.adobe.acs.commons.redirectmaps.models.RedirectMapModel;
-import com.adobe.acs.commons.util.RequireAem;
import com.google.common.net.MediaType;
/**
@@ -45,10 +43,6 @@ public class RedirectMapServlet extends SlingSafeMethodsServlet {
private static final Logger log = LoggerFactory.getLogger(RedirectMapServlet.class);
private static final long serialVersionUID = -3564475196678277711L;
- // Disable this feature on AEM as a Cloud Service
- @Reference(target="(distribution=classic)")
- transient RequireAem requireAem;
-
@Override
protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
diff --git a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RemoveEntryServlet.java b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RemoveEntryServlet.java
index eda76454bf..29e61e71ab 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RemoveEntryServlet.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/RemoveEntryServlet.java
@@ -22,7 +22,6 @@
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -30,8 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.adobe.acs.commons.util.RequireAem;
-
/**
* Servlet for removing a line from the redirect map text file
*/
@@ -43,10 +40,6 @@ public class RemoveEntryServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = -5963945855717054678L;
private static final Logger log = LoggerFactory.getLogger(RemoveEntryServlet.class);
- // Disable this feature on AEM as a Cloud Service
- @Reference(target="(distribution=classic)")
- transient RequireAem requireAem;
-
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
diff --git a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/UpdateEntryServlet.java b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/UpdateEntryServlet.java
index bc0b124a44..b21790ed92 100644
--- a/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/UpdateEntryServlet.java
+++ b/bundle/src/main/java/com/adobe/acs/commons/redirectmaps/impl/UpdateEntryServlet.java
@@ -22,7 +22,6 @@
import javax.servlet.ServletException;
-import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.sling.SlingServlet;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
@@ -30,8 +29,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.adobe.acs.commons.util.RequireAem;
-
/**
* Servlet for updating a line in the redirect map text file
*/
@@ -43,10 +40,6 @@ public class UpdateEntryServlet extends SlingAllMethodsServlet {
private static final long serialVersionUID = -1704915461516132101L;
private static final Logger log = LoggerFactory.getLogger(UpdateEntryServlet.class);
- // Disable this feature on AEM as a Cloud Service
- @Reference(target="(distribution=classic)")
- transient RequireAem requireAem;
-
@Override
protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
throws ServletException, IOException {
diff --git a/oakpal-checks/pom.xml b/oakpal-checks/pom.xml
index 523fc2c930..82120e5454 100644
--- a/oakpal-checks/pom.xml
+++ b/oakpal-checks/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/pom.xml b/pom.xml
index 32fc0639ed..8d68465ee4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
pom
ACS AEM Commons - Reactor Project
diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml
index 44588ec3bc..bc6ee8e6c1 100644
--- a/ui.apps/pom.xml
+++ b/ui.apps/pom.xml
@@ -25,7 +25,7 @@
com.adobe.acs
acs-aem-commons
- 6.6.5-SNAPSHOT
+ 6.7.0-SNAPSHOT
diff --git a/ui.apps/src/main/content/jcr_root/apps/acs-commons/components/utilities/contentsync/POST.jsp b/ui.apps/src/main/content/jcr_root/apps/acs-commons/components/utilities/contentsync/POST.jsp
index e74639522b..d252999fd1 100755
--- a/ui.apps/src/main/content/jcr_root/apps/acs-commons/components/utilities/contentsync/POST.jsp
+++ b/ui.apps/src/main/content/jcr_root/apps/acs-commons/components/utilities/contentsync/POST.jsp
@@ -20,6 +20,7 @@
pageEncoding="UTF-8"
import="
java.util.List,
+ java.util.Arrays,
java.util.ArrayList,
java.util.Collection,
java.util.Set,
@@ -27,6 +28,8 @@
java.util.stream.Collectors,
java.io.InputStream,
java.io.IOException,
+ java.io.Writer,
+ java.io.StringWriter,
java.io.PrintWriter,
java.io.ByteArrayInputStream,
javax.jcr.Session,
@@ -36,6 +39,7 @@
org.apache.sling.jcr.contentloader.ContentImporter,
org.apache.sling.api.resource.ResourceUtil,
org.apache.commons.lang3.time.DurationFormatUtils,
+ org.apache.commons.io.output.TeeWriter,
com.adobe.acs.commons.contentsync.*
"%><%
@@ -83,21 +87,24 @@
Session session = resourceResolver.adaptTo(Session.class);
ContentReader contentReader = new ContentReader(session);
+ StringWriter tempWriter = new StringWriter();
+ TeeWriter printWriter = new TeeWriter(Arrays.asList(new PrintWriter(out), new PrintWriter(tempWriter)));
+
UpdateStrategy updateStrategy = sling.getServices(UpdateStrategy.class, "(component.name=" + strategyPid + ")")[0];
try(RemoteInstance remoteInstance = new RemoteInstance(hostConfig, generalSettings)){
ContentImporter importer = sling.getService(ContentImporter.class);
ContentSync contentSync = new ContentSync(remoteInstance, resourceResolver, importer);
ContentCatalog contentCatalog = new ContentCatalog(remoteInstance, catalogServlet);
- out.println("building catalog from " + contentCatalog.getFetchURI(root, strategyPid) );
+ println(printWriter, "building catalog from " + contentCatalog.getFetchURI(root, strategyPid) );
out.flush();
List catalog;
List remoteItems = contentCatalog.fetch(root, strategyPid);
long t0 = System.currentTimeMillis();
- out.println(remoteItems.size() + " resource"+(remoteItems.size() == 1 ? "" : "s")+" fetched in " + (System.currentTimeMillis() - t0) + " ms");
+ println(printWriter, remoteItems.size() + " resource"+(remoteItems.size() == 1 ? "" : "s")+" fetched in " + (System.currentTimeMillis() - t0) + " ms");
if(incremental){
catalog = contentCatalog.getDelta(remoteItems, resourceResolver, updateStrategy);
- out.println(catalog.size() + " resource"+(catalog.size() == 1 ? "" : "s")+" modified");
+ println(printWriter, catalog.size() + " resource"+(catalog.size() == 1 ? "" : "s")+" modified");
} else {
catalog = remoteItems;
}
@@ -124,9 +131,9 @@
boolean modified = updateStrategy.isModified(item, targetResource);
if(targetResource == null || modified || !incremental) {
- out.println(++count + "\t" + path);
+ println(printWriter, ++count + "\t" + path);
String msg = updateStrategy.getMessage(item, targetResource);
- out.println("\t" + msg);
+ println(printWriter, "\t" + msg);
if(!dryRun) {
String reqPath = item.getContentUri() ;
JsonObject json = remoteInstance.getJson(reqPath);
@@ -137,18 +144,18 @@
if(targetResource != null && createVersion) {
String revisionId = contentSync.createVersion(targetResource);
if(revisionId != null) {
- out.println("\tcreated revision: " + revisionId);
+ println(printWriter, "\tcreated revision: " + revisionId);
}
}
if(observationData != null){
session.getWorkspace().getObservationManager().setUserData(observationData);
}
- out.println("\timporting data");
+ println(printWriter, "\timporting data");
contentSync.importData(item, sanitizedJson);
if(!binaryProperties.isEmpty()){
- out.println("\tcopying " + binaryProperties.size() + " binary propert" + (binaryProperties.size() > 1 ? "ies" : "y"));
+ println(printWriter, "\tcopying " + binaryProperties.size() + " binary propert" + (binaryProperties.size() > 1 ? "ies" : "y"));
boolean contentResource = item.hasContentResource();
String basePath = path + (contentResource ? "/jcr:content" : "");
List propertyPaths = binaryProperties.stream().map(p -> basePath + p).collect(Collectors.toList());
@@ -175,7 +182,7 @@
String eta = DurationFormatUtils.formatDurationWords(estimatedTime, true, true);
String etaMsg = pct +"%, ETA: " + eta;
t00 = System.currentTimeMillis();
- out.println(etaMsg);
+ println(printWriter, etaMsg);
}
updatedResources.add(path);
@@ -189,11 +196,11 @@
Collection remotePaths = remoteItems.stream().map(c -> c.getPath()).collect(Collectors.toList());
Collection localPaths = updateStrategy.getItems(slingRequest).stream().map(c -> c.getPath()).collect(Collectors.toList());
localPaths.removeAll(remotePaths);
- out.println();
+ println(printWriter, "");
for(String path : localPaths){
Resource res = resourceResolver.getResource(path);
if(res != null){
- out.println("deleting " + path);
+ println(printWriter, "deleting " + path);
if(!dryRun) {
if(res != null) {
resourceResolver.delete(res);
@@ -203,27 +210,29 @@
}
}
- out.println();
+ println(printWriter, "");
for(String parentPath : sortedNodes){
Node targetNode = resourceResolver.getResource(parentPath).adaptTo(Node.class);
- out.println("sorting child nodes of " + targetNode.getPath() );
+ println(printWriter, "sorting child nodes of " + targetNode.getPath() );
contentSync.sort(targetNode);
}
session.save();
- out.println();
- out.println("sync-ed " + count + " resources, in " + (System.currentTimeMillis() - t0) + " ms");
+ println(printWriter, "");
+ println(printWriter, "sync-ed " + count + " resources, in " + (System.currentTimeMillis() - t0) + " ms");
if(!dryRun && workflowModel != null && !workflowModel.isEmpty()){
- out.println();
+ println(printWriter, "");
long t1 = System.currentTimeMillis();
- out.println("starting a " + workflowModel + " workflow for each processed item");
+ println(printWriter, "starting a " + workflowModel + " workflow for each processed item");
out.flush();
contentSync.runWorkflows(workflowModel, updatedResources);
- out.println("started " + updatedResources.size() + " workflows, in " + (System.currentTimeMillis() - t1) + " ms");
+ println(printWriter, "started " + updatedResources.size() + " workflows, in " + (System.currentTimeMillis() - t1) + " ms");
+ }
+ if(!dryRun){
+ ConfigurationUtils.persistAuditLog(resourceResolver, root, count, tempWriter.toString());
}
-
} catch(Exception e){
if(e.getMessage() != null && e.getMessage().startsWith("Not a date string:")){
error(out, "It appears Sling GET Servlet on " + hostConfig.getHost() + " is configured to use the legacy ECMA date format.\n" +
@@ -239,6 +248,11 @@