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);
result.setSucess(false);
result.setResult(e.toString());
callback.complete(result);
return;
}
CreateCmdResult result = new CreateCmdResult(
null, null);
callback.complete(result);
return;
}
try {
ObjectInDataStoreStateMachine.Event event = null;
if (noCopy) {
event = ObjectInDataStoreStateMachine.Event.CreateOnlyRequested;
} else {
event = ObjectInDataStoreStateMachine.Event.CreateRequested;
}
objectInDataStoreMgr.update(objInStore,
event);
} catch (NoTransitionException e) {
try {
objectInDataStoreMgr.update(objInStore,
ObjectInDataStoreStateMachine.Event.OperationFailed);
} catch (NoTransitionException e1) {
s_logger.debug("state transation failed", e1);
}
CreateCmdResult result = new CreateCmdResult(null, null);
result.setSucess(false);
result.setResult(e.toString());
callback.complete(result);
return;
}
CreateContext<CreateCmdResult> context = new CreateContext<CreateCmdResult>(