Skip to content

Instantly share code, notes, and snippets.

@yesil
Created June 10, 2016 14:49
Show Gist options
  • Save yesil/e8c8c9e4f8b10809a21f0c1ad1f1c177 to your computer and use it in GitHub Desktop.
Save yesil/e8c8c9e4f8b10809a21f0c1ad1f1c177 to your computer and use it in GitHub Desktop.
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.api.Type
class BlobSearch {
def session
def check(){
checkChildren(session.store.root.builder().nodeState)
}
def checkChildren(nodeState, path = "/"){
def iterator = nodeState.childNodeEntries.iterator()
while(iterator.hasNext()){
def entry = iterator.next()
checkChildren(entry.nodeState, path + entry.name + "/")
}
def pIterator = nodeState.properties.iterator()
while(pIterator.hasNext()){
def propertyState = pIterator.next()
if(propertyState.type == Type.BINARY) {
println path
def value = propertyState.getValue(Type.BINARY)
if (value.blobId && value.blobId.startsWith("6e")) {
println value.blobId
}
}
}
}
}
blobSearch = new BlobSearch(session: session)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment