Storing metadata and timestamp in /var/project/storeData | Community
Skip to main content
Level 4
June 25, 2025
Solved

Storing metadata and timestamp in /var/project/storeData

  • June 25, 2025
  • 1 reply
  • 384 views
AEM as cloud service Hi Team, We need to store metadata — specifically the page path and timestamp — so that a scheduler can later pick it up and create a content package based on that path. Can we store this data under /var/project/storeData in AEM as a Cloud Service? We intend for this data to exist only on the author instance and not be replicated to publish. Thanks, Geo
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Karishma_begumSh

Hi @georhe6 

In AEM as a Cloud Service, storing metadata like page path and timestamp for later processing by a scheduler is a valid use case. Yes, you can store this data under /var/project/storeData, but there are a few important considerations:

Recommendations:

  1. /var is appropriate: The /var node is designed for transient, non-replicated data that is only needed on the author instance. Your path /var/project/storeData is suitable for such storage, especially since you don’t want this metadata replicated to publish.
  2. Author-only data: By default, anything under /var is not replicated to publish, aligning with your goal.

You can store the data programmatically using a Sling POST or via a service user and ResourceResolver, like:

Map<String, Object> properties = new HashMap<>(); properties.put("pagePath", "/content/your-site/your-page"); properties.put("timestamp", System.currentTimeMillis()); ResourceResolver resolver = ...; // get with service user Resource parent = resolver.getResource("/var/project/storeData"); if (parent != null) { resolver.adaptTo(PageManager.class).create( parent.getPath(), "entry-" + UUID.randomUUID(), // unique node null, properties ); }

Or using JCR API:

Node storeData = session.getNode("/var/project/storeData"); Node entry = storeData.addNode("entry-" + UUID.randomUUID(), "nt:unstructured"); entry.setProperty("pagePath", "/content/your-site/your-page"); entry.setProperty("timestamp", Calendar.getInstance()); session.save();

Make sure you:

  • Use a system user with write permissions to /var/project/storeData.
  • Register the mapping in your repoinit script if the folder needs to be created during deployment.

Hope this helpful.

 

Regards,

Karishma.

1 reply

Karishma_begumSh
Karishma_begumShAccepted solution
Level 4
June 25, 2025

Hi @georhe6 

In AEM as a Cloud Service, storing metadata like page path and timestamp for later processing by a scheduler is a valid use case. Yes, you can store this data under /var/project/storeData, but there are a few important considerations:

Recommendations:

  1. /var is appropriate: The /var node is designed for transient, non-replicated data that is only needed on the author instance. Your path /var/project/storeData is suitable for such storage, especially since you don’t want this metadata replicated to publish.
  2. Author-only data: By default, anything under /var is not replicated to publish, aligning with your goal.

You can store the data programmatically using a Sling POST or via a service user and ResourceResolver, like:

Map<String, Object> properties = new HashMap<>(); properties.put("pagePath", "/content/your-site/your-page"); properties.put("timestamp", System.currentTimeMillis()); ResourceResolver resolver = ...; // get with service user Resource parent = resolver.getResource("/var/project/storeData"); if (parent != null) { resolver.adaptTo(PageManager.class).create( parent.getPath(), "entry-" + UUID.randomUUID(), // unique node null, properties ); }

Or using JCR API:

Node storeData = session.getNode("/var/project/storeData"); Node entry = storeData.addNode("entry-" + UUID.randomUUID(), "nt:unstructured"); entry.setProperty("pagePath", "/content/your-site/your-page"); entry.setProperty("timestamp", Calendar.getInstance()); session.save();

Make sure you:

  • Use a system user with write permissions to /var/project/storeData.
  • Register the mapping in your repoinit script if the folder needs to be created during deployment.

Hope this helpful.

 

Regards,

Karishma.