Commit 3692904e authored by Hélène Ortiz's avatar Hélène Ortiz

modifications following adding of a method to get one file content from

an absolute path
parent 5118c355
......@@ -61,7 +61,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem-messages</artifactId>
<version>0.0.16</version>
<version>0.0.17</version>
</dependency>
<dependency>
<groupId>fr.ill.ics</groupId>
......
......@@ -91,6 +91,10 @@ public class ResourceManager {
}
public String getFileContentAbsolutePath(String fileName) throws ResourceNotFoundException {
return CommandZoneAccessor.getInstance(serverId).getFileContentAbsolutePath(fileName);
}
public String getTree(String rootDirectory, String extension, boolean recurse) {
return CommandZoneAccessor.getInstance(serverId).getTree(rootDirectory, extension, recurse);
}
......
......@@ -3244,6 +3244,36 @@ public class CommandZoneAccessor {
}
public synchronized String getFileContentAbsolutePath(String fileName) throws ResourceNotFoundException {
// Create the message type.
CommandZoneRequests.Message type = CommandZoneRequests.Message.newBuilder()
.setType(CommandZoneRequests.Message.Type.GetFileContentAbsolutePath)
.build();
// Create the request.
CommandZoneRequests.GetFileContentAbsolutePathRequest request = CommandZoneRequests.GetFileContentAbsolutePathRequest.newBuilder()
.setFileName(fileName)
.build();
commandBoxRequester.sendTwoParts(type.toByteArray(), request.toByteArray());
try {
Common.StringResponse response = Common.StringResponse.parseFrom(commandBoxRequester.receive());
if (response.hasError()) {
throw new ResourceNotFoundException(fileName);
}
return response.getValue();
}
catch (InvalidProtocolBufferException e) {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "getFileContentAbsolutePath", "error in parsing response");
}
throw new ResourceNotFoundException(fileName);
}
public synchronized String getTree(String rootDirectory, String extension, boolean recurse) {
// Create the message type.
......
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