public static String getSuggestDirName(Mount mount) { if (mount.isDefault()){ return SUGGEST_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + SUGGEST_DIR_SUFFIX; }
@Override public boolean isUnder(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
/** * Creates a new {@link MountInfoProvider} * * @return a newly-created MountInfoProvider */ public MountInfoProvider build() { return new SimpleMountInfoProvider(mounts); } }
@Test public void basicMounting() throws Exception { MountInfoProvider mip = Mounts.newBuilder() .mount("foo", "/a", "/b") .mount("bar", "/x", "/y") .build(); assertEquals("foo", mip.getMountByPath("/a").getName()); assertEquals("foo", mip.getMountByPath("/a/x").getName()); assertEquals("bar", mip.getMountByPath("/x").getName()); assertTrue(mip.getMountByPath("/z").isDefault()); assertTrue(mip.hasNonDefaultMounts()); }
@Test public void readOnlyMounting() throws Exception{ MountInfoProvider mip = Mounts.newBuilder() .mount("foo", "/a", "/b") .readOnlyMount("bar", "/x", "/y") .build(); assertTrue(mip.getMountByName("bar").isReadOnly()); assertFalse(mip.getMountByName("foo").isReadOnly()); }
private MountInfoProvider createMountInfoProvider(String... readOnlyPaths) { MountInfoProvider mountInfoProvider = Mounts.defaultMountInfoProvider(); if (readOnlyPaths.length > 0) { mountInfoProvider = Mounts.newBuilder().readOnlyMount("readOnly", readOnlyPaths).build(); } return mountInfoProvider; } }
@Before public void prepare() { mip = Mounts.newBuilder(). readOnlyMount("libs", "/libs", "/libs2"). readOnlyMount("apps", "/apps", "/apps2"). build(); }
private void initializeMounts() { fooMount = mip.getMountByName("foo"); roMount = mip.getMountByName("ro"); defaultMount = mip.getDefaultMount(); }
PropertyIndexPlan(String name, NodeState root, NodeState definition, Filter filter){ this(name, root, definition, filter, Mounts.defaultMountInfoProvider()); }
/** * Creates a new Builder instance for configuring more complex mount setups * * @return a new builder instance */ public static Builder newBuilder(){ return new Builder(); }
@Override public boolean isDirectlyUnder(String path) { for (Mount m : mounts) { if (m.isDirectlyUnder(path)) { return false; } } return true; } }
public static String getIndexDirName(Mount mount) { if (mount.isDefault()){ return FulltextIndexConstants.INDEX_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + INDEX_DIR_SUFFIX; }
@Override public boolean isMounted(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }
/** * Creates a new {@link MountInfoProvider} * * @return a newly-created MountInfoProvider */ public MountInfoProvider build() { return new SimpleMountInfoProvider(mounts); } }
public static String getIndexDirName(Mount mount) { if (mount.isDefault()){ return FulltextIndexConstants.INDEX_DATA_CHILD_NAME; } String name = mount.getPathFragmentName(); return ":" + name + INDEX_DIR_SUFFIX; }
@Override public boolean apply(String p) { return m.isMounted(p); } };
@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 boolean isMounted(String path) { for (Mount m : mounts) { if (m.isMounted(path)) { return false; } } return true; }