Commit 28960c47 authored by ics's avatar ics

Multi clients synchro for files

parent 83035e50
...@@ -99,6 +99,11 @@ public class ResourceManager { ...@@ -99,6 +99,11 @@ public class ResourceManager {
public String getTree(String rootDirectory) { public String getTree(String rootDirectory) {
return ServantManagerAccessor.getInstance(serverId).getTree(rootDirectory); return ServantManagerAccessor.getInstance(serverId).getTree(rootDirectory);
} }
public void deleteFile(String fileName) {
ServantManagerAccessor.getInstance(serverId).deleteFile(fileName);
}
public HashMap<String, String> getFamilyImageKeys() { public HashMap<String, String> getFamilyImageKeys() {
......
...@@ -1105,4 +1105,28 @@ public class ServantManagerAccessor { ...@@ -1105,4 +1105,28 @@ public class ServantManagerAccessor {
} }
return ""; return "";
} }
public void deleteFile(String fileName) {
// Create the message type.
ServantManagerRequest.Message type = ServantManagerRequest.Message.newBuilder()
.setType(ServantManagerRequest.Message.Type.DeleteFile)
.build();
// Create the request.
ServantManagerRequest.DeleteFileRequest request = ServantManagerRequest.DeleteFileRequest.newBuilder()
.setFileName(fileName)
.build();
servantManagerRequester.sendTwoParts(type.toByteArray(), request.toByteArray());
try {
Common.BooleanResponse.parseFrom(servantManagerRequester.receive());
}
catch (InvalidProtocolBufferException e) {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "deleteFile", "error in parsing response");
}
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment