@Override
public String createEntityExtractUrl(DataStore store, String installPath, ImageFormat format, DataObject dataObject) {
SwiftTO swiftTO = (SwiftTO)store.getTO();
String tempKey = UUID.randomUUID().toString();
boolean result = SwiftUtil.setTempKey(swiftTO, tempKey);
if (!result) {
String errMsg = "Unable to set Temp-Key: " + tempKey;
s_logger.error(errMsg);
throw new CloudRuntimeException(errMsg);
}
String containerName = SwiftUtil.getContainerName(dataObject.getType().toString(), dataObject.getId());
String objectName = installPath.split("\\/")[1];
int urlExpirationInterval = Integer.parseInt(_configDao.getValue(Config.ExtractURLExpirationInterval.toString()));
URL swiftUrl = SwiftUtil.generateTempUrl(swiftTO, containerName, objectName, tempKey, urlExpirationInterval);
if (swiftUrl != null) {
s_logger.debug("Swift temp-url: " + swiftUrl.toString());
return swiftUrl.toString();
}
throw new CloudRuntimeException("Unable to create extraction URL");
}