/** {@inheritDoc} */ @Override public String getResourceNameFromIndex(CollectionResource resource) { StringAttributeVisitor visitor = new StringAttributeVisitor(HR_STORAGE_DESC); resource.visit(visitor); String value = (visitor.getValue() != null ? visitor.getValue() : resource.getInstance()); /* * Use special translation for root (base) filesystem */ if (value.equals("/")) return "_root_fs"; /* * 1. Eliminate first slash character * 2. Eliminate tabs and spaces on filesystem names * 3. Replace slash (file separator) character with "-" * 4. Remove Additional Information on Windows Drives */ return value .replaceFirst("/", "") .replaceAll("\\s", "") .replaceAll("/", "-") .replaceAll(":\\\\.*", ""); }