use of org.apache.jackrabbit.oak.spi.mount.Mount in project jackrabbit-oak by apache.
the class CrossMountReferenceValidator method leave.
@Override
public void leave(NodeState before, NodeState after) throws CommitFailedException {
if (parent != null) {
return;
}
for (Map.Entry<String, Collection<String>> e : newReferences.asMap().entrySet()) {
String uuid = e.getKey();
String passivePath = getPathByUuid(uuid);
if (passivePath == null) {
LOG.warn("Can't find path for the UUID {}", uuid);
}
Mount m1 = mip.getMountByPath(passivePath);
for (String activePath : e.getValue()) {
Mount m2 = mip.getMountByPath(activePath);
if (!m1.equals(m2)) {
if (failOnDetection) {
throw new CommitFailedException(INTEGRITY, 1, "Unable to reference the node [" + passivePath + "] from node [" + activePath + "]. Referencing across the mounts is not allowed.");
} else {
LOG.warn("Detected a cross-mount reference: {} -> {}", activePath, passivePath);
}
}
}
}
}
use of org.apache.jackrabbit.oak.spi.mount.Mount in project jackrabbit-oak by apache.
the class MountInfoProviderServiceTest method mountWithConfig_Name.
@Test
public void mountWithConfig_Name() throws Exception {
MockOsgi.activate(service, context.bundleContext(), ImmutableMap.<String, Object>of("mountedPaths", new String[] { "/a", "/b" }, "mountName", "foo", "readOnlyMount", true));
MountInfoProvider provider = context.getService(MountInfoProvider.class);
assertEquals(1, provider.getNonDefaultMounts().size());
Mount m = provider.getMountByName(MountInfoProviderService.PROP_MOUNT_NAME_DEFAULT);
assertNull(m);
Mount defMount = provider.getDefaultMount();
assertNotNull(defMount);
m = provider.getMountByName("foo");
assertEquals(m, provider.getMountByPath("/a"));
assertEquals(defMount, provider.getMountByPath("/x"));
assertTrue(m.isReadOnly());
}
Aggregations