Allow an incoming identifier to be specified for a JsonStore.

connector_plugin
Mic Bowman 2012-09-11 16:42:07 -07:00
parent d53a53d4c5
commit f06394f195
3 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IJsonStoreModule public interface IJsonStoreModule
{ {
bool CreateStore(string value, out UUID result); bool CreateStore(string value, ref UUID result);
bool DestroyStore(UUID storeID); bool DestroyStore(UUID storeID);
bool TestPath(UUID storeID, string path, bool useJson); bool TestPath(UUID storeID, string path, bool useJson);
bool SetValue(UUID storeID, string path, string value, bool useJson); bool SetValue(UUID storeID, string path, string value, bool useJson);

View File

@ -175,14 +175,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
/// ///
/// </summary> /// </summary>
// ----------------------------------------------------------------- // -----------------------------------------------------------------
public bool CreateStore(string value, out UUID result) public bool CreateStore(string value, ref UUID result)
{ {
result = UUID.Zero; if (result == UUID.Zero)
result = UUID.Random();
JsonStore map = null;
if (! m_enabled) return false; if (! m_enabled) return false;
UUID uuid = UUID.Random();
JsonStore map = null;
try try
{ {
@ -195,9 +196,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
} }
lock (m_JsonValueStore) lock (m_JsonValueStore)
m_JsonValueStore.Add(uuid,map); m_JsonValueStore.Add(result,map);
result = uuid;
return true; return true;
} }
@ -231,7 +231,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
if (! m_JsonValueStore.TryGetValue(storeID,out map)) if (! m_JsonValueStore.TryGetValue(storeID,out map))
{ {
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID); m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
return true; return false;
} }
} }

View File

@ -227,7 +227,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value) protected UUID JsonCreateStore(UUID hostID, UUID scriptID, string value)
{ {
UUID uuid = UUID.Zero; UUID uuid = UUID.Zero;
if (! m_store.CreateStore(value, out uuid)) if (! m_store.CreateStore(value, ref uuid))
GenerateRuntimeError("Failed to create Json store"); GenerateRuntimeError("Failed to create Json store");
return uuid; return uuid;