use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class VirtualNodeTypeStateProvider method createRootNodeState.
/**
* {@inheritDoc}
* <p>
* currently we have no dynamic ones, we just recreate the entire nodetypes tree
*/
protected VirtualNodeState createRootNodeState() throws RepositoryException {
VirtualNodeState root = new VirtualNodeState(this, parentId, rootNodeId, NameConstants.REP_NODETYPES, null);
Name[] ntNames = ntReg.getRegisteredNodeTypes();
for (int i = 0; i < ntNames.length; i++) {
QNodeTypeDefinition ntDef = ntReg.getNodeTypeDef(ntNames[i]);
VirtualNodeState ntState = createNodeTypeState(root, ntDef);
root.addChildNodeEntry(ntNames[i], ntState.getNodeId());
// add as hard reference
root.addStateReference(ntState);
}
return root;
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method getChildNode.
/**
* Returns the named child node definition from the named node type
* definition. If either of the definitions do not exist, an assertion
* failure is generated.
*
* @param typeName node type name
* @param nodeName child node name
* @return child node definition
*/
private QNodeDefinition getChildNode(String typeName, String nodeName) {
Name name = FACTORY.create(TEST_NAMESPACE, nodeName);
QNodeTypeDefinition def = getNodeType(typeName);
QNodeDefinition[] defs = def.getChildNodeDefs();
for (int i = 0; i < defs.length; i++) {
if (name.equals(defs[i].getName())) {
return defs[i];
}
}
throw new AssertionFailedError("Child node " + nodeName + " does not exist");
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class NodeTypesInContentTest method setUp.
protected void setUp() throws Exception {
isReadOnly = true;
super.setUp();
InputStream xml = getClass().getClassLoader().getResourceAsStream(TEST_NODETYPES);
QNodeTypeDefinition[] ntDefs = NodeTypeReader.read(xml);
NodeTypeRegistry ntReg = ((SessionImpl) superuser).getNodeTypeManager().getNodeTypeRegistry();
if (!ntReg.isRegistered(ntDefs[0].getName())) {
ntReg.registerNodeTypes(Arrays.asList(ntDefs));
}
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testItemNodeType.
/** Test for node type item definitions. */
public void testItemNodeType() {
QNodeTypeDefinition def = getNodeType("itemNodeType");
assertEquals("itemNodeType primaryItemName", FACTORY.create(TEST_NAMESPACE, "emptyItem"), def.getPrimaryItemName());
assertEquals("itemNodeType propertyDefs", 10, def.getPropertyDefs().length);
QPropertyDefinition pdef = getPropDef("itemNodeType", null);
assertTrue("itemNodeType wildcard property", pdef.definesResidual());
}
use of org.apache.jackrabbit.spi.QNodeTypeDefinition in project jackrabbit by apache.
the class TestAll method testPropertyNodeType.
/** Test for node type property definitions. */
public void testPropertyNodeType() {
QNodeTypeDefinition def = getNodeType("propertyNodeType");
assertEquals("propertyNodeType propertyDefs", 13, def.getPropertyDefs().length);
}
Aggregations