mirror of
https://github.com/opensim/opensim.git
synced 2026-08-04 16:22:50 +08:00
Massive tab and trailing space cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* Copyright (c) Contributors
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
protected List<TakeValueCallbackClass> m_TakeStore;
|
||||
protected List<TakeValueCallbackClass> m_ReadStore;
|
||||
|
||||
|
||||
// add separators for quoted paths and array references
|
||||
protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
|
||||
|
||||
@@ -98,10 +98,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public int StringSpace { get; set; }
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public static bool CanonicalPathExpression(string ipath, out string opath)
|
||||
@@ -116,13 +116,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
opath = PathExpressionToKey(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStore()
|
||||
public JsonStore()
|
||||
{
|
||||
StringSpace = 0;
|
||||
m_TakeStore = new List<TakeValueCallbackClass>();
|
||||
@@ -132,17 +132,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
public JsonStore(string value) : this()
|
||||
{
|
||||
// This is going to throw an exception if the value is not
|
||||
// a valid JSON chunk. Calling routines should catch the
|
||||
// a valid JSON chunk. Calling routines should catch the
|
||||
// exception and handle it appropriately
|
||||
if (String.IsNullOrEmpty(value))
|
||||
ValueStore = new OSDMap();
|
||||
else
|
||||
ValueStore = OSDParser.DeserializeJson(value);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStoreNodeType GetNodeType(string expr)
|
||||
@@ -150,27 +150,27 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
Stack<string> path;
|
||||
if (! ParsePathExpression(expr,out path))
|
||||
return JsonStoreNodeType.Undefined;
|
||||
|
||||
|
||||
OSD result = ProcessPathExpression(ValueStore,path);
|
||||
|
||||
if (result == null)
|
||||
return JsonStoreNodeType.Undefined;
|
||||
|
||||
|
||||
if (result is OSDMap)
|
||||
return JsonStoreNodeType.Object;
|
||||
|
||||
|
||||
if (result is OSDArray)
|
||||
return JsonStoreNodeType.Array;
|
||||
|
||||
|
||||
if (OSDBaseType(result.Type))
|
||||
return JsonStoreNodeType.Value;
|
||||
|
||||
|
||||
return JsonStoreNodeType.Undefined;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStoreValueType GetValueType(string expr)
|
||||
@@ -178,18 +178,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
Stack<string> path;
|
||||
if (! ParsePathExpression(expr,out path))
|
||||
return JsonStoreValueType.Undefined;
|
||||
|
||||
|
||||
OSD result = ProcessPathExpression(ValueStore,path);
|
||||
|
||||
if (result == null)
|
||||
return JsonStoreValueType.Undefined;
|
||||
|
||||
|
||||
if (result is OSDMap)
|
||||
return JsonStoreValueType.Undefined;
|
||||
|
||||
|
||||
if (result is OSDArray)
|
||||
return JsonStoreValueType.Undefined;
|
||||
|
||||
|
||||
if (result is OSDBoolean)
|
||||
return JsonStoreValueType.Boolean;
|
||||
|
||||
@@ -204,10 +204,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
return JsonStoreValueType.Undefined;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public int ArrayLength(string expr)
|
||||
@@ -228,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool GetValue(string expr, out string value, bool useJson)
|
||||
@@ -241,23 +241,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
}
|
||||
|
||||
OSD result = ProcessPathExpression(ValueStore,path);
|
||||
return ConvertOutputValue(result,out value,useJson);
|
||||
return ConvertOutputValue(result,out value,useJson);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool RemoveValue(string expr)
|
||||
{
|
||||
return SetValueFromExpression(expr,null);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool SetValue(string expr, string value, bool useJson)
|
||||
@@ -272,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
// There doesn't appear to be a good way to determine if the
|
||||
// value is valid Json other than to let the parser crash
|
||||
try
|
||||
try
|
||||
{
|
||||
ovalue = OSDParser.DeserializeJson(value);
|
||||
}
|
||||
@@ -292,13 +292,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
ovalue = new OSDString(value);
|
||||
}
|
||||
|
||||
|
||||
return SetValueFromExpression(expr,ovalue);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool TakeValue(string expr, bool useJson, TakeValueCallback cback)
|
||||
@@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
string value = String.Empty;
|
||||
if (! ConvertOutputValue(result,out value,useJson))
|
||||
{
|
||||
@@ -332,7 +332,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool ReadValue(string expr, bool useJson, TakeValueCallback cback)
|
||||
@@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
string value = String.Empty;
|
||||
if (! ConvertOutputValue(result,out value,useJson))
|
||||
{
|
||||
@@ -362,10 +362,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected bool SetValueFromExpression(string expr, OSD ovalue)
|
||||
@@ -447,7 +447,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
Match match = hmatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string hkey = groups[1].Value;
|
||||
|
||||
|
||||
if (result is OSDMap)
|
||||
{
|
||||
// this is the assignment case
|
||||
@@ -456,7 +456,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
StringSpace -= ComputeSizeOf(hmap[hkey]);
|
||||
StringSpace += ComputeSizeOf(ovalue);
|
||||
|
||||
|
||||
hmap[hkey] = ovalue;
|
||||
InvokeNextCallback(pexpr + pkey);
|
||||
return true;
|
||||
@@ -483,13 +483,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected bool InvokeNextCallback(string pexpr)
|
||||
{
|
||||
// Process all of the reads that match the expression first
|
||||
List<TakeValueCallbackClass> reads =
|
||||
List<TakeValueCallbackClass> reads =
|
||||
m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
|
||||
|
||||
foreach (TakeValueCallbackClass readcb in reads)
|
||||
@@ -501,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// Process one take next
|
||||
TakeValueCallbackClass takecb =
|
||||
m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
|
||||
|
||||
|
||||
if (takecb != null)
|
||||
{
|
||||
m_TakeStore.Remove(takecb);
|
||||
@@ -525,13 +525,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// add front and rear separators
|
||||
expr = "." + expr + ".";
|
||||
|
||||
|
||||
// add separators for quoted exprs and array references
|
||||
expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);
|
||||
|
||||
|
||||
// add quotes to bare identifier
|
||||
expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);
|
||||
|
||||
|
||||
// remove extra separators
|
||||
expr = m_ParsePassFour.Replace(expr,".",-1,0);
|
||||
|
||||
@@ -550,7 +550,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
/// <param>path is a stack where the top level of the path is at the bottom of the stack</param>
|
||||
// -----------------------------------------------------------------
|
||||
@@ -558,13 +558,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
if (path.Count == 0)
|
||||
return map;
|
||||
|
||||
|
||||
string pkey = path.Pop();
|
||||
|
||||
OSD rmap = ProcessPathExpression(map,path);
|
||||
if (rmap == null)
|
||||
return null;
|
||||
|
||||
|
||||
// ---------- Check for an array index ----------
|
||||
MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0);
|
||||
|
||||
@@ -582,7 +582,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
GroupCollection groups = match.Groups;
|
||||
string akey = groups[1].Value;
|
||||
int aval = Convert.ToInt32(akey);
|
||||
|
||||
|
||||
if (aval < amap.Count)
|
||||
return (OSD) amap[aval];
|
||||
|
||||
@@ -599,13 +599,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
OSDMap hmap = rmap as OSDMap;
|
||||
|
||||
Match match = hmatches[0];
|
||||
GroupCollection groups = match.Groups;
|
||||
string hkey = groups[1].Value;
|
||||
|
||||
|
||||
if (hmap.ContainsKey(hkey))
|
||||
return (OSD) hmap[hkey];
|
||||
|
||||
@@ -619,13 +619,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static bool ConvertOutputValue(OSD result, out string value, bool useJson)
|
||||
{
|
||||
value = String.Empty;
|
||||
|
||||
|
||||
// If we couldn't process the path
|
||||
if (result == null)
|
||||
return false;
|
||||
@@ -646,13 +646,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
return true;
|
||||
}
|
||||
|
||||
value = "'" + result.AsString() + "'";
|
||||
value = "'" + result.AsString() + "'";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (OSDBaseType(result.Type))
|
||||
{
|
||||
value = result.AsString();
|
||||
value = result.AsString();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -661,24 +661,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static string PathExpressionToKey(Stack<string> path)
|
||||
{
|
||||
if (path.Count == 0)
|
||||
return "";
|
||||
|
||||
|
||||
string pkey = "";
|
||||
foreach (string k in path)
|
||||
pkey = (pkey == "") ? k : (k + "." + pkey);
|
||||
|
||||
|
||||
return pkey;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static bool OSDBaseType(OSDType type)
|
||||
@@ -705,7 +705,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected static int ComputeSizeOf(OSD value)
|
||||
@@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
private Scene m_scene;
|
||||
private UUID m_objectID;
|
||||
|
||||
protected override OSD ValueStore
|
||||
protected override OSD ValueStore
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// This is bad
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
return sop.DynAttrs.TopLevelMap;
|
||||
}
|
||||
|
||||
@@ -761,5 +761,5 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
StringSpace = ComputeSizeOf(ValueStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* Copyright (c) Contributors
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// -----------------------------------------------------------------
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if ((m_config = config.Configs["JsonStore"]) == null)
|
||||
{
|
||||
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
if (m_enabled)
|
||||
{
|
||||
m_scene = scene;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// where we hook up events
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* Copyright (c) Contributors
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// -----------------------------------------------------------------
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if ((m_config = config.Configs["JsonStore"]) == null)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// where we hook up events
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
@@ -184,7 +184,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
#region SceneEvents
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
|
||||
@@ -196,10 +196,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
#region ScriptInvocationInteface
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStoreStats GetStoreStats()
|
||||
@@ -210,13 +210,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
stats.StoreCount = m_JsonValueStore.Count;
|
||||
}
|
||||
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool AttachObjectStore(UUID objectID)
|
||||
@@ -235,17 +235,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
if (m_JsonValueStore.ContainsKey(objectID))
|
||||
return true;
|
||||
|
||||
|
||||
JsonStore map = new JsonObjectStore(m_scene,objectID);
|
||||
m_JsonValueStore.Add(objectID,map);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool CreateStore(string value, ref UUID result)
|
||||
@@ -254,12 +254,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
result = UUID.Random();
|
||||
|
||||
JsonStore map = null;
|
||||
|
||||
|
||||
if (! m_enabled) return false;
|
||||
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
{
|
||||
map = new JsonStore(value);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -270,13 +270,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
lock (m_JsonValueStore)
|
||||
m_JsonValueStore.Add(result,map);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool DestroyStore(UUID storeID)
|
||||
@@ -289,7 +289,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool TestStore(UUID storeID)
|
||||
@@ -302,7 +302,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStoreNodeType GetNodeType(UUID storeID, string path)
|
||||
@@ -318,7 +318,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
return JsonStoreNodeType.Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
@@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public JsonStoreValueType GetValueType(UUID storeID, string path)
|
||||
@@ -350,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
return JsonStoreValueType.Undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
@@ -366,7 +366,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool SetValue(UUID storeID, string path, string value, bool useJson)
|
||||
@@ -382,7 +382,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
@@ -393,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
storeID,map.StringSpace,m_maxStringSpace);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
return map.SetValue(path,value,useJson);
|
||||
}
|
||||
}
|
||||
@@ -404,10 +404,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool RemoveValue(UUID storeID, string path)
|
||||
@@ -423,7 +423,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
lock (map)
|
||||
@@ -436,10 +436,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public int GetArrayLength(UUID storeID, string path)
|
||||
@@ -464,19 +464,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.Error("[JsonStore]: unable to retrieve value", e);
|
||||
}
|
||||
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public bool GetValue(UUID storeID, string path, bool useJson, out string value)
|
||||
{
|
||||
value = String.Empty;
|
||||
|
||||
|
||||
if (! m_enabled) return false;
|
||||
|
||||
JsonStore map = null;
|
||||
@@ -497,13 +497,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.Error("[JsonStore]: unable to retrieve value", e);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
|
||||
@@ -536,13 +536,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.Error("[JsonStore] unable to retrieve value", e);
|
||||
}
|
||||
|
||||
|
||||
cback(String.Empty);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
public void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
|
||||
@@ -575,7 +575,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.Error("[JsonStore]: unable to retrieve value", e);
|
||||
}
|
||||
|
||||
|
||||
cback(String.Empty);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) Contributors
|
||||
* Copyright (c) Contributors
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// -----------------------------------------------------------------
|
||||
public void Initialise(IConfigSource config)
|
||||
{
|
||||
try
|
||||
try
|
||||
{
|
||||
if ((m_config = config.Configs["JsonStore"]) == null)
|
||||
{
|
||||
@@ -166,7 +166,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// Called when all modules have been added for a region. This is
|
||||
/// where we hook up events
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
@@ -251,7 +251,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
#region ScriptInvocationInteface
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -260,13 +260,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
UUID uuid = UUID.Zero;
|
||||
if (! m_store.AttachObjectStore(hostID))
|
||||
GenerateRuntimeError("Failed to create Json store");
|
||||
|
||||
|
||||
return hostID;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -275,12 +275,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
UUID uuid = UUID.Zero;
|
||||
if (! m_store.CreateStore(value, ref uuid))
|
||||
GenerateRuntimeError("Failed to create Json store");
|
||||
|
||||
|
||||
lock (m_scriptStores)
|
||||
{
|
||||
if (! m_scriptStores.ContainsKey(scriptID))
|
||||
m_scriptStores[scriptID] = new HashSet<UUID>();
|
||||
|
||||
|
||||
m_scriptStores[scriptID].Add(uuid);
|
||||
}
|
||||
return uuid;
|
||||
@@ -288,7 +288,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -305,7 +305,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -316,7 +316,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -330,7 +330,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -341,10 +341,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier), null, "JsonStoreScriptModule.JsonReadNotecard");
|
||||
return reqID;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -358,7 +358,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -366,7 +366,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
string ipath = ConvertList2Path(pathlist);
|
||||
string opath;
|
||||
|
||||
|
||||
if (JsonStore.CanonicalPathExpression(ipath,out opath))
|
||||
return opath;
|
||||
|
||||
@@ -375,10 +375,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
// the entire store
|
||||
return "**INVALID**";
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -389,7 +389,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -400,7 +400,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -417,7 +417,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -425,10 +425,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
return m_store.RemoveValue(storeID,path) ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -436,10 +436,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
return m_store.GetArrayLength(storeID,path);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -457,10 +457,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_store.GetValue(storeID,path,true, out value);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -480,10 +480,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
o => DoJsonTakeValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonTakeValueJson");
|
||||
return reqID;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
[ScriptInvocation]
|
||||
@@ -503,12 +503,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
o => DoJsonReadValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonReadValueJson");
|
||||
return reqID;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected void GenerateRuntimeError(string msg)
|
||||
@@ -516,10 +516,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_log.InfoFormat("[JsonStore] runtime error: {0}",msg);
|
||||
throw new Exception("JsonStore Runtime Error: " + msg);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
protected void DispatchValue(UUID scriptID, UUID reqID, string value)
|
||||
@@ -529,7 +529,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
|
||||
@@ -543,14 +543,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
|
||||
DispatchValue(scriptID,reqID,String.Empty);
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
|
||||
@@ -564,13 +564,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString());
|
||||
}
|
||||
|
||||
|
||||
DispatchValue(scriptID,reqID,String.Empty);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonReadNotecard(
|
||||
@@ -580,7 +580,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
if (!UUID.TryParse(notecardIdentifier, out assetID))
|
||||
{
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
|
||||
SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
|
||||
assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
|
||||
}
|
||||
|
||||
@@ -590,10 +590,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
if (a.Type != (sbyte)AssetType.Notecard)
|
||||
GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID));
|
||||
|
||||
|
||||
m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID);
|
||||
|
||||
try
|
||||
try
|
||||
{
|
||||
string jsondata = SLUtil.ParseNotecardToString(a.Data);
|
||||
int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0;
|
||||
@@ -612,10 +612,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
|
||||
m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonWriteNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string name)
|
||||
@@ -626,9 +626,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
m_comms.DispatchReply(scriptID,0,UUID.Zero.ToString(),reqID.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SceneObjectPart host = m_scene.GetSceneObjectPart(hostID);
|
||||
|
||||
|
||||
// Create new asset
|
||||
UUID assetID = UUID.Random();
|
||||
AssetBase asset = new AssetBase(assetID, name, (sbyte)AssetType.Notecard, host.OwnerID.ToString());
|
||||
@@ -681,7 +681,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
for (int i = 0; i < pathlist.Length; i++)
|
||||
{
|
||||
string token = "";
|
||||
|
||||
|
||||
if (pathlist[i] is string)
|
||||
{
|
||||
token = pathlist[i].ToString();
|
||||
@@ -699,16 +699,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
{
|
||||
token = "." + pathlist[i].ToString() + ".";
|
||||
}
|
||||
|
||||
|
||||
path += token + ".";
|
||||
}
|
||||
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
/// <summary>
|
||||
///
|
||||
///
|
||||
/// </summary>
|
||||
// -----------------------------------------------------------------
|
||||
private void DoJsonRezObject(UUID hostID, UUID scriptID, UUID reqID, string name, Vector3 pos, Vector3 vel, Quaternion rot, string param)
|
||||
@@ -801,7 +801,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
|
||||
|
||||
group.ScheduleGroupForFullUpdate();
|
||||
|
||||
// send the reply back to the host object, use the integer param to indicate the number
|
||||
// send the reply back to the host object, use the integer param to indicate the number
|
||||
// of remaining objects
|
||||
m_comms.DispatchReply(scriptID, objlist.Count-i-1, group.RootPart.UUID.ToString(), reqID.ToString());
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
|
||||
|
||||
{
|
||||
string value = (string)InvokeOp("JsonGetValue", storeId, "Hello.World");
|
||||
@@ -213,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
|
||||
|
||||
{
|
||||
string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World");
|
||||
@@ -246,11 +246,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// TestHelpers.InMethod();
|
||||
//// TestHelpers.EnableLogging();
|
||||
//
|
||||
// UUID storeId
|
||||
// UUID storeId
|
||||
// = (UUID)m_smcm.InvokeOperation(
|
||||
// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
|
||||
// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
|
||||
//
|
||||
// string value
|
||||
// string value
|
||||
// = (string)m_smcm.InvokeOperation(
|
||||
// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" });
|
||||
//
|
||||
@@ -271,7 +271,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test remove of node in object pointing to a string
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
|
||||
|
||||
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
|
||||
Assert.That(returnValue, Is.EqualTo(1));
|
||||
@@ -285,7 +285,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test remove of node in object pointing to another object
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Wally' } }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Wally' } }");
|
||||
|
||||
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
|
||||
Assert.That(returnValue, Is.EqualTo(1));
|
||||
@@ -299,7 +299,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test remove of node in an array
|
||||
{
|
||||
UUID storeId
|
||||
UUID storeId
|
||||
= (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : [ 'value1', 'value2' ] }");
|
||||
|
||||
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
|
||||
@@ -320,7 +320,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test remove of non-existing value
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
|
||||
|
||||
int fakeValueRemove = (int)InvokeOp("JsonRemoveValue", storeId, "Cheese");
|
||||
Assert.That(fakeValueRemove, Is.EqualTo(0));
|
||||
@@ -340,7 +340,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// TestHelpers.InMethod();
|
||||
//// TestHelpers.EnableLogging();
|
||||
//
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
|
||||
//
|
||||
// {
|
||||
// int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World");
|
||||
@@ -372,7 +372,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// TestHelpers.InMethod();
|
||||
//// TestHelpers.EnableLogging();
|
||||
//
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
|
||||
//
|
||||
// {
|
||||
// int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World");
|
||||
@@ -437,7 +437,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }");
|
||||
|
||||
{
|
||||
int result = (int)InvokeOp("JsonGetNodeType", storeId, ".");
|
||||
@@ -509,7 +509,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -520,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing periods with delineation
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -533,7 +533,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced ] without delineation. Expecting failure
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun]Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -544,7 +544,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced [ without delineation. Expecting failure
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -555,7 +555,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced [] without delineation. Expecting failure
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[]Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -566,7 +566,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced ] with delineation
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun]Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -577,7 +577,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced [ with delineation
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -588,7 +588,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing empty balanced [] with delineation
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[]Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -600,7 +600,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// // Commented out as this currently unexpectedly fails.
|
||||
// // Test setting a key containing brackets around an integer with delineation
|
||||
// {
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
//
|
||||
// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times");
|
||||
// Assert.That(result, Is.EqualTo(1));
|
||||
@@ -610,10 +610,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// }
|
||||
|
||||
// *** Test {} ***
|
||||
|
||||
|
||||
// Test setting a key containing unbalanced } without delineation. Expecting failure (?)
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun}Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -624,7 +624,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced { without delineation. Expecting failure (?)
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun{Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -636,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
// // Commented out as this currently unexpectedly fails.
|
||||
// // Test setting a key containing unbalanced }
|
||||
// {
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
//
|
||||
// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times");
|
||||
// Assert.That(result, Is.EqualTo(0));
|
||||
@@ -644,7 +644,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing unbalanced { with delineation
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -655,7 +655,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting a key containing balanced {} with delineation. This should fail.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Filled}Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -666,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting to location that does not exist. This should fail.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -691,7 +691,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Single quoted token case
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -702,7 +702,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Sub-tree case
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
@@ -713,7 +713,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// If setting single strings in JsonSetValueJson, these must be single quoted tokens, not bare strings.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
// Test setting to location that does not exist. This should fail.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
@@ -757,7 +757,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||
|
||||
{
|
||||
string notecardName = "nc1";
|
||||
@@ -820,14 +820,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
|
||||
m_scene.AddSceneObject(so);
|
||||
|
||||
UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||
UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
|
||||
|
||||
// Write notecard
|
||||
InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "", notecardName);
|
||||
|
||||
{
|
||||
// Read notecard
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
@@ -837,10 +837,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
{
|
||||
// Read notecard to new single component path
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
|
||||
@@ -850,7 +850,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
{
|
||||
// Read notecard to new multi-component path. This should not work.
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
@@ -863,7 +863,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
{
|
||||
// Read notecard to existing multi-component path. This should work
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
@@ -876,7 +876,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
||||
|
||||
{
|
||||
// Read notecard to invalid path. This should not work.
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
|
||||
UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
|
||||
UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
|
||||
Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user