public FileMetaData getFileMetaDataCloneSynchronized(string clientid, string password, string filename) { UserFileSystem fs = getUserFSFromMapSynchronized(clientid); if (fs == null) { throw new UserNotLoadedInMemoryException("User not loaded in memory :" + clientid); } return(fs.getFileMetaDataCloneSynchronized(filename)); }
/* Entry point for delete file*/ public bool deleteFileSynchronized(string clientid, string filename) { Logger.Debug("Deleting file : " + filename + " owned by : " + clientid); //1) Remove the file from the file system of the client //2) Remove the file from the file system of all shared clients UserFileSystem fs = getUserFSFromMapSynchronized(clientid); if (fs == null) { throw new UserNotLoadedInMemoryException("User not loaded in memory :" + clientid); } bool delete = fs.deleteFileSynchronized(filename); List <string> sharedClients = fs.getFileMetaDataCloneSynchronized(filename).sharedwithclients; foreach (string sharedclient in sharedClients) { UserFileSystem fsShared = getUserFSFromMapSynchronized(sharedclient); if (fsShared != null) { Logger.Debug("Removing file : " + filename + " from shared client fs : " + sharedclient); fsShared.deleteSharedFileSynchronized(new SharedFile(clientid, filename)); } else { Logger.Warn("The shared user file system is missing from the memory, see what happened"); } } return(delete); }