I am working on a script that will utilize the ContentService class. In particular, the streamDirectory() method.
My usage is as follows:
def repo = repositoryService.getById(1930)
def callback = new AbstractContentTreeCallback()
contentService.streamDirectory(repo,"patch","files",false,callback,pageReq)
Syntax wise, this is correct. However I do not understand how to actually see the data that is returned. The API states that streamDirectory() calls methods for the AbstractContentTreeCallback object I pass in. The streamDirectory() method itself does not return anything.
I think I am not understanding the “callback” terminology in a Java sense. I’ve seen callbacks in javascript but not in Java.
Has anyone been successful with this class before?
AbstractContentTreeCallback doesn’t actually do anything, you need to extend it. You might want to start by writing a subclass that calls System.out.println for each method, so you can understand when the methods will be called and what data they get passed.