}
protected Void copyCallback(
AsyncCallbackDispatcher<DataObjectManagerImpl, CopyCommandResult> callback,
CopyContext<CreateCmdResult> context) {
CopyCommandResult result = callback.getResult();
DataObject destObj = context.destObj;
ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(
destObj.getId(), destObj
.getType(), destObj.getDataStore()
.getId(), destObj.getDataStore()
.getRole());
if (result.isFailed()) {
try {
objectInDataStoreMgr.update(obj, Event.OperationFailed);
} catch (NoTransitionException e) {
s_logger.debug("Failed to update copying state", e);
}
CreateCmdResult res = new CreateCmdResult(
null, null);
res.setResult(result.getResult());
context.getParentCallback().complete(res);
}
obj.setInstallPath(result.getPath());
try {
objectInDataStoreMgr.update(obj,
ObjectInDataStoreStateMachine.Event.OperationSuccessed);
} catch (NoTransitionException e) {
s_logger.debug("Failed to update copying state: ", e);
try {
objectInDataStoreMgr.update(destObj,
ObjectInDataStoreStateMachine.Event.OperationFailed);
} catch (NoTransitionException e1) {
}
CreateCmdResult res = new CreateCmdResult(
null, null);
res.setResult("Failed to update copying state: " + e.toString());
context.getParentCallback().complete(res);
}
CreateCmdResult res = new CreateCmdResult(
result.getPath(), null);
context.getParentCallback().complete(res);
return null;
}