use of javax.jcr.nodetype.NoSuchNodeTypeException in project jackrabbit by apache.
the class NodeTypeManagerImpl method registerNodeTypes.
// --------------------------------------------< JackrabbitNodeTypeManager >
/**
* Internal helper method for registering a list of node type definitions.
* Returns a collection containing the registered node types.
*
* @param defs a collection of <code>QNodeTypeDefinition<code> objects
* @return registered node types
* @throws InvalidNodeTypeDefException if a nodetype is invalid
* @throws RepositoryException if an error occurs
*/
private Collection<NodeType> registerNodeTypes(List<QNodeTypeDefinition> defs) throws InvalidNodeTypeDefException, RepositoryException {
context.getNodeTypeRegistry().registerNodeTypes(defs);
Set<NodeType> types = new HashSet<NodeType>();
for (QNodeTypeDefinition def : defs) {
try {
types.add(getNodeType(def.getName()));
} catch (NoSuchNodeTypeException e) {
// ignore
}
}
return types;
}
use of javax.jcr.nodetype.NoSuchNodeTypeException in project jackrabbit by apache.
the class PropertyTypeRegistry method nodeTypeRegistered.
public void nodeTypeRegistered(Name ntName) {
try {
QNodeTypeDefinition def = registry.getNodeTypeDef(ntName);
QPropertyDefinition[] propDefs = def.getPropertyDefs();
synchronized (typeMapping) {
for (QPropertyDefinition propDef : propDefs) {
int type = propDef.getRequiredType();
if (!propDef.definesResidual() && type != PropertyType.UNDEFINED) {
Name name = propDef.getName();
// only remember defined property types
TypeMapping[] types = typeMapping.get(name);
if (types == null) {
types = new TypeMapping[1];
} else {
TypeMapping[] tmp = new TypeMapping[types.length + 1];
System.arraycopy(types, 0, tmp, 0, types.length);
types = tmp;
}
types[types.length - 1] = new TypeMapping(ntName, type, propDef.isMultiple());
typeMapping.put(name, types);
}
}
}
} catch (NoSuchNodeTypeException e) {
log.error("Unable to get newly registered node type definition for name: " + ntName);
}
}
Aggregations