Find same name sibling(SNS) nodes

Before Jackrabbit Oak, it was possible to create same name sibling nodes(SNS) in CRX 2.

However, to upgrade to CRX 3 Oak, those nodes need to be removed.

To find those nodes, use the Groovy script below in Felix script console.

Once installed, the script console is available at /system/console/scriptconsole.

Don't forget to install the Groovy bundle after installing Script console.

The script logs the SNS nodes paths in a logger named sns that you need to create in the OSGI console.

properties of sns logger:"{5}""sns"]"logs/sns.log""debug"

Groovy script

def traverseAndLogSNS(node, session, log){
	if(node.index != 1) {
	if(node.hasNodes()) {
		def ni = node.nodes
			traverseAndLogSNS(ni.nextNode(), session, log)

def repo = osgi.getService(
def session = repo.loginAdministrative(null)
def root = session.getRootNode()
def log = org.slf4j.LoggerFactory.getLogger("sns")

traverseAndLogSNS(root, session, log)


The script can be esily adapted to log only sns nodes under a certain path.

이 작업에는 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License의 라이센스가 부여되었습니다.  Twitter™ 및 Facebook 게시물은 Creative Commons 약관을 적용받지 않습니다.

법적 고지 사항   |   온라인 개인 정보 보호 정책