/** * Read from system storage the node type definitions with the supplied names. * * @param nodeTypesToRefresh * @return the node types as read from the system storage */ public List<NodeTypeDefinition> readNodeTypes( Set<Name> nodeTypesToRefresh ) { return readAllNodeTypes(); }
/** * Read from system storage the node type definitions with the supplied names. * * @param nodeTypesToRefresh * @return the node types as read from the system storage */ public List<NodeTypeDefinition> readNodeTypes( Set<Name> nodeTypesToRefresh ) { return readAllNodeTypes(); }
/** * Refresh the node types from the stored representation. * * @return true if there was at least one node type found, or false if there were none */ protected boolean refreshFromSystem() { this.nodeTypesLock.writeLock().lock(); try { // Re-read and re-register all of the node types ... SessionCache systemCache = repository.createSystemSession(context, true); SystemContent system = new SystemContent(systemCache); Collection<NodeTypeDefinition> nodeTypes = system.readAllNodeTypes(); if (nodeTypes.isEmpty()) return false; registerNodeTypes(nodeTypes, false, false, false); return true; } catch (Throwable e) { logger.error(e, JcrI18n.errorRefreshingNodeTypes, repository.name()); return false; } finally { this.nodeTypesLock.writeLock().unlock(); } }
/** * Refresh the node types from the stored representation. * * @return true if there was at least one node type found, or false if there were none */ protected boolean refreshFromSystem() { this.nodeTypesLock.writeLock().lock(); try { // Re-read and re-register all of the node types ... SessionCache systemCache = repository.createSystemSession(context, true); SystemContent system = new SystemContent(systemCache); Collection<NodeTypeDefinition> nodeTypes = system.readAllNodeTypes(); if (nodeTypes.isEmpty()) return false; registerNodeTypes(nodeTypes, false, false, false); return true; } catch (Throwable e) { logger.error(e, JcrI18n.errorRefreshingNodeTypes, repository.name()); return false; } finally { this.nodeTypesLock.writeLock().unlock(); } }
@Test public void shouldReadNodeTypeDefinitionsFromSystemCatalog() { NodeTypes nodeTypes = repository.nodeTypeManager().getNodeTypes(); Set<Name> builtInNodeTypes = new HashSet<Name>(nodeTypes.getAllNodeTypeNames()); for (NodeTypeDefinition type : system.readAllNodeTypes()) { Name name = name(type.getName()); JcrNodeType actual = nodeTypes.getNodeType(name); assertThat("Did not find actual node type for name \"" + type.getName() + "\"", actual, is(notNullValue())); assertThat(builtInNodeTypes.remove(name), is(true)); } assertThat(builtInNodeTypes.isEmpty(), is(true)); }