/** * Stores all files listed in the map in the immutable file storage, and updates the CsarContentProperties of each * file to contain its address in the aforementioned storage. * * @param filesToStore a map of the CsarContentProperties of all files to be stored in the CSAR and their contents. */ private void immutablyStoreRefFiles(Map<CsarContentProperties, CsarEntry> filesToStore, IRepository repository) throws AccountabilityException, ExecutionException, InterruptedException, IOException { Properties props = repository.getAccountabilityConfigurationManager().properties; AccountabilityManager manager = AccountabilityManagerFactory.getAccountabilityManager(props); Map<String, InputStream> filesMap = new HashMap<>(); for (Map.Entry<CsarContentProperties, CsarEntry> entry : filesToStore.entrySet()) { filesMap.put(entry.getKey().getPathInsideCsar(), entry.getValue().getInputStream()); } // store all files in immutable storage (already stored files will get their same old address) Map<String, String> addressMap = manager .storeState(filesMap) .get(); filesToStore.keySet().forEach((CsarContentProperties properties) -> { properties.setImmutableAddress(addressMap.get(properties.getPathInsideCsar())); }); }