final SessionCache createSystemCache( boolean readOnly ) { // This method returns a SessionCache used by various Session-owned components that can automatically // save system content. This session should be notified when such activities happen. SessionCache systemCache = repository.createSystemSession(context, readOnly); return readOnly ? systemCache : new SystemSessionCache(systemCache); }
final SessionCache createSystemCache( boolean readOnly ) { // This method returns a SessionCache used by various Session-owned components that can automatically // save system content. This session should be notified when such activities happen. SessionCache systemCache = repository.createSystemSession(context, readOnly); return readOnly ? systemCache : new SystemSessionCache(systemCache); }
@Override public void createProjection( String absNodePath, String sourceName, String externalPath, String alias ) throws RepositoryException { AbstractJcrNode node = session.getNode(absNodePath); if (session.nodeTypeManager().nodeTypes().isUnorderedCollection(node.getPrimaryTypeName(), node.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("create projection")); } NodeKey parentNodeToBecomeFederatedKey = node.key(); String projectionAlias = !StringUtil.isBlank(alias) ? alias : externalPath; if (projectionAlias.endsWith("/")) { projectionAlias = projectionAlias.substring(0, projectionAlias.length() - 1); } if (projectionAlias.contains("/")) { projectionAlias = projectionAlias.substring(projectionAlias.lastIndexOf("/") + 1); } if (StringUtil.isBlank(projectionAlias)) { // we cannot create an external projection without a valid alias return; } SessionCache sessionCache = this.session.spawnSessionCache(false); SessionCache systemSession = session.repository.createSystemSession(session.context(), false); String externalNodeKey = documentStore.createExternalProjection(parentNodeToBecomeFederatedKey.toString(), sourceName, externalPath, projectionAlias, systemSession); MutableCachedNode mutable = sessionCache.mutable(parentNodeToBecomeFederatedKey); mutable.addFederatedSegment(externalNodeKey, projectionAlias); systemSession.save(sessionCache, null); }
@Override public void createProjection( String absNodePath, String sourceName, String externalPath, String alias ) throws RepositoryException { AbstractJcrNode node = session.getNode(absNodePath); if (session.nodeTypeManager().nodeTypes().isUnorderedCollection(node.getPrimaryTypeName(), node.getMixinTypeNames())) { throw new ConstraintViolationException(JcrI18n.operationNotSupportedForUnorderedCollections.text("create projection")); } NodeKey parentNodeToBecomeFederatedKey = node.key(); String projectionAlias = !StringUtil.isBlank(alias) ? alias : externalPath; if (projectionAlias.endsWith("/")) { projectionAlias = projectionAlias.substring(0, projectionAlias.length() - 1); } if (projectionAlias.contains("/")) { projectionAlias = projectionAlias.substring(projectionAlias.lastIndexOf("/") + 1); } if (StringUtil.isBlank(projectionAlias)) { // we cannot create an external projection without a valid alias return; } SessionCache sessionCache = this.session.spawnSessionCache(false); SessionCache systemSession = session.repository.createSystemSession(session.context(), false); String externalNodeKey = documentStore.createExternalProjection(parentNodeToBecomeFederatedKey.toString(), sourceName, externalPath, projectionAlias, systemSession); MutableCachedNode mutable = sessionCache.mutable(parentNodeToBecomeFederatedKey); mutable.addFederatedSegment(externalNodeKey, projectionAlias); systemSession.save(sessionCache, null); }
private static void initNodesCount() throws RepositoryException { JcrSession session = repository.login(); try { NodeCache systemSession = repository.createSystemSession(session.context(), true); totalSystemNodeCount = countAllNodesBelow(systemSession.getRootKey(), systemSession) - 1; // not root totalNodeCount = totalSystemNodeCount + TOTAL_NON_SYSTEM_NODE_COUNT; } finally { session.logout(); } }
@Before public void beforeEach() throws Exception { config = new RepositoryConfiguration("repoName").with(new TestingEnvironment()); repository = new JcrRepository(config); repository.start(); SessionCache systemCache = repository.createSystemSession(repository.runningState().context(), false); system = new SystemContent(systemCache); }
SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), false); SystemContent systemContent = new SystemContent(systemSession); MutableCachedNode systemNode = systemContent.mutableSystemNode(); SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), false); SystemContent systemContent = new SystemContent(systemSession); MutableCachedNode systemNode = systemContent.mutableSystemNode(); SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), true); SystemContent systemContent = new SystemContent(systemSession); CachedNode systemNode = systemContent.systemNode();
SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), false); SystemContent systemContent = new SystemContent(systemSession); ChildReferences childReferences = systemContent.locksNode().getChildReferences(systemSession); SessionCache systemSession = repository.createSystemSession(repository.runningState().context(), true); SystemContent systemContent = new SystemContent(systemSession); ChildReferences childReferences = systemContent.locksNode().getChildReferences(systemSession);