Oak related scripts to be executed with Felix Script Console. To get up and running quickly install following bundles in Felix WebConsole
- Felix Script Console Bundle
- [Groovy Bundle][4]
Then go to http://localhost:4502/system/console/sc
/* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
Oak related scripts to be executed with Felix Script Console. To get up and running quickly install following bundles in Felix WebConsole
Then go to http://localhost:4502/system/console/sc
Scripts to be executed with Oak Console
Following js file can be load at start of mongo shell and then the functions can be accessed
$ wget https://gist.githubusercontent.com/chetanmeh/836ca8fffc4c410daed2/raw/oak-mongo.js
$ mongo localhost/oak --shell oak-mongo.js
MongoDB shell version: 2.6.3
connecting to: localhost/oak
type "help" for help
> oak.countChildren('/oak:index/')
356787
> oak.getChildStats('/oak:index')
import org.apache.jackrabbit.oak.spi.commit.CommitInfo | |
import org.apache.jackrabbit.oak.spi.commit.EmptyHook | |
import org.apache.jackrabbit.oak.spi.state.NodeStore | |
def removeAsync(def session) { | |
NodeStore ns = session.store | |
def nb = ns.root.builder() | |
def asyncBuilder = nb.getChildNode(':async') | |
println "Would be removing property ${asyncBuilder.getProperty('async')}" |
import java.lang.management.ManagementFactory | |
displayThreadDumpAlso = false | |
topJavaThreads = "top -b -n 1 -H | grep java" | |
jstack = "jstack" | |
maxThreads = 5 | |
pid = myPid() | |
def dump = threadDump(pid) | |
def currentCpu = myCpuUsage(pid) |
import groovy.text.SimpleTemplateEngine | |
import org.osgi.framework.Bundle | |
import org.osgi.framework.wiring.BundleRevision | |
import org.osgi.framework.wiring.BundleWire | |
import org.osgi.framework.wiring.BundleWiring | |
import org.osgi.service.packageadmin.ExportedPackage | |
import org.osgi.service.packageadmin.PackageAdmin | |
PackageAdmin pkgAdmin = osgi.getService(org.osgi.service.packageadmin.PackageAdmin.class) |
import org.apache.sling.commons.osgi.ManifestHeader | |
def oakBundles = bundleContext.getBundles().findAll {b -> | |
def name = b.symbolicName | |
return name.startsWith('org.apache.jackrabbit.oak') | |
} | |
oakBundles.each{b -> | |
def scs = b.headers.get('Service-Component') | |
if(!scs) return |
/* | |
* Licensed to the Apache Software Foundation (ASF) under one | |
* or more contributor license agreements. See the NOTICE file | |
* distributed with this work for additional information | |
* regarding copyright ownership. The ASF licenses this file | |
* to you under the Apache License, Version 2.0 (the | |
* "License"); you may not use this file except in compliance | |
* with the License. You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 |
var debugEnabled = false | |
var infoEnabled = true | |
var traceEnabled = false | |
//Maximum number of live paths to determine when a leak object is found | |
var maxPathsToFound = 1 | |
//No of object instances after which a progress message | |
//is logged |