/** * Create the <code>EntryCollector</code> instance that is used by this * provider to gather the effective ACEs for a given list of principals at a * given node during AC evaluation. * * @param systemSession The system session to create the entry collector for. * @return A new instance of <code>CachingEntryCollector</code>. * @throws RepositoryException If an error occurs. */ protected EntryCollector createEntryCollector(SessionImpl systemSession) throws RepositoryException { return new CachingEntryCollector(systemSession, rootNodeId); }
/** * @see EntryCollector#getEntries(org.apache.jackrabbit.core.id.NodeId) */ @Override protected Entries getEntries(NodeId nodeId) throws RepositoryException { Entries entries = cache.get(nodeId); if (entries == null) { // fetch entries and update the cache NodeImpl n = getNodeById(nodeId); entries = updateCache(n); } return entries; }
/** * See {@link CachingEntryCollector#updateCache(NodeImpl)} ; this variant runs fully parallel */ private Entries parallelUpdateCache(NodeImpl node) throws RepositoryException { return internalUpdateCache(node); }
/** * Update cache for the given node id * @param node The target node * @return The list of entries present on the specified node or an empty list. * @throws RepositoryException */ private Entries updateCache(NodeImpl node) throws RepositoryException { if ("T".equals(strategy)) { return throttledUpdateCache(node); } else if ("S".equals(strategy)) { return synchronizedUpdateCache(node); } else if ("P".equals(strategy)) { return parallelUpdateCache(node); } else { // panic throw new RuntimeException("invalid value for updateCacheStrategy: " + strategy); } }
/** * Read the entries defined for the specified node and update the cache * accordingly. * * @param node The target node * @return The list of entries present on the specified node or an empty list. * @throws RepositoryException If an error occurs. */ private Entries internalUpdateCache(NodeImpl node) throws RepositoryException { Entries entries = super.getEntries(node); if (cacheNoAcl || (isRootId(node.getNodeId()) && cache.specialCasesRoot()) || !entries.isEmpty()) { // adjust the 'nextId' to point to the next access controlled // ancestor node instead of the parent and remember the entries. entries.setNextId(getNextID(node)); cache.put(node.getNodeId(), entries); } // else: not access controlled -> ignore. return entries; }
/** * Find the next access control ancestor in the hierarchy 'null' indicates * that there is no ac-controlled ancestor. * * @param node The target node for which the cache needs to be updated. * @return The NodeId of the next access controlled ancestor in the hierarchy * or null */ private NodeId getNextID(NodeImpl node) throws RepositoryException { NodeImpl n = node; NodeId nextId = null; while (nextId == null && !isRootId(n.getNodeId())) { NodeId parentId = n.getParentId(); if (cache.containsKey(parentId)) { nextId = parentId; } else { NodeImpl parent = (NodeImpl) n.getParent(); if (hasEntries(parent)) { nextId = parentId; } else { // try next ancestor n = parent; } } } return nextId; }
/** * @see EntryCollector#getEntries(org.apache.jackrabbit.core.NodeImpl) */ @Override protected Entries getEntries(NodeImpl node) throws RepositoryException { NodeId nodeId = node.getNodeId(); Entries entries = cache.get(nodeId); if (entries == null) { // fetch entries and update the cache entries = updateCache(node); } return entries; }
/** * Update cache for the given node id * @param node The target node * @return The list of entries present on the specified node or an empty list. * @throws RepositoryException */ private Entries updateCache(NodeImpl node) throws RepositoryException { if ("T".equals(strategy)) { return throttledUpdateCache(node); } else if ("S".equals(strategy)) { return synchronizedUpdateCache(node); } else if ("P".equals(strategy)) { return parallelUpdateCache(node); } else { // panic throw new RuntimeException("invalid value for updateCacheStrategy: " + strategy); } }
/** * Read the entries defined for the specified node and update the cache * accordingly. * * @param node The target node * @return The list of entries present on the specified node or an empty list. * @throws RepositoryException If an error occurs. */ private Entries internalUpdateCache(NodeImpl node) throws RepositoryException { Entries entries = super.getEntries(node); if (cacheNoAcl || (isRootId(node.getNodeId()) && cache.specialCasesRoot()) || !entries.isEmpty()) { // adjust the 'nextId' to point to the next access controlled // ancestor node instead of the parent and remember the entries. entries.setNextId(getNextID(node)); cache.put(node.getNodeId(), entries); } // else: not access controlled -> ignore. return entries; }
/** * Find the next access control ancestor in the hierarchy 'null' indicates * that there is no ac-controlled ancestor. * * @param node The target node for which the cache needs to be updated. * @return The NodeId of the next access controlled ancestor in the hierarchy * or null */ private NodeId getNextID(NodeImpl node) throws RepositoryException { NodeImpl n = node; NodeId nextId = null; while (nextId == null && !isRootId(n.getNodeId())) { NodeId parentId = n.getParentId(); if (cache.containsKey(parentId)) { nextId = parentId; } else { NodeImpl parent = (NodeImpl) n.getParent(); if (hasEntries(parent)) { nextId = parentId; } else { // try next ancestor n = parent; } } } return nextId; }
/** * @see EntryCollector#getEntries(org.apache.jackrabbit.core.NodeImpl) */ @Override protected Entries getEntries(NodeImpl node) throws RepositoryException { NodeId nodeId = node.getNodeId(); Entries entries = cache.get(nodeId); if (entries == null) { // fetch entries and update the cache entries = updateCache(node); } return entries; }
/** * @see EntryCollector#getEntries(org.apache.jackrabbit.core.id.NodeId) */ @Override protected Entries getEntries(NodeId nodeId) throws RepositoryException { Entries entries = cache.get(nodeId); if (entries == null) { // fetch entries and update the cache NodeImpl n = getNodeById(nodeId); entries = updateCache(n); } return entries; }
/** * See {@link CachingEntryCollector#updateCache(NodeImpl)} ; this variant runs fully synchronized */ synchronized private Entries synchronizedUpdateCache(NodeImpl node) throws RepositoryException { return internalUpdateCache(node); }
/** * Create the <code>EntryCollector</code> instance that is used by this * provider to gather the effective ACEs for a given list of principals at a * given node during AC evaluation. * * @param systemSession The system session to create the entry collector for. * @return A new instance of <code>CachingEntryCollector</code>. * @throws RepositoryException If an error occurs. */ protected EntryCollector createEntryCollector(SessionImpl systemSession) throws RepositoryException { return new CachingEntryCollector(systemSession, rootNodeId); }
/** * See {@link CachingEntryCollector#updateCache(NodeImpl)} ; this variant runs fully parallel */ private Entries parallelUpdateCache(NodeImpl node) throws RepositoryException { return internalUpdateCache(node); }
/** * See {@link CachingEntryCollector#updateCache(NodeImpl)} ; this variant runs fully synchronized */ synchronized private Entries synchronizedUpdateCache(NodeImpl node) throws RepositoryException { return internalUpdateCache(node); }
Entries e = internalUpdateCache(node); futures.remove(id); fe.setResult(e);
Entries e = internalUpdateCache(node); futures.remove(id); fe.setResult(e);