Custom node types and inifinispan connector
craigching Sep 8, 2010 10:23 PMOk, so I've moved on from my other problem with custom node types and am commencing with using the infinispan connector. What I'm seeing is that the first time I run the code (full maven code and modeshape/infinispan configuration attached), everything appears to work fine. I can see that "car" is in the repository namespace prefixes. For instance, this is the output I see when printing the namespace prefixes:
Prefix: xmlns
Prefix:
Prefix: modeint
Prefix: mode
Prefix: xs
Prefix: xsi
Prefix: jcr
Prefix: mix
Prefix: sv
Prefix: car
Prefix: nt
Prefix: xml
The next time I run, I see the following namespace prefixes:
Prefix: xmlns
Prefix:
Prefix: modeint
Prefix: mode
Prefix: xs
Prefix: xsi
Prefix: jcr
Prefix: mix
Prefix: sv
Prefix: ns001
Prefix: nt
Prefix: xml
The 'ns001' is suspect, I think it's probably meant to be 'car' but isn't for some reason. I also get the following exception stack trace:
javax.jcr.RepositoryException: The "primaryNodeTypeName" parameter value "car:Car" was not a valid node type name
at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:1453)
at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:1356)
at net.webasap.modeshape.InfinispanJcrRepository.main(InfinispanJcrRepository.java:89)
Here is the relevant code for illustration, but, as I said, it's attached too:
session = repo.login();
registerNodeTypes("cars.cnd", session);
String [] prefixes = session.getNamespacePrefixes();
for (String prefix : prefixes) {
System.out.println("Prefix: " + prefix);
}
Node root = session.getRootNode();
Node type = root.addNode("Hybrid", "nt:unstructured");
for(int i = 0; i < 10; ++i) {
Node car = type.addNode("car_" + i, "car:Car");
car.setProperty("car:maker", "Volkswagen");
car.setProperty("car:model", "Passat");
car.setProperty("car:year", "2010");
car.setProperty("car:msrp", "$32,000");
}
session.save();
So, am I doing something wrong? Or am I running into defects in modeshape or infinispan? Any help appreciated!
-
modeshape-infinispan.zip 15.8 KB