Skip to content

Instantly share code, notes, and snippets.

@chetanmeh
Last active January 23, 2016 12:56
Show Gist options
  • Save chetanmeh/3c7c3ca06d5ccbc8208e to your computer and use it in GitHub Desktop.
Save chetanmeh/3c7c3ca06d5ccbc8208e to your computer and use it in GitHub Desktop.
Gist to demonstrate executing script via oak-run

To execute a script with oak-run perform following steps

java -jar target/oak-run.jar console --quiet /path/to/segmentstore ":load /path/to/fixAsync.groovy"

You would need to use trunk build of oak-run for this.

$ svn checkout http://svn.apache.org/viewvc/jackrabbit/oak/trunk/
$ cd oak-run
$ mvn clean install
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')}"
asyncBuilder.removeProperty('async')
ns.merge(nb, EmptyHook.INSTANCE, CommitInfo.EMPTY)
println "Removed property from :async"
}
removeAsync(session)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment