StorageProviderUtil { public static Map<String, String> createContentProperties(String absolutePath, String creator) { Map<String, String> props = new HashMap<String, String>(); if (creator != null && creator.trim().length() > 0) { props.put(StorageProvider.PROPERTIES_CONTENT_CREATOR, creator); } props.put(StorageProvider.PROPERTIES_CONTENT_FILE_PATH, absolutePath); try { Path path = FileSystems.getDefault().getPath(absolutePath); BasicFileAttributes bfa = Files.readAttributes(path, BasicFileAttributes.class); String creationDate = DateUtil.convertToStringLong(bfa.creationTime().toMillis()); props.put(StorageProvider.PROPERTIES_CONTENT_FILE_CREATED, creationDate); String lastAccessed = DateUtil.convertToStringLong(bfa.lastAccessTime().toMillis()); props.put(StorageProvider.PROPERTIES_CONTENT_FILE_LAST_ACCESSED, lastAccessed); String modified = DateUtil.convertToStringLong(bfa.lastModifiedTime().toMillis()); props.put(StorageProvider.PROPERTIES_CONTENT_FILE_MODIFIED, modified); } catch (IOException ex) { log.error("Failed to read basic file attributes from " + absolutePath + ": " + ex.getMessage(), ex); } return props; } private  StorageProviderUtil(); static Map<String, String> loadProperties(InputStream is); static ByteArrayInputStream storeProperties(
        Map<String, String> propertiesMap); static String compareChecksum(StorageProvider provider,
                                         String spaceId,
                                         String contentId,
                                         String checksum); static String compareChecksum(String providerChecksum,
                                         String spaceId,
                                         String contentId,
                                         String checksum); static boolean contains(Iterator<String> iterator, String value); static long count(Iterator<String> iterator); static List<String> getList(Iterator<String> iterator); static Map<String, String> createContentProperties(String absolutePath,
                                                              String creator); static Map<String, String> removeCalculatedProperties(Map<String, String> contentProperties);  }
@Test public void testCreateContentProperties() throws IOException { File file = File.createTempFile("test", ".properties"); file.deleteOnExit(); String creator = "test"; Map<String, String> props = StorageProviderUtil.createContentProperties(file.getAbsolutePath(), creator); String creator2 = props.get(StorageProvider.PROPERTIES_CONTENT_CREATOR); assertEquals(creator, creator2); assertNotNull(props.get(StorageProvider.PROPERTIES_CONTENT_FILE_CREATED)); assertNotNull(props.get(StorageProvider.PROPERTIES_CONTENT_FILE_LAST_ACCESSED)); assertNotNull(props.get(StorageProvider.PROPERTIES_CONTENT_FILE_MODIFIED)); assertNotNull(props.get(StorageProvider.PROPERTIES_CONTENT_FILE_PATH)); }