Skip to content

Instantly share code, notes, and snippets.

@ahmed-musallam
ahmed-musallam / export-namespaces.groovy
Last active August 1, 2018 23:09
Import/Export namespaces from/to AEM instances
import com.google.gson.JsonArray
import com.google.gson.JsonObject
/**
* This script will print a JSON array of all namespaces on current AEM instance
* Each JSON object in the array will be of the format:
* {"prefix":"The namespace prefix", "uri":"The namespace uri"}
*
*/

AEM6.x Migration

  • How to Rebuild a Pre-Existing AEM+Mongo Cluster
  • or migrate from Tar to MongoDB or MongoDB to Tar"
  • or migrate from 5.6.1 or 6.x to 6.x via data migration instead of jar upgrade
  1. (Mongo to Mongo only) Remove one replica from the replica set and delete/recreate the db
    1. Remove the replica node from the set: http://docs.mongodb.org/master/tutorial/remove-replica-set-member/
    2. Validate that no other nodes in the set consider that node to be part of the set anymore. Log into each node in the cluster via mongo shell and run rs.status() to validate that the node that was taken out is not in the cluster any longer.
    3. Drop the aem database on that node http://docs.mongodb.org/manual/reference/command/dropDatabase/
  2. Re-add the database with the correct user permissions (do not add the mongo instance back to the replica set)
@stillalex
stillalex / logging.md
Last active March 12, 2022 15:33
TarMk Cold Standby Logging

TarMk Cold Standby Logging Tips

StandbyClientHandler

Enable DEBUG logs on org.apache.jackrabbit.oak.plugins.segment.standby.client.StandbyClientHandler

This will only log the start and the end of the sync cycle, no progress indication logged.

You'll get the following:

@andrewmkhoury
andrewmkhoury / readme.md
Last active April 29, 2021 08:21
How to clean up unreferenced checkpoints in Oak 1.0.x

Clean up unreferenced checkpoints

  1. Download or build oak-run 1.x matching the version you have installed in your Oak environment.
  2. Stop all AEM instances
  3. Upload the oak-run to the AEM server if using TarMK or MongoDB server (if using MongoMK)
  4. Run this command to cleanup unreferenced checkpoints on TarMK:
java -Xmx4096m -jar /apps/staging/oak-run-1.*.jar checkpoints crx-quickstart/repository/segmentstore rm-unreferenced

Clean up unreferenced checkpoints on MongoMK:

@stillalex
stillalex / rmNode.groovy
Created November 21, 2014 19:16
Groovy script to remove a node at a given path
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
import org.apache.jackrabbit.oak.spi.state.NodeStore
import org.apache.jackrabbit.oak.commons.PathUtils
def rmNode(def session, String path) {
println "Removing node ${path}"
NodeStore ns = session.store
def nb = ns.root.builder()
@andrewmkhoury
andrewmkhoury / oakTreeNodeCount.groovy
Last active April 29, 2021 08:21
Counting nodes in a tree of Oak repository using the oak-run console tool
import org.apache.jackrabbit.oak.spi.state.NodeState
import java.util.concurrent.atomic.AtomicInteger
def countNodes(NodeState n, String path = "/", flush = 5000, AtomicInteger count = new AtomicInteger(0), root = true) {
if(root) {
println "Counting nodes in tree ${path}"
}
cnt = count.incrementAndGet()
if (cnt % flush == 0) println(" " + cnt)
@kand
kand / Nested Paragraph Systems in CQ5
Last active December 2, 2022 21:17
Sometimes nested paragraph systems are needed for special layout type components in CQ5. Here is a custom paragraph system that will overcome the issues related to nesting out of the box paragraph systems.
Set up your file structure for the innerParsys component:
innerParsys
-> parsys
-> new
- _cq_editConfig.xml
- .content.xml
- _cq_editConfig.xml
- .content.xml
- parsys.jsp
@kand
kand / Custom Sidekick Dialog in CQ5
Last active December 1, 2017 06:28
Add a custom dialog as an option in the sidekick. customSidekickDialog.js will add another action to the DEFAULT_ACTIONS list for the sidekick. In this example, the action will open a dialog but, in practice, you could put any action you wanted in the handler. launchSidekick.js is Javascript that should replace the Javascript in your project tha…
Set up your file structure something like this:
/apps/your-site/components/page
-> yourPage
-> clientlibs
-> js
-> customSidekickDialog.js
-> .content.xml
-> js.txt
-> customDialog.xml
@sergeimuller
sergeimuller / gist:2916697
Last active August 25, 2023 03:52
CQ5 curl commands
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/"name of bundle"
Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
@rednaxelafx
rednaxelafx / gist:925323
Last active October 25, 2023 05:30
Correspondence between Sun/Oracle JDK, OpenJDK and HotSpot VM versions

Correspondence between Sun/Oracle JDK, OpenJDK and HotSpot VM versions

build date Sun/Oracle JDK Version OpenJDK Version HotSpot VM Version
2006-11-29 1.6.0-b105 1.6.0-b105
2007-03-14 1.6.0_01-b06 1.6.0_01-b06
2007-06-22 1.6.0_02-b05 1.6.0_02-b05
2007-09-24 1.6.0_03-b05 1.6.0_03-b05
2007-12-14 1.6.0_04-b12 10.0-b19