On Wed, Dec 2, 2015 at 2:20 PM, Oliver Lietz <[email protected]> wrote:
> but this is not the case for a single node, right? And I assume a non-cluster
> setup as H K didn't mention it.
Code that HK mentioned above
------------
// REST service createChildFolder running on localhost:8040
public void createChildFolder(String parentPath, String childName) {
DB database = new MongoClient("127.0.0.1", 27017).getDB("sling");
DocumentNodeStore store = new
DocumentMK.Builder().setMongoDB(database).getNodeStore();
Repository repo = new Jcr(new Oak(store)).createRepository();
SimpleCredentials creds = new SimpleCredentials("admin",
"admin".toCharArray());
Session session = (javax.jcr.Session) repository.login(creds);
Node parent = session.getRootNode().getNode(parentPath);
Node child = parent.addNode(childName, "sling:Folder");
session.save();
session.logout();
store.dispose();
}
------------
It technically creates a new Oak instances and thus you have a
cluster! Had he connected to Sling using Remoting and not via Oak then
it would be a single node case
Chetan Mehrotra