Commit c9be1dc8 authored by Locatelli's avatar Locatelli
Browse files

Add function get the last time of e resource file.

parent 9c8e93d4
......@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fr.ill.ics</groupId>
<artifactId>nomadcommandsystem</artifactId>
<version>4.0.7</version>
<version>4.0.8-SNAPSHOT</version>
<name>NomadCommandSystem</name>
<description>Java bridge for the communication with the Nomad server</description>
<scm>
......@@ -66,7 +66,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-api</artifactId>
<version>0.1.6</version>
<version>0.1.8</version>
<exclusions>
<exclusion>
<groupId>fr.ill.ics</groupId>
......@@ -77,7 +77,7 @@
<dependency>
<groupId>fr.ill.ics</groupId>
<artifactId>cameo-com-jzmq</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>
</dependency>
</dependencies>
<build>
......
......@@ -75,6 +75,9 @@ public class ResourceManager {
return ServantManagerAccessor.getInstance(serverId).readResourceFile(controllerType, fileName);
}
public int getResourceFileLastTime(String controllerType, String fileName) throws ResourceNotFoundException {
return ServantManagerAccessor.getInstance(serverId).getResourceFileLastTime(controllerType, fileName);
}
public void saveFile(String fileName, String content, int fileType, boolean addServerHome) {
CommandZoneAccessor.getInstance(serverId).saveFile(fileName, content, fileType, addServerHome);
......
......@@ -883,6 +883,38 @@ public class ServantManagerAccessor {
}
}
public synchronized int getResourceFileLastTime(String resourceType, String fileName) throws ResourceNotFoundException {
// Create the message type.
ServantManagerRequest.Message type = ServantManagerRequest.Message.newBuilder()
.setType(ServantManagerRequest.Message.Type.GetResourceFileLastTime)
.build();
// Create the request.
ServantManagerRequest.ReadResourceRequest request = ServantManagerRequest.ReadResourceRequest.newBuilder()
.setType(resourceType)
.setFileName(fileName)
.build();
servantManagerRequester.sendTwoParts(type.toByteArray(), request.toByteArray());
try {
Common.Int32Response response = Common.Int32Response.parseFrom(servantManagerRequester.receive());
if (response.hasError()) {
throw new ResourceNotFoundException(fileName);
}
return response.getValue();
}
catch (InvalidProtocolBufferException e) {
LOGGER.logp(Level.WARNING, this.getClass().getName(), "getResourceFileInfo", "error in parsing response");
}
throw new ResourceNotFoundException(fileName);
}
public synchronized HashMap<String, String> getServantPropertiesValue(int databaseID, int servantID) {
// 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