mirror of
https://github.com/esiur/esiur-dart.git
synced 2025-05-06 12:02:57 +00:00
async put
This commit is contained in:
parent
cb8e6d5430
commit
53d801bc38
@ -30,5 +30,6 @@ enum ExceptionCode
|
|||||||
PropertyNotFound,
|
PropertyNotFound,
|
||||||
SetPropertyDenied,
|
SetPropertyDenied,
|
||||||
ReadOnlyProperty,
|
ReadOnlyProperty,
|
||||||
GeneralFailure
|
GeneralFailure,
|
||||||
|
AddToStoreFailed
|
||||||
}
|
}
|
@ -1521,11 +1521,14 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
// create the resource
|
// create the resource
|
||||||
var resource = null; //Activator.CreateInstance(type, args) as IResource;
|
var resource = null; //Activator.CreateInstance(type, args) as IResource;
|
||||||
|
|
||||||
Warehouse.put(resource, name, store as IStore, parent);
|
Warehouse.put(resource, name, store as IStore, parent).then<dynamic>((ok) {
|
||||||
|
|
||||||
sendReply(IIPPacketAction.CreateResource, callback)
|
sendReply(IIPPacketAction.CreateResource, callback)
|
||||||
.addUint32(resource.instance.id)
|
.addUint32(resource.instance.id)
|
||||||
.done();
|
.done();
|
||||||
|
}).error((ex){
|
||||||
|
// send some error
|
||||||
|
sendError(ErrorType.Management, callback, ExceptionCode.AddToStoreFailed.index);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -2303,12 +2306,12 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
{
|
{
|
||||||
//print("New template ");
|
//print("New template ");
|
||||||
|
|
||||||
// ClassId, ResourceAge, ResourceLink, Content
|
|
||||||
if (resource == null)
|
|
||||||
Warehouse.put(dr, id.toString(), this, null, tmp);
|
|
||||||
|
|
||||||
var d = rt[3] as DC;
|
var d = rt[3] as DC;
|
||||||
|
|
||||||
|
// ClassId, ResourceAge, ResourceLink, Content
|
||||||
|
if (resource == null)
|
||||||
|
{
|
||||||
|
Warehouse.put(dr, id.toString(), this, null, tmp).then<dynamic>((ok){
|
||||||
Codec.parsePropertyValueArray(d, 0, d.length, this).then((ar)
|
Codec.parsePropertyValueArray(d, 0, d.length, this).then((ar)
|
||||||
{
|
{
|
||||||
//print("attached");
|
//print("attached");
|
||||||
@ -2316,6 +2319,19 @@ class DistributedConnection extends NetworkConnection with IStore
|
|||||||
_resourceRequests.remove(id);
|
_resourceRequests.remove(id);
|
||||||
reply.trigger(dr);
|
reply.trigger(dr);
|
||||||
});
|
});
|
||||||
|
}).error((ex) => reply.triggerError(ex));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Codec.parsePropertyValueArray(d, 0, d.length, this).then((ar)
|
||||||
|
{
|
||||||
|
//print("attached");
|
||||||
|
dr.attach(ar);
|
||||||
|
_resourceRequests.remove(id);
|
||||||
|
reply.trigger(dr);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}).error((ex)
|
}).error((ex)
|
||||||
{
|
{
|
||||||
reply.triggerError(ex);
|
reply.triggerError(ex);
|
||||||
|
@ -384,6 +384,8 @@ class Warehouse {
|
|||||||
}).error((ex) => rt.triggerError(ex));
|
}).error((ex) => rt.triggerError(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return new name
|
||||||
|
|
||||||
return rt;
|
return rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user