OperationUtil.getRequiredParameter(operation, ParamsProperty.CAPABILITIES_HASH);
RobotName robotName = RobotName.fromAddress(participant.getAddress());
ParticipantId robotAccountId = ParticipantId.ofUnsafe(robotName.toEmailAddress());
AccountData account;
try {
account = accountStore.getAccount(robotAccountId);
} catch (PersistenceException e) {
LOG.severe("Failed to retreive account data for " + robotAccountId, e);
context.constructErrorResponse(operation, "Unable to retrieve account data");
return;
}
if (account == null || !account.isRobot()) {
throw new InvalidRequestException("Can't exectute robot.notify for unknown robot "
+ robotAccountId);
}
RobotAccountData robotAccountData = account.asRobot();
RobotCapabilities capabilities = robotAccountData.getCapabilities();
if (capabilities != null && capabilitiesHash.equals(capabilities.getCapabilitiesHash())) {
// No change in capabilities indicated
context.constructResponse(operation, Maps.<ParamsProperty, Object> newHashMap());
return;
}
try {
robotAccountData = connector.fetchCapabilities(robotAccountData, "");
} catch (CapabilityFetchException e) {
LOG.fine("Unable to retrieve capabilities for " + account.getId(), e);
context.constructErrorResponse(operation, "Unable to retrieve new capabilities");
return;
}
try {