@Test(expected = ConstraintViolationException.class) @FixFor( "MODE-2109" ) public void shouldNotAllowProjections() throws Exception { session.getRootNode().addNode("col", "test:smallCollection"); session.save(); session.getWorkspace().getFederationManager().createProjection("/col", "dummy", "/", "dummy"); }
private void createPreconfiguredProjections() throws RepositoryException { assert !started(); Snapshot current = this.snapshot.get(); for (String workspaceName : current.getWorkspacesWithProjections()) { JcrSession session = repository.loginInternalSession(workspaceName); try { FederationManager federationManager = session.getWorkspace().getFederationManager(); List<RepositoryConfiguration.ProjectionConfiguration> projections = current.getProjectionConfigurationsForWorkspace(workspaceName); for (RepositoryConfiguration.ProjectionConfiguration projectionCfg : projections) { if (current.isUnused(projectionCfg.getSourceName())) { LOGGER.debug("Ignoring projection '{0}' because the connector for '{1}' is unused", projectionCfg, projectionCfg.getSourceName()); continue; } String repositoryPath = projectionCfg.getRepositoryPath(); String alias = projectionCfg.getAlias(); AbstractJcrNode node = session.getNode(repositoryPath); // only create the projectionCfg if one doesn't exist with the same alias if (!current.hasInternalProjection(alias, node.key().toString()) && !projectedPathExists(session, projectionCfg)) { federationManager.createProjection(repositoryPath, projectionCfg.getSourceName(), projectionCfg.getExternalPath(), alias); } } } finally { session.logout(); } } }
private void createPreconfiguredProjections() throws RepositoryException { assert !started(); Snapshot current = this.snapshot.get(); for (String workspaceName : current.getWorkspacesWithProjections()) { JcrSession session = repository.loginInternalSession(workspaceName); try { FederationManager federationManager = session.getWorkspace().getFederationManager(); List<RepositoryConfiguration.ProjectionConfiguration> projections = current.getProjectionConfigurationsForWorkspace(workspaceName); for (RepositoryConfiguration.ProjectionConfiguration projectionCfg : projections) { if (current.isUnused(projectionCfg.getSourceName())) { LOGGER.debug("Ignoring projection '{0}' because the connector for '{1}' is unused", projectionCfg, projectionCfg.getSourceName()); continue; } String repositoryPath = projectionCfg.getRepositoryPath(); String alias = projectionCfg.getAlias(); AbstractJcrNode node = session.getNode(repositoryPath); // only create the projectionCfg if one doesn't exist with the same alias if (!current.hasInternalProjection(alias, node.key().toString()) && !projectedPathExists(session, projectionCfg)) { federationManager.createProjection(repositoryPath, projectionCfg.getSourceName(), projectionCfg.getExternalPath(), alias); } } } finally { session.logout(); } } }