}
@Override
public void createAsync(DataObject data, DataStore store,
AsyncCompletionCallback<CreateCmdResult> callback, boolean noCopy) {
ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(
data.getId(), data.getType(), store.getId(),
store.getRole());
DataObject objInStore = null;
boolean freshNewTemplate = false;
if (obj == null) {
try {
objInStore = objectInDataStoreMgr.create(
data, store);
freshNewTemplate = true;
} catch (Throwable e) {
obj = objectInDataStoreMgr.findObject(data.getId(),
data.getType(), store.getId(), store.getRole());
if (obj == null) {
CreateCmdResult result = new CreateCmdResult(
null, null);
result.setSucess(false);
result.setResult(e.toString());
callback.complete(result);
return;
}
}
}
if (!freshNewTemplate
&& obj.getState() != ObjectInDataStoreStateMachine.State.Ready) {
try {
objInStore = waitingForCreated(
data, store);
} catch (Exception e) {
CreateCmdResult result = new CreateCmdResult(null, null);