@Override
public Void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback<CopyCommandResult> callback) {
CopyCmdAnswer answer = null;
DataTO data = null;
if (!success) {
CopyCommandResult result = new CopyCommandResult(null, null);
result.setResult("Failed");
callback.complete(result);
}
if (destData.getType() == DataObjectType.SNAPSHOT) {
SnapshotInfo srcSnapshot = (SnapshotInfo)srcData;
SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
newSnapshot.setPath(UUID.randomUUID().toString());
if (srcSnapshot.getParent() != null) {
newSnapshot.setParentSnapshotPath(srcSnapshot.getParent().getPath());
}
data = newSnapshot;
} else if (destData.getType() == DataObjectType.TEMPLATE) {
TemplateObjectTO newTemplate = new TemplateObjectTO();
newTemplate.setPath(UUID.randomUUID().toString());
newTemplate.setFormat(Storage.ImageFormat.QCOW2);
newTemplate.setSize(10L);
newTemplate.setPhysicalSize(10L);
data = newTemplate;
}
answer = new CopyCmdAnswer(data);
CopyCommandResult result = new CopyCommandResult("something", answer);
callback.complete(result);
return null;
}