questions

2014-10-13 Thread TALHAOUI Mohamed
Hi,

I have some questions regarding the POC I am working on:

Lifecycle management
I have seen that it is not implemented in Oak while specified by the JCR.
Is there any plan to implement it ?

Observation
How does it scale ?
I need to have some custom operations executed on node creation, move, 
deletion, ...
I guess Observation is the way to go, but I wonder how this scale in case I 
need to be able to handle several billions nodes ?

ACL
How does it scale ?
If I query a large repo for nodes and only have access to few ones, how does 
the filtering work ?

JCR vs RDBMS
I come from the RDBMS world and I am pretty new to JCR so I apologize if these 
are dumb questions:

* So far, I have manipulated the JCR API (node, properties, events, 
...) and was able to cover my basic use cases.

But, in a real application, I need to have OO modelisation and, therefore, at 
some point, have a way to map my business model to JCR nodes (something like an 
ORM).

I found Jackrabbit OCMhttp://jackrabbit.apache.org/5-with-jackrabbit-ocm.html 
but nothing in Oak.

Is there something in the pipe  ?

* What are the strategies and tooling for data migration ?

I mean if I have millions of nodes of a certain type and need to do some 
modification in this type definition (adding a mandatory property or node, 
changing a property type, ); in this case how should I proceed ?

Thanks in advance for your answers,
Mohamed


Oak + Sling

2014-10-08 Thread TALHAOUI Mohamed
Hi there,

Still working on a POC based on Oak for my company.

I would need to run Oak on a OSGI environment and have a REST api.
Sling seems to be the perfect fit for this.
What is the status of Sling running on Oak ? (see 
https://issues.apache.org/jira/browse/SLING-2788)
Is there a documentation on how to configure Sling with Oak ?

Thanks
Mohamed


OakMerge0001: Failed to merge changes to the underlying store

2014-10-06 Thread TALHAOUI Mohamed
HI,

Sorry if this is not the right place to post but I have an issue with a simple 
POC using Oak 1.1.0 and MongoDB as a node store.
I would appreciate any help / hints on resolving this issue.

Thanks

I am getting the following exception:
java.lang.RuntimeException: 
org.apache.jackrabbit.oak.api.CommitFailedException: OakMerge0001: 
OakMerge0001: Failed to merge changes to the underlying store (retries 5, 4848 
ms)
   at 
org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakInitializer.java:64)
   at org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:551)
   at org.apache.jackrabbit.oak.jcr.Jcr.createRepository(Jcr.java:196)
   at com.rsd.glass.oak.Poc.main(Poc.java:44)
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException: OakMerge0001: 
OakMerge0001: Failed to merge changes to the underlying store (retries 5, 4848 
ms)
   at 
org.apache.jackrabbit.oak.spi.state.AbstractNodeStoreBranch.merge(AbstractNodeStoreBranch.java:341)
   at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge(DocumentNodeStoreBranch.java:161)
   at 
org.apache.jackrabbit.oak.plugins.document.DocumentRootBuilder.merge(DocumentRootBuilder.java:159)
   at 
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.merge(DocumentNodeStore.java:1290)
   at 
org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakInitializer.java:62)

Here is my code:

public class Poc {

   public static void main(String args[]) {

 Session session = null;
 try {
MongoConnection connection = new 
MongoConnection(127.0.0.1, 27017, oak);
DB db = connection.getDB();

DocumentMK.Builder builder = new DocumentMK.Builder();
builder.setMongoDB(db);

NodeStore nodeStore = new DocumentNodeStore(builder);
Repository repository = new 
Jcr(nodeStore).createRepository();
session = repository.login(new SimpleCredentials(admin, 
admin.toCharArray()));

Poc poc = new Poc();

NodeTypeManager ntm = 
session.getWorkspace().getNodeTypeManager();
CndImporter.registerNodeTypes(new 
FileReader(src/main/resources/myMetadata.cnd), session, true);

poc.buildContent(session, poc, ntm);

session.save();

// Retrieve content
Node rootNode = session.getRootNode();
Node node = rootNode.getNode(Policies/HR/Contracts);
System.out.println(node.getPath());

System.exit(0);
 } catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.exit(-1);
 } finally {
if (session != null) {
   session.logout();
}
 }

   }

   private void buildContent(Session session, Poc poc, NodeTypeManager ntm) 
throws Exception {

 if (session.itemExists(/Policies)) {
session.removeItem(/Policies);
 }

 // Create Policies tree
 Node rootNode = session.getRootNode();
 Node policiesNode = rootNode.addNode(Policies, my:policy);
 Node hrNode = policiesNode.addNode(HR, my:policy);
 hrNode.setProperty(my:metadata, hr);
 Node contractsNode = hrNode.addNode(Contracts, my:policy);
 contractsNode.setProperty(my:metadata, contract);

   }

}