@Override public boolean isUnder(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
@Override public boolean isMounted(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
@Override public boolean apply(String p) { return m.isMounted(p); } };
@Override public boolean isMounted(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
@Override public boolean apply(String p) { return m.isMounted(p); } };
@Override public boolean isUnder(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
@Override public boolean apply(String p) { return m.isMounted(p); } };
@Override public Mount getMountByPath(String path) { for (Mount m : mounts.values()){ if (m.isMounted(path)){ return m; } } return defMount; }
@Override public Mount getMountByPath(String path) { for (Mount m : mounts.values()){ if (m.isMounted(path)){ return m; } } return defMount; }
static Set<String> getSupportedPaths(@NotNull ConfigurationParameters params, @NotNull MountInfoProvider mountInfoProvider) { Set<String> supportedPaths = params.getConfigValue(CugConstants.PARAM_CUG_SUPPORTED_PATHS, ImmutableSet.of()); if (!supportedPaths.isEmpty() && mountInfoProvider.hasNonDefaultMounts()) { for (Mount mount : mountInfoProvider.getNonDefaultMounts()) { for (String path : supportedPaths) { if (mount.isUnder(path)) { log.error("Configured supported CUG path '{}' includes node store mount '{}'.", path, mount.getName()); throw new IllegalStateException(); } else if (mount.isMounted(path)) { log.error("Configured supported CUG path '{}' is part of node store mount '{}'.", path, mount.getName()); throw new IllegalStateException(); } } } } return supportedPaths; }
static Set<String> getSupportedPaths(@NotNull ConfigurationParameters params, @NotNull MountInfoProvider mountInfoProvider) { Set<String> supportedPaths = params.getConfigValue(CugConstants.PARAM_CUG_SUPPORTED_PATHS, ImmutableSet.of()); if (!supportedPaths.isEmpty() && mountInfoProvider.hasNonDefaultMounts()) { for (Mount mount : mountInfoProvider.getNonDefaultMounts()) { for (String path : supportedPaths) { if (mount.isUnder(path)) { log.error("Configured supported CUG path '{}' includes node store mount '{}'.", path, mount.getName()); throw new IllegalStateException(); } else if (mount.isMounted(path)) { log.error("Configured supported CUG path '{}' is part of node store mount '{}'.", path, mount.getName()); throw new IllegalStateException(); } } } } return supportedPaths; }
private <T> void visit(Tree tree, MountedNodeStore mountedStore, ErrorHolder errorHolder, T context, MountedNodeStoreChecker<T> c) { // a mounted NodeStore may contain more paths than what it owns, but since these are not accessible // through the CompositeNodeStore skip them Mount mount = mountedStore.getMount(); boolean under = mount.isUnder(tree.getPath()); boolean mounted = mount.isMounted(tree.getPath()); boolean keepGoing = true; if ( mounted ) { keepGoing = c.check(mountedStore, tree, errorHolder, context); } if ( ( mounted || under ) && keepGoing ) { tree.getChildren().forEach( child -> visit(child, mountedStore, errorHolder, context, c)); } }