aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting/JsonStore
diff options
context:
space:
mode:
authoronefang2019-05-19 21:24:15 +1000
committeronefang2019-05-19 21:24:15 +1000
commit5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch)
treea9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/OptionalModules/Scripting/JsonStore
parentAdd a build script. (diff)
downloadopensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2
opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs130
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs78
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs114
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs80
5 files changed, 207 insertions, 203 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
index c38bb3e..9343aab 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStore.cs
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) Contributors 2 * Copyright (c) Contributors
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
@@ -67,7 +67,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
67 67
68 protected List<TakeValueCallbackClass> m_TakeStore; 68 protected List<TakeValueCallbackClass> m_TakeStore;
69 protected List<TakeValueCallbackClass> m_ReadStore; 69 protected List<TakeValueCallbackClass> m_ReadStore;
70 70
71 // add separators for quoted paths and array references 71 // add separators for quoted paths and array references
72 protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])"); 72 protected static Regex m_ParsePassOne = new Regex("({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
73 73
@@ -98,10 +98,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
98 /// </summary> 98 /// </summary>
99 // ----------------------------------------------------------------- 99 // -----------------------------------------------------------------
100 public int StringSpace { get; set; } 100 public int StringSpace { get; set; }
101 101
102 // ----------------------------------------------------------------- 102 // -----------------------------------------------------------------
103 /// <summary> 103 /// <summary>
104 /// 104 ///
105 /// </summary> 105 /// </summary>
106 // ----------------------------------------------------------------- 106 // -----------------------------------------------------------------
107 public static bool CanonicalPathExpression(string ipath, out string opath) 107 public static bool CanonicalPathExpression(string ipath, out string opath)
@@ -116,13 +116,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
116 opath = PathExpressionToKey(path); 116 opath = PathExpressionToKey(path);
117 return true; 117 return true;
118 } 118 }
119 119
120 // ----------------------------------------------------------------- 120 // -----------------------------------------------------------------
121 /// <summary> 121 /// <summary>
122 /// 122 ///
123 /// </summary> 123 /// </summary>
124 // ----------------------------------------------------------------- 124 // -----------------------------------------------------------------
125 public JsonStore() 125 public JsonStore()
126 { 126 {
127 StringSpace = 0; 127 StringSpace = 0;
128 m_TakeStore = new List<TakeValueCallbackClass>(); 128 m_TakeStore = new List<TakeValueCallbackClass>();
@@ -132,17 +132,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
132 public JsonStore(string value) : this() 132 public JsonStore(string value) : this()
133 { 133 {
134 // This is going to throw an exception if the value is not 134 // This is going to throw an exception if the value is not
135 // a valid JSON chunk. Calling routines should catch the 135 // a valid JSON chunk. Calling routines should catch the
136 // exception and handle it appropriately 136 // exception and handle it appropriately
137 if (String.IsNullOrEmpty(value)) 137 if (String.IsNullOrEmpty(value))
138 ValueStore = new OSDMap(); 138 ValueStore = new OSDMap();
139 else 139 else
140 ValueStore = OSDParser.DeserializeJson(value); 140 ValueStore = OSDParser.DeserializeJson(value);
141 } 141 }
142 142
143 // ----------------------------------------------------------------- 143 // -----------------------------------------------------------------
144 /// <summary> 144 /// <summary>
145 /// 145 ///
146 /// </summary> 146 /// </summary>
147 // ----------------------------------------------------------------- 147 // -----------------------------------------------------------------
148 public JsonStoreNodeType GetNodeType(string expr) 148 public JsonStoreNodeType GetNodeType(string expr)
@@ -150,27 +150,27 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
150 Stack<string> path; 150 Stack<string> path;
151 if (! ParsePathExpression(expr,out path)) 151 if (! ParsePathExpression(expr,out path))
152 return JsonStoreNodeType.Undefined; 152 return JsonStoreNodeType.Undefined;
153 153
154 OSD result = ProcessPathExpression(ValueStore,path); 154 OSD result = ProcessPathExpression(ValueStore,path);
155 155
156 if (result == null) 156 if (result == null)
157 return JsonStoreNodeType.Undefined; 157 return JsonStoreNodeType.Undefined;
158 158
159 if (result is OSDMap) 159 if (result is OSDMap)
160 return JsonStoreNodeType.Object; 160 return JsonStoreNodeType.Object;
161 161
162 if (result is OSDArray) 162 if (result is OSDArray)
163 return JsonStoreNodeType.Array; 163 return JsonStoreNodeType.Array;
164 164
165 if (OSDBaseType(result.Type)) 165 if (OSDBaseType(result.Type))
166 return JsonStoreNodeType.Value; 166 return JsonStoreNodeType.Value;
167 167
168 return JsonStoreNodeType.Undefined; 168 return JsonStoreNodeType.Undefined;
169 } 169 }
170 170
171 // ----------------------------------------------------------------- 171 // -----------------------------------------------------------------
172 /// <summary> 172 /// <summary>
173 /// 173 ///
174 /// </summary> 174 /// </summary>
175 // ----------------------------------------------------------------- 175 // -----------------------------------------------------------------
176 public JsonStoreValueType GetValueType(string expr) 176 public JsonStoreValueType GetValueType(string expr)
@@ -178,18 +178,18 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
178 Stack<string> path; 178 Stack<string> path;
179 if (! ParsePathExpression(expr,out path)) 179 if (! ParsePathExpression(expr,out path))
180 return JsonStoreValueType.Undefined; 180 return JsonStoreValueType.Undefined;
181 181
182 OSD result = ProcessPathExpression(ValueStore,path); 182 OSD result = ProcessPathExpression(ValueStore,path);
183 183
184 if (result == null) 184 if (result == null)
185 return JsonStoreValueType.Undefined; 185 return JsonStoreValueType.Undefined;
186 186
187 if (result is OSDMap) 187 if (result is OSDMap)
188 return JsonStoreValueType.Undefined; 188 return JsonStoreValueType.Undefined;
189 189
190 if (result is OSDArray) 190 if (result is OSDArray)
191 return JsonStoreValueType.Undefined; 191 return JsonStoreValueType.Undefined;
192 192
193 if (result is OSDBoolean) 193 if (result is OSDBoolean)
194 return JsonStoreValueType.Boolean; 194 return JsonStoreValueType.Boolean;
195 195
@@ -204,10 +204,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
204 204
205 return JsonStoreValueType.Undefined; 205 return JsonStoreValueType.Undefined;
206 } 206 }
207 207
208 // ----------------------------------------------------------------- 208 // -----------------------------------------------------------------
209 /// <summary> 209 /// <summary>
210 /// 210 ///
211 /// </summary> 211 /// </summary>
212 // ----------------------------------------------------------------- 212 // -----------------------------------------------------------------
213 public int ArrayLength(string expr) 213 public int ArrayLength(string expr)
@@ -228,7 +228,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
228 228
229 // ----------------------------------------------------------------- 229 // -----------------------------------------------------------------
230 /// <summary> 230 /// <summary>
231 /// 231 ///
232 /// </summary> 232 /// </summary>
233 // ----------------------------------------------------------------- 233 // -----------------------------------------------------------------
234 public bool GetValue(string expr, out string value, bool useJson) 234 public bool GetValue(string expr, out string value, bool useJson)
@@ -241,23 +241,23 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
241 } 241 }
242 242
243 OSD result = ProcessPathExpression(ValueStore,path); 243 OSD result = ProcessPathExpression(ValueStore,path);
244 return ConvertOutputValue(result,out value,useJson); 244 return ConvertOutputValue(result,out value,useJson);
245 } 245 }
246 246
247 247
248 // ----------------------------------------------------------------- 248 // -----------------------------------------------------------------
249 /// <summary> 249 /// <summary>
250 /// 250 ///
251 /// </summary> 251 /// </summary>
252 // ----------------------------------------------------------------- 252 // -----------------------------------------------------------------
253 public bool RemoveValue(string expr) 253 public bool RemoveValue(string expr)
254 { 254 {
255 return SetValueFromExpression(expr,null); 255 return SetValueFromExpression(expr,null);
256 } 256 }
257 257
258 // ----------------------------------------------------------------- 258 // -----------------------------------------------------------------
259 /// <summary> 259 /// <summary>
260 /// 260 ///
261 /// </summary> 261 /// </summary>
262 // ----------------------------------------------------------------- 262 // -----------------------------------------------------------------
263 public bool SetValue(string expr, string value, bool useJson) 263 public bool SetValue(string expr, string value, bool useJson)
@@ -272,7 +272,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
272 { 272 {
273 // There doesn't appear to be a good way to determine if the 273 // There doesn't appear to be a good way to determine if the
274 // value is valid Json other than to let the parser crash 274 // value is valid Json other than to let the parser crash
275 try 275 try
276 { 276 {
277 ovalue = OSDParser.DeserializeJson(value); 277 ovalue = OSDParser.DeserializeJson(value);
278 } 278 }
@@ -292,13 +292,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
292 { 292 {
293 ovalue = new OSDString(value); 293 ovalue = new OSDString(value);
294 } 294 }
295 295
296 return SetValueFromExpression(expr,ovalue); 296 return SetValueFromExpression(expr,ovalue);
297 } 297 }
298 298
299 // ----------------------------------------------------------------- 299 // -----------------------------------------------------------------
300 /// <summary> 300 /// <summary>
301 /// 301 ///
302 /// </summary> 302 /// </summary>
303 // ----------------------------------------------------------------- 303 // -----------------------------------------------------------------
304 public bool TakeValue(string expr, bool useJson, TakeValueCallback cback) 304 public bool TakeValue(string expr, bool useJson, TakeValueCallback cback)
@@ -315,7 +315,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
315 m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); 315 m_TakeStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
316 return false; 316 return false;
317 } 317 }
318 318
319 string value = String.Empty; 319 string value = String.Empty;
320 if (! ConvertOutputValue(result,out value,useJson)) 320 if (! ConvertOutputValue(result,out value,useJson))
321 { 321 {
@@ -332,7 +332,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
332 332
333 // ----------------------------------------------------------------- 333 // -----------------------------------------------------------------
334 /// <summary> 334 /// <summary>
335 /// 335 ///
336 /// </summary> 336 /// </summary>
337 // ----------------------------------------------------------------- 337 // -----------------------------------------------------------------
338 public bool ReadValue(string expr, bool useJson, TakeValueCallback cback) 338 public bool ReadValue(string expr, bool useJson, TakeValueCallback cback)
@@ -349,7 +349,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
349 m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback)); 349 m_ReadStore.Add(new TakeValueCallbackClass(pexpr,useJson,cback));
350 return false; 350 return false;
351 } 351 }
352 352
353 string value = String.Empty; 353 string value = String.Empty;
354 if (! ConvertOutputValue(result,out value,useJson)) 354 if (! ConvertOutputValue(result,out value,useJson))
355 { 355 {
@@ -362,10 +362,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
362 362
363 return true; 363 return true;
364 } 364 }
365 365
366 // ----------------------------------------------------------------- 366 // -----------------------------------------------------------------
367 /// <summary> 367 /// <summary>
368 /// 368 ///
369 /// </summary> 369 /// </summary>
370 // ----------------------------------------------------------------- 370 // -----------------------------------------------------------------
371 protected bool SetValueFromExpression(string expr, OSD ovalue) 371 protected bool SetValueFromExpression(string expr, OSD ovalue)
@@ -447,7 +447,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
447 Match match = hmatches[0]; 447 Match match = hmatches[0];
448 GroupCollection groups = match.Groups; 448 GroupCollection groups = match.Groups;
449 string hkey = groups[1].Value; 449 string hkey = groups[1].Value;
450 450
451 if (result is OSDMap) 451 if (result is OSDMap)
452 { 452 {
453 // this is the assignment case 453 // this is the assignment case
@@ -456,7 +456,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
456 { 456 {
457 StringSpace -= ComputeSizeOf(hmap[hkey]); 457 StringSpace -= ComputeSizeOf(hmap[hkey]);
458 StringSpace += ComputeSizeOf(ovalue); 458 StringSpace += ComputeSizeOf(ovalue);
459 459
460 hmap[hkey] = ovalue; 460 hmap[hkey] = ovalue;
461 InvokeNextCallback(pexpr + pkey); 461 InvokeNextCallback(pexpr + pkey);
462 return true; 462 return true;
@@ -483,13 +483,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
483 483
484 // ----------------------------------------------------------------- 484 // -----------------------------------------------------------------
485 /// <summary> 485 /// <summary>
486 /// 486 ///
487 /// </summary> 487 /// </summary>
488 // ----------------------------------------------------------------- 488 // -----------------------------------------------------------------
489 protected bool InvokeNextCallback(string pexpr) 489 protected bool InvokeNextCallback(string pexpr)
490 { 490 {
491 // Process all of the reads that match the expression first 491 // Process all of the reads that match the expression first
492 List<TakeValueCallbackClass> reads = 492 List<TakeValueCallbackClass> reads =
493 m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); 493 m_ReadStore.FindAll(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
494 494
495 foreach (TakeValueCallbackClass readcb in reads) 495 foreach (TakeValueCallbackClass readcb in reads)
@@ -501,7 +501,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
501 // Process one take next 501 // Process one take next
502 TakeValueCallbackClass takecb = 502 TakeValueCallbackClass takecb =
503 m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); }); 503 m_TakeStore.Find(delegate(TakeValueCallbackClass tb) { return pexpr.StartsWith(tb.Path); });
504 504
505 if (takecb != null) 505 if (takecb != null)
506 { 506 {
507 m_TakeStore.Remove(takecb); 507 m_TakeStore.Remove(takecb);
@@ -525,13 +525,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
525 525
526 // add front and rear separators 526 // add front and rear separators
527 expr = "." + expr + "."; 527 expr = "." + expr + ".";
528 528
529 // add separators for quoted exprs and array references 529 // add separators for quoted exprs and array references
530 expr = m_ParsePassOne.Replace(expr,".$1.",-1,0); 530 expr = m_ParsePassOne.Replace(expr,".$1.",-1,0);
531 531
532 // add quotes to bare identifier 532 // add quotes to bare identifier
533 expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0); 533 expr = m_ParsePassThree.Replace(expr,".{$1}",-1,0);
534 534
535 // remove extra separators 535 // remove extra separators
536 expr = m_ParsePassFour.Replace(expr,".",-1,0); 536 expr = m_ParsePassFour.Replace(expr,".",-1,0);
537 537
@@ -550,7 +550,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
550 550
551 // ----------------------------------------------------------------- 551 // -----------------------------------------------------------------
552 /// <summary> 552 /// <summary>
553 /// 553 ///
554 /// </summary> 554 /// </summary>
555 /// <param>path is a stack where the top level of the path is at the bottom of the stack</param> 555 /// <param>path is a stack where the top level of the path is at the bottom of the stack</param>
556 // ----------------------------------------------------------------- 556 // -----------------------------------------------------------------
@@ -558,13 +558,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
558 { 558 {
559 if (path.Count == 0) 559 if (path.Count == 0)
560 return map; 560 return map;
561 561
562 string pkey = path.Pop(); 562 string pkey = path.Pop();
563 563
564 OSD rmap = ProcessPathExpression(map,path); 564 OSD rmap = ProcessPathExpression(map,path);
565 if (rmap == null) 565 if (rmap == null)
566 return null; 566 return null;
567 567
568 // ---------- Check for an array index ---------- 568 // ---------- Check for an array index ----------
569 MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0); 569 MatchCollection amatches = m_SimpleArrayPattern.Matches(pkey,0);
570 570
@@ -582,7 +582,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
582 GroupCollection groups = match.Groups; 582 GroupCollection groups = match.Groups;
583 string akey = groups[1].Value; 583 string akey = groups[1].Value;
584 int aval = Convert.ToInt32(akey); 584 int aval = Convert.ToInt32(akey);
585 585
586 if (aval < amap.Count) 586 if (aval < amap.Count)
587 return (OSD) amap[aval]; 587 return (OSD) amap[aval];
588 588
@@ -599,13 +599,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
599 m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey); 599 m_log.WarnFormat("[JsonStore] wrong type for key {2}, expecting {0}, got {1}",OSDType.Map,rmap.Type,pkey);
600 return null; 600 return null;
601 } 601 }
602 602
603 OSDMap hmap = rmap as OSDMap; 603 OSDMap hmap = rmap as OSDMap;
604 604
605 Match match = hmatches[0]; 605 Match match = hmatches[0];
606 GroupCollection groups = match.Groups; 606 GroupCollection groups = match.Groups;
607 string hkey = groups[1].Value; 607 string hkey = groups[1].Value;
608 608
609 if (hmap.ContainsKey(hkey)) 609 if (hmap.ContainsKey(hkey))
610 return (OSD) hmap[hkey]; 610 return (OSD) hmap[hkey];
611 611
@@ -619,13 +619,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
619 619
620 // ----------------------------------------------------------------- 620 // -----------------------------------------------------------------
621 /// <summary> 621 /// <summary>
622 /// 622 ///
623 /// </summary> 623 /// </summary>
624 // ----------------------------------------------------------------- 624 // -----------------------------------------------------------------
625 protected static bool ConvertOutputValue(OSD result, out string value, bool useJson) 625 protected static bool ConvertOutputValue(OSD result, out string value, bool useJson)
626 { 626 {
627 value = String.Empty; 627 value = String.Empty;
628 628
629 // If we couldn't process the path 629 // If we couldn't process the path
630 if (result == null) 630 if (result == null)
631 return false; 631 return false;
@@ -646,13 +646,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
646 return true; 646 return true;
647 } 647 }
648 648
649 value = "'" + result.AsString() + "'"; 649 value = "'" + result.AsString() + "'";
650 return true; 650 return true;
651 } 651 }
652 652
653 if (OSDBaseType(result.Type)) 653 if (OSDBaseType(result.Type))
654 { 654 {
655 value = result.AsString(); 655 value = result.AsString();
656 return true; 656 return true;
657 } 657 }
658 658
@@ -661,24 +661,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
661 661
662 // ----------------------------------------------------------------- 662 // -----------------------------------------------------------------
663 /// <summary> 663 /// <summary>
664 /// 664 ///
665 /// </summary> 665 /// </summary>
666 // ----------------------------------------------------------------- 666 // -----------------------------------------------------------------
667 protected static string PathExpressionToKey(Stack<string> path) 667 protected static string PathExpressionToKey(Stack<string> path)
668 { 668 {
669 if (path.Count == 0) 669 if (path.Count == 0)
670 return ""; 670 return "";
671 671
672 string pkey = ""; 672 string pkey = "";
673 foreach (string k in path) 673 foreach (string k in path)
674 pkey = (pkey == "") ? k : (k + "." + pkey); 674 pkey = (pkey == "") ? k : (k + "." + pkey);
675 675
676 return pkey; 676 return pkey;
677 } 677 }
678 678
679 // ----------------------------------------------------------------- 679 // -----------------------------------------------------------------
680 /// <summary> 680 /// <summary>
681 /// 681 ///
682 /// </summary> 682 /// </summary>
683 // ----------------------------------------------------------------- 683 // -----------------------------------------------------------------
684 protected static bool OSDBaseType(OSDType type) 684 protected static bool OSDBaseType(OSDType type)
@@ -705,7 +705,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
705 705
706 // ----------------------------------------------------------------- 706 // -----------------------------------------------------------------
707 /// <summary> 707 /// <summary>
708 /// 708 ///
709 /// </summary> 709 /// </summary>
710 // ----------------------------------------------------------------- 710 // -----------------------------------------------------------------
711 protected static int ComputeSizeOf(OSD value) 711 protected static int ComputeSizeOf(OSD value)
@@ -731,7 +731,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
731 private Scene m_scene; 731 private Scene m_scene;
732 private UUID m_objectID; 732 private UUID m_objectID;
733 733
734 protected override OSD ValueStore 734 protected override OSD ValueStore
735 { 735 {
736 get 736 get
737 { 737 {
@@ -741,7 +741,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
741 // This is bad 741 // This is bad
742 return null; 742 return null;
743 } 743 }
744 744
745 return sop.DynAttrs.TopLevelMap; 745 return sop.DynAttrs.TopLevelMap;
746 } 746 }
747 747
@@ -761,5 +761,5 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
761 StringSpace = ComputeSizeOf(ValueStore); 761 StringSpace = ComputeSizeOf(ValueStore);
762 } 762 }
763 } 763 }
764 764
765} 765}
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs
index d4b19dd..9bf9cb0 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreCommands.cs
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) Contributors 2 * Copyright (c) Contributors
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
@@ -79,7 +79,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
79 // ----------------------------------------------------------------- 79 // -----------------------------------------------------------------
80 public void Initialise(IConfigSource config) 80 public void Initialise(IConfigSource config)
81 { 81 {
82 try 82 try
83 { 83 {
84 if ((m_config = config.Configs["JsonStore"]) == null) 84 if ((m_config = config.Configs["JsonStore"]) == null)
85 { 85 {
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
127 if (m_enabled) 127 if (m_enabled)
128 { 128 {
129 m_scene = scene; 129 m_scene = scene;
130 130
131 } 131 }
132 } 132 }
133 133
@@ -143,7 +143,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
143 143
144 // ----------------------------------------------------------------- 144 // -----------------------------------------------------------------
145 /// <summary> 145 /// <summary>
146 /// Called when all modules have been added for a region. This is 146 /// Called when all modules have been added for a region. This is
147 /// where we hook up events 147 /// where we hook up events
148 /// </summary> 148 /// </summary>
149 // ----------------------------------------------------------------- 149 // -----------------------------------------------------------------
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
index 26044f0..ae8341f 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreModule.cs
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) Contributors 2 * Copyright (c) Contributors
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
83 // ----------------------------------------------------------------- 83 // -----------------------------------------------------------------
84 public void Initialise(IConfigSource config) 84 public void Initialise(IConfigSource config)
85 { 85 {
86 try 86 try
87 { 87 {
88 if ((m_config = config.Configs["JsonStore"]) == null) 88 if ((m_config = config.Configs["JsonStore"]) == null)
89 { 89 {
@@ -159,7 +159,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
159 159
160 // ----------------------------------------------------------------- 160 // -----------------------------------------------------------------
161 /// <summary> 161 /// <summary>
162 /// Called when all modules have been added for a region. This is 162 /// Called when all modules have been added for a region. This is
163 /// where we hook up events 163 /// where we hook up events
164 /// </summary> 164 /// </summary>
165 // ----------------------------------------------------------------- 165 // -----------------------------------------------------------------
@@ -184,7 +184,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
184#region SceneEvents 184#region SceneEvents
185 // ----------------------------------------------------------------- 185 // -----------------------------------------------------------------
186 /// <summary> 186 /// <summary>
187 /// 187 ///
188 /// </summary> 188 /// </summary>
189 // ----------------------------------------------------------------- 189 // -----------------------------------------------------------------
190 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) 190 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
@@ -196,10 +196,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
196 196
197#region ScriptInvocationInteface 197#region ScriptInvocationInteface
198 198
199 199
200 // ----------------------------------------------------------------- 200 // -----------------------------------------------------------------
201 /// <summary> 201 /// <summary>
202 /// 202 ///
203 /// </summary> 203 /// </summary>
204 // ----------------------------------------------------------------- 204 // -----------------------------------------------------------------
205 public JsonStoreStats GetStoreStats() 205 public JsonStoreStats GetStoreStats()
@@ -210,13 +210,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
210 { 210 {
211 stats.StoreCount = m_JsonValueStore.Count; 211 stats.StoreCount = m_JsonValueStore.Count;
212 } 212 }
213 213
214 return stats; 214 return stats;
215 } 215 }
216 216
217 // ----------------------------------------------------------------- 217 // -----------------------------------------------------------------
218 /// <summary> 218 /// <summary>
219 /// 219 ///
220 /// </summary> 220 /// </summary>
221 // ----------------------------------------------------------------- 221 // -----------------------------------------------------------------
222 public bool AttachObjectStore(UUID objectID) 222 public bool AttachObjectStore(UUID objectID)
@@ -235,17 +235,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
235 { 235 {
236 if (m_JsonValueStore.ContainsKey(objectID)) 236 if (m_JsonValueStore.ContainsKey(objectID))
237 return true; 237 return true;
238 238
239 JsonStore map = new JsonObjectStore(m_scene,objectID); 239 JsonStore map = new JsonObjectStore(m_scene,objectID);
240 m_JsonValueStore.Add(objectID,map); 240 m_JsonValueStore.Add(objectID,map);
241 } 241 }
242 242
243 return true; 243 return true;
244 } 244 }
245 245
246 // ----------------------------------------------------------------- 246 // -----------------------------------------------------------------
247 /// <summary> 247 /// <summary>
248 /// 248 ///
249 /// </summary> 249 /// </summary>
250 // ----------------------------------------------------------------- 250 // -----------------------------------------------------------------
251 public bool CreateStore(string value, ref UUID result) 251 public bool CreateStore(string value, ref UUID result)
@@ -254,12 +254,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
254 result = UUID.Random(); 254 result = UUID.Random();
255 255
256 JsonStore map = null; 256 JsonStore map = null;
257 257
258 if (! m_enabled) return false; 258 if (! m_enabled) return false;
259 259
260 260
261 try 261 try
262 { 262 {
263 map = new JsonStore(value); 263 map = new JsonStore(value);
264 } 264 }
265 catch (Exception) 265 catch (Exception)
@@ -270,13 +270,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
270 270
271 lock (m_JsonValueStore) 271 lock (m_JsonValueStore)
272 m_JsonValueStore.Add(result,map); 272 m_JsonValueStore.Add(result,map);
273 273
274 return true; 274 return true;
275 } 275 }
276 276
277 // ----------------------------------------------------------------- 277 // -----------------------------------------------------------------
278 /// <summary> 278 /// <summary>
279 /// 279 ///
280 /// </summary> 280 /// </summary>
281 // ----------------------------------------------------------------- 281 // -----------------------------------------------------------------
282 public bool DestroyStore(UUID storeID) 282 public bool DestroyStore(UUID storeID)
@@ -289,7 +289,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
289 289
290 // ----------------------------------------------------------------- 290 // -----------------------------------------------------------------
291 /// <summary> 291 /// <summary>
292 /// 292 ///
293 /// </summary> 293 /// </summary>
294 // ----------------------------------------------------------------- 294 // -----------------------------------------------------------------
295 public bool TestStore(UUID storeID) 295 public bool TestStore(UUID storeID)
@@ -302,7 +302,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
302 302
303 // ----------------------------------------------------------------- 303 // -----------------------------------------------------------------
304 /// <summary> 304 /// <summary>
305 /// 305 ///
306 /// </summary> 306 /// </summary>
307 // ----------------------------------------------------------------- 307 // -----------------------------------------------------------------
308 public JsonStoreNodeType GetNodeType(UUID storeID, string path) 308 public JsonStoreNodeType GetNodeType(UUID storeID, string path)
@@ -318,7 +318,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
318 return JsonStoreNodeType.Undefined; 318 return JsonStoreNodeType.Undefined;
319 } 319 }
320 } 320 }
321 321
322 try 322 try
323 { 323 {
324 lock (map) 324 lock (map)
@@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
334 334
335 // ----------------------------------------------------------------- 335 // -----------------------------------------------------------------
336 /// <summary> 336 /// <summary>
337 /// 337 ///
338 /// </summary> 338 /// </summary>
339 // ----------------------------------------------------------------- 339 // -----------------------------------------------------------------
340 public JsonStoreValueType GetValueType(UUID storeID, string path) 340 public JsonStoreValueType GetValueType(UUID storeID, string path)
@@ -350,7 +350,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
350 return JsonStoreValueType.Undefined; 350 return JsonStoreValueType.Undefined;
351 } 351 }
352 } 352 }
353 353
354 try 354 try
355 { 355 {
356 lock (map) 356 lock (map)
@@ -366,7 +366,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
366 366
367 // ----------------------------------------------------------------- 367 // -----------------------------------------------------------------
368 /// <summary> 368 /// <summary>
369 /// 369 ///
370 /// </summary> 370 /// </summary>
371 // ----------------------------------------------------------------- 371 // -----------------------------------------------------------------
372 public bool SetValue(UUID storeID, string path, string value, bool useJson) 372 public bool SetValue(UUID storeID, string path, string value, bool useJson)
@@ -382,7 +382,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
382 return false; 382 return false;
383 } 383 }
384 } 384 }
385 385
386 try 386 try
387 { 387 {
388 lock (map) 388 lock (map)
@@ -393,7 +393,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
393 storeID,map.StringSpace,m_maxStringSpace); 393 storeID,map.StringSpace,m_maxStringSpace);
394 return false; 394 return false;
395 } 395 }
396 396
397 return map.SetValue(path,value,useJson); 397 return map.SetValue(path,value,useJson);
398 } 398 }
399 } 399 }
@@ -404,10 +404,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
404 404
405 return false; 405 return false;
406 } 406 }
407 407
408 // ----------------------------------------------------------------- 408 // -----------------------------------------------------------------
409 /// <summary> 409 /// <summary>
410 /// 410 ///
411 /// </summary> 411 /// </summary>
412 // ----------------------------------------------------------------- 412 // -----------------------------------------------------------------
413 public bool RemoveValue(UUID storeID, string path) 413 public bool RemoveValue(UUID storeID, string path)
@@ -423,7 +423,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
423 return false; 423 return false;
424 } 424 }
425 } 425 }
426 426
427 try 427 try
428 { 428 {
429 lock (map) 429 lock (map)
@@ -436,10 +436,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
436 436
437 return false; 437 return false;
438 } 438 }
439 439
440 // ----------------------------------------------------------------- 440 // -----------------------------------------------------------------
441 /// <summary> 441 /// <summary>
442 /// 442 ///
443 /// </summary> 443 /// </summary>
444 // ----------------------------------------------------------------- 444 // -----------------------------------------------------------------
445 public int GetArrayLength(UUID storeID, string path) 445 public int GetArrayLength(UUID storeID, string path)
@@ -464,19 +464,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
464 { 464 {
465 m_log.Error("[JsonStore]: unable to retrieve value", e); 465 m_log.Error("[JsonStore]: unable to retrieve value", e);
466 } 466 }
467 467
468 return -1; 468 return -1;
469 } 469 }
470 470
471 // ----------------------------------------------------------------- 471 // -----------------------------------------------------------------
472 /// <summary> 472 /// <summary>
473 /// 473 ///
474 /// </summary> 474 /// </summary>
475 // ----------------------------------------------------------------- 475 // -----------------------------------------------------------------
476 public bool GetValue(UUID storeID, string path, bool useJson, out string value) 476 public bool GetValue(UUID storeID, string path, bool useJson, out string value)
477 { 477 {
478 value = String.Empty; 478 value = String.Empty;
479 479
480 if (! m_enabled) return false; 480 if (! m_enabled) return false;
481 481
482 JsonStore map = null; 482 JsonStore map = null;
@@ -497,13 +497,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
497 { 497 {
498 m_log.Error("[JsonStore]: unable to retrieve value", e); 498 m_log.Error("[JsonStore]: unable to retrieve value", e);
499 } 499 }
500 500
501 return false; 501 return false;
502 } 502 }
503 503
504 // ----------------------------------------------------------------- 504 // -----------------------------------------------------------------
505 /// <summary> 505 /// <summary>
506 /// 506 ///
507 /// </summary> 507 /// </summary>
508 // ----------------------------------------------------------------- 508 // -----------------------------------------------------------------
509 public void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback) 509 public void TakeValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
@@ -536,13 +536,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
536 { 536 {
537 m_log.Error("[JsonStore] unable to retrieve value", e); 537 m_log.Error("[JsonStore] unable to retrieve value", e);
538 } 538 }
539 539
540 cback(String.Empty); 540 cback(String.Empty);
541 } 541 }
542 542
543 // ----------------------------------------------------------------- 543 // -----------------------------------------------------------------
544 /// <summary> 544 /// <summary>
545 /// 545 ///
546 /// </summary> 546 /// </summary>
547 // ----------------------------------------------------------------- 547 // -----------------------------------------------------------------
548 public void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback) 548 public void ReadValue(UUID storeID, string path, bool useJson, TakeValueCallback cback)
@@ -575,7 +575,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
575 { 575 {
576 m_log.Error("[JsonStore]: unable to retrieve value", e); 576 m_log.Error("[JsonStore]: unable to retrieve value", e);
577 } 577 }
578 578
579 cback(String.Empty); 579 cback(String.Empty);
580 } 580 }
581 581
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
index 01de21c..fe8d962 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/JsonStoreScriptModule.cs
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) Contributors 2 * Copyright (c) Contributors
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
@@ -83,7 +83,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
83 // ----------------------------------------------------------------- 83 // -----------------------------------------------------------------
84 public void Initialise(IConfigSource config) 84 public void Initialise(IConfigSource config)
85 { 85 {
86 try 86 try
87 { 87 {
88 if ((m_config = config.Configs["JsonStore"]) == null) 88 if ((m_config = config.Configs["JsonStore"]) == null)
89 { 89 {
@@ -166,7 +166,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
166 166
167 // ----------------------------------------------------------------- 167 // -----------------------------------------------------------------
168 /// <summary> 168 /// <summary>
169 /// Called when all modules have been added for a region. This is 169 /// Called when all modules have been added for a region. This is
170 /// where we hook up events 170 /// where we hook up events
171 /// </summary> 171 /// </summary>
172 // ----------------------------------------------------------------- 172 // -----------------------------------------------------------------
@@ -251,7 +251,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
251#region ScriptInvocationInteface 251#region ScriptInvocationInteface
252 // ----------------------------------------------------------------- 252 // -----------------------------------------------------------------
253 /// <summary> 253 /// <summary>
254 /// 254 ///
255 /// </summary> 255 /// </summary>
256 // ----------------------------------------------------------------- 256 // -----------------------------------------------------------------
257 [ScriptInvocation] 257 [ScriptInvocation]
@@ -260,13 +260,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
260 UUID uuid = UUID.Zero; 260 UUID uuid = UUID.Zero;
261 if (! m_store.AttachObjectStore(hostID)) 261 if (! m_store.AttachObjectStore(hostID))
262 GenerateRuntimeError("Failed to create Json store"); 262 GenerateRuntimeError("Failed to create Json store");
263 263
264 return hostID; 264 return hostID;
265 } 265 }
266 266
267 // ----------------------------------------------------------------- 267 // -----------------------------------------------------------------
268 /// <summary> 268 /// <summary>
269 /// 269 ///
270 /// </summary> 270 /// </summary>
271 // ----------------------------------------------------------------- 271 // -----------------------------------------------------------------
272 [ScriptInvocation] 272 [ScriptInvocation]
@@ -275,12 +275,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
275 UUID uuid = UUID.Zero; 275 UUID uuid = UUID.Zero;
276 if (! m_store.CreateStore(value, ref uuid)) 276 if (! m_store.CreateStore(value, ref uuid))
277 GenerateRuntimeError("Failed to create Json store"); 277 GenerateRuntimeError("Failed to create Json store");
278 278
279 lock (m_scriptStores) 279 lock (m_scriptStores)
280 { 280 {
281 if (! m_scriptStores.ContainsKey(scriptID)) 281 if (! m_scriptStores.ContainsKey(scriptID))
282 m_scriptStores[scriptID] = new HashSet<UUID>(); 282 m_scriptStores[scriptID] = new HashSet<UUID>();
283 283
284 m_scriptStores[scriptID].Add(uuid); 284 m_scriptStores[scriptID].Add(uuid);
285 } 285 }
286 return uuid; 286 return uuid;
@@ -288,7 +288,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
288 288
289 // ----------------------------------------------------------------- 289 // -----------------------------------------------------------------
290 /// <summary> 290 /// <summary>
291 /// 291 ///
292 /// </summary> 292 /// </summary>
293 // ----------------------------------------------------------------- 293 // -----------------------------------------------------------------
294 [ScriptInvocation] 294 [ScriptInvocation]
@@ -305,7 +305,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
305 305
306 // ----------------------------------------------------------------- 306 // -----------------------------------------------------------------
307 /// <summary> 307 /// <summary>
308 /// 308 ///
309 /// </summary> 309 /// </summary>
310 // ----------------------------------------------------------------- 310 // -----------------------------------------------------------------
311 [ScriptInvocation] 311 [ScriptInvocation]
@@ -316,7 +316,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
316 316
317 // ----------------------------------------------------------------- 317 // -----------------------------------------------------------------
318 /// <summary> 318 /// <summary>
319 /// 319 ///
320 /// </summary> 320 /// </summary>
321 // ----------------------------------------------------------------- 321 // -----------------------------------------------------------------
322 [ScriptInvocation] 322 [ScriptInvocation]
@@ -330,7 +330,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
330 330
331 // ----------------------------------------------------------------- 331 // -----------------------------------------------------------------
332 /// <summary> 332 /// <summary>
333 /// 333 ///
334 /// </summary> 334 /// </summary>
335 // ----------------------------------------------------------------- 335 // -----------------------------------------------------------------
336 [ScriptInvocation] 336 [ScriptInvocation]
@@ -341,10 +341,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
341 o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier), null, "JsonStoreScriptModule.JsonReadNotecard"); 341 o => DoJsonReadNotecard(reqID, hostID, scriptID, storeID, path, notecardIdentifier), null, "JsonStoreScriptModule.JsonReadNotecard");
342 return reqID; 342 return reqID;
343 } 343 }
344 344
345 // ----------------------------------------------------------------- 345 // -----------------------------------------------------------------
346 /// <summary> 346 /// <summary>
347 /// 347 ///
348 /// </summary> 348 /// </summary>
349 // ----------------------------------------------------------------- 349 // -----------------------------------------------------------------
350 [ScriptInvocation] 350 [ScriptInvocation]
@@ -358,7 +358,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
358 358
359 // ----------------------------------------------------------------- 359 // -----------------------------------------------------------------
360 /// <summary> 360 /// <summary>
361 /// 361 ///
362 /// </summary> 362 /// </summary>
363 // ----------------------------------------------------------------- 363 // -----------------------------------------------------------------
364 [ScriptInvocation] 364 [ScriptInvocation]
@@ -366,7 +366,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
366 { 366 {
367 string ipath = ConvertList2Path(pathlist); 367 string ipath = ConvertList2Path(pathlist);
368 string opath; 368 string opath;
369 369
370 if (JsonStore.CanonicalPathExpression(ipath,out opath)) 370 if (JsonStore.CanonicalPathExpression(ipath,out opath))
371 return opath; 371 return opath;
372 372
@@ -375,10 +375,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
375 // the entire store 375 // the entire store
376 return "**INVALID**"; 376 return "**INVALID**";
377 } 377 }
378 378
379 // ----------------------------------------------------------------- 379 // -----------------------------------------------------------------
380 /// <summary> 380 /// <summary>
381 /// 381 ///
382 /// </summary> 382 /// </summary>
383 // ----------------------------------------------------------------- 383 // -----------------------------------------------------------------
384 [ScriptInvocation] 384 [ScriptInvocation]
@@ -389,7 +389,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
389 389
390 // ----------------------------------------------------------------- 390 // -----------------------------------------------------------------
391 /// <summary> 391 /// <summary>
392 /// 392 ///
393 /// </summary> 393 /// </summary>
394 // ----------------------------------------------------------------- 394 // -----------------------------------------------------------------
395 [ScriptInvocation] 395 [ScriptInvocation]
@@ -400,7 +400,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
400 400
401 // ----------------------------------------------------------------- 401 // -----------------------------------------------------------------
402 /// <summary> 402 /// <summary>
403 /// 403 ///
404 /// </summary> 404 /// </summary>
405 // ----------------------------------------------------------------- 405 // -----------------------------------------------------------------
406 [ScriptInvocation] 406 [ScriptInvocation]
@@ -417,7 +417,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
417 417
418 // ----------------------------------------------------------------- 418 // -----------------------------------------------------------------
419 /// <summary> 419 /// <summary>
420 /// 420 ///
421 /// </summary> 421 /// </summary>
422 // ----------------------------------------------------------------- 422 // -----------------------------------------------------------------
423 [ScriptInvocation] 423 [ScriptInvocation]
@@ -425,10 +425,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
425 { 425 {
426 return m_store.RemoveValue(storeID,path) ? 1 : 0; 426 return m_store.RemoveValue(storeID,path) ? 1 : 0;
427 } 427 }
428 428
429 // ----------------------------------------------------------------- 429 // -----------------------------------------------------------------
430 /// <summary> 430 /// <summary>
431 /// 431 ///
432 /// </summary> 432 /// </summary>
433 // ----------------------------------------------------------------- 433 // -----------------------------------------------------------------
434 [ScriptInvocation] 434 [ScriptInvocation]
@@ -436,10 +436,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
436 { 436 {
437 return m_store.GetArrayLength(storeID,path); 437 return m_store.GetArrayLength(storeID,path);
438 } 438 }
439 439
440 // ----------------------------------------------------------------- 440 // -----------------------------------------------------------------
441 /// <summary> 441 /// <summary>
442 /// 442 ///
443 /// </summary> 443 /// </summary>
444 // ----------------------------------------------------------------- 444 // -----------------------------------------------------------------
445 [ScriptInvocation] 445 [ScriptInvocation]
@@ -457,10 +457,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
457 m_store.GetValue(storeID,path,true, out value); 457 m_store.GetValue(storeID,path,true, out value);
458 return value; 458 return value;
459 } 459 }
460 460
461 // ----------------------------------------------------------------- 461 // -----------------------------------------------------------------
462 /// <summary> 462 /// <summary>
463 /// 463 ///
464 /// </summary> 464 /// </summary>
465 // ----------------------------------------------------------------- 465 // -----------------------------------------------------------------
466 [ScriptInvocation] 466 [ScriptInvocation]
@@ -480,10 +480,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
480 o => DoJsonTakeValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonTakeValueJson"); 480 o => DoJsonTakeValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonTakeValueJson");
481 return reqID; 481 return reqID;
482 } 482 }
483 483
484 // ----------------------------------------------------------------- 484 // -----------------------------------------------------------------
485 /// <summary> 485 /// <summary>
486 /// 486 ///
487 /// </summary> 487 /// </summary>
488 // ----------------------------------------------------------------- 488 // -----------------------------------------------------------------
489 [ScriptInvocation] 489 [ScriptInvocation]
@@ -503,12 +503,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
503 o => DoJsonReadValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonReadValueJson"); 503 o => DoJsonReadValue(scriptID,reqID,storeID,path,true), null, "JsonStoreScriptModule.DoJsonReadValueJson");
504 return reqID; 504 return reqID;
505 } 505 }
506 506
507#endregion 507#endregion
508 508
509 // ----------------------------------------------------------------- 509 // -----------------------------------------------------------------
510 /// <summary> 510 /// <summary>
511 /// 511 ///
512 /// </summary> 512 /// </summary>
513 // ----------------------------------------------------------------- 513 // -----------------------------------------------------------------
514 protected void GenerateRuntimeError(string msg) 514 protected void GenerateRuntimeError(string msg)
@@ -516,10 +516,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
516 m_log.InfoFormat("[JsonStore] runtime error: {0}",msg); 516 m_log.InfoFormat("[JsonStore] runtime error: {0}",msg);
517 throw new Exception("JsonStore Runtime Error: " + msg); 517 throw new Exception("JsonStore Runtime Error: " + msg);
518 } 518 }
519 519
520 // ----------------------------------------------------------------- 520 // -----------------------------------------------------------------
521 /// <summary> 521 /// <summary>
522 /// 522 ///
523 /// </summary> 523 /// </summary>
524 // ----------------------------------------------------------------- 524 // -----------------------------------------------------------------
525 protected void DispatchValue(UUID scriptID, UUID reqID, string value) 525 protected void DispatchValue(UUID scriptID, UUID reqID, string value)
@@ -529,7 +529,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
529 529
530 // ----------------------------------------------------------------- 530 // -----------------------------------------------------------------
531 /// <summary> 531 /// <summary>
532 /// 532 ///
533 /// </summary> 533 /// </summary>
534 // ----------------------------------------------------------------- 534 // -----------------------------------------------------------------
535 private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) 535 private void DoJsonTakeValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
@@ -543,14 +543,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
543 { 543 {
544 m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString()); 544 m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString());
545 } 545 }
546 546
547 DispatchValue(scriptID,reqID,String.Empty); 547 DispatchValue(scriptID,reqID,String.Empty);
548 } 548 }
549 549
550 550
551 // ----------------------------------------------------------------- 551 // -----------------------------------------------------------------
552 /// <summary> 552 /// <summary>
553 /// 553 ///
554 /// </summary> 554 /// </summary>
555 // ----------------------------------------------------------------- 555 // -----------------------------------------------------------------
556 private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson) 556 private void DoJsonReadValue(UUID scriptID, UUID reqID, UUID storeID, string path, bool useJson)
@@ -564,13 +564,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
564 { 564 {
565 m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString()); 565 m_log.InfoFormat("[JsonStoreScripts]: unable to retrieve value; {0}",e.ToString());
566 } 566 }
567 567
568 DispatchValue(scriptID,reqID,String.Empty); 568 DispatchValue(scriptID,reqID,String.Empty);
569 } 569 }
570 570
571 // ----------------------------------------------------------------- 571 // -----------------------------------------------------------------
572 /// <summary> 572 /// <summary>
573 /// 573 ///
574 /// </summary> 574 /// </summary>
575 // ----------------------------------------------------------------- 575 // -----------------------------------------------------------------
576 private void DoJsonReadNotecard( 576 private void DoJsonReadNotecard(
@@ -580,7 +580,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
580 580
581 if (!UUID.TryParse(notecardIdentifier, out assetID)) 581 if (!UUID.TryParse(notecardIdentifier, out assetID))
582 { 582 {
583 SceneObjectPart part = m_scene.GetSceneObjectPart(hostID); 583 SceneObjectPart part = m_scene.GetSceneObjectPart(hostID);
584 assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard); 584 assetID = ScriptUtils.GetAssetIdFromItemName(part, notecardIdentifier, (int)AssetType.Notecard);
585 } 585 }
586 586
@@ -590,10 +590,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
590 590
591 if (a.Type != (sbyte)AssetType.Notecard) 591 if (a.Type != (sbyte)AssetType.Notecard)
592 GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID)); 592 GenerateRuntimeError(String.Format("Invalid notecard asset {0}", assetID));
593 593
594 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID); 594 m_log.DebugFormat("[JsonStoreScripts]: read notecard in context {0}",storeID);
595 595
596 try 596 try
597 { 597 {
598 string jsondata = SLUtil.ParseNotecardToString(a.Data); 598 string jsondata = SLUtil.ParseNotecardToString(a.Data);
599 int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0; 599 int result = m_store.SetValue(storeID, path, jsondata,true) ? 1 : 0;
@@ -612,10 +612,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
612 GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID)); 612 GenerateRuntimeError(String.Format("Json parsing failed for {0}", assetID));
613 m_comms.DispatchReply(scriptID, 0, "", reqID.ToString()); 613 m_comms.DispatchReply(scriptID, 0, "", reqID.ToString());
614 } 614 }
615 615
616 // ----------------------------------------------------------------- 616 // -----------------------------------------------------------------
617 /// <summary> 617 /// <summary>
618 /// 618 ///
619 /// </summary> 619 /// </summary>
620 // ----------------------------------------------------------------- 620 // -----------------------------------------------------------------
621 private void DoJsonWriteNotecard(UUID reqID, UUID hostID, UUID scriptID, UUID storeID, string path, string name) 621 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
626 m_comms.DispatchReply(scriptID,0,UUID.Zero.ToString(),reqID.ToString()); 626 m_comms.DispatchReply(scriptID,0,UUID.Zero.ToString(),reqID.ToString());
627 return; 627 return;
628 } 628 }
629 629
630 SceneObjectPart host = m_scene.GetSceneObjectPart(hostID); 630 SceneObjectPart host = m_scene.GetSceneObjectPart(hostID);
631 631
632 // Create new asset 632 // Create new asset
633 UUID assetID = UUID.Random(); 633 UUID assetID = UUID.Random();
634 AssetBase asset = new AssetBase(assetID, name, (sbyte)AssetType.Notecard, host.OwnerID.ToString()); 634 AssetBase asset = new AssetBase(assetID, name, (sbyte)AssetType.Notecard, host.OwnerID.ToString());
@@ -665,7 +665,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
665 taskItem.AssetID = asset.FullID; 665 taskItem.AssetID = asset.FullID;
666 666
667 host.Inventory.AddInventoryItem(taskItem, false); 667 host.Inventory.AddInventoryItem(taskItem, false);
668 668 host.ParentGroup.InvalidateEffectivePerms();
669 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString()); 669 m_comms.DispatchReply(scriptID,1,assetID.ToString(),reqID.ToString());
670 } 670 }
671 671
@@ -681,7 +681,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
681 for (int i = 0; i < pathlist.Length; i++) 681 for (int i = 0; i < pathlist.Length; i++)
682 { 682 {
683 string token = ""; 683 string token = "";
684 684
685 if (pathlist[i] is string) 685 if (pathlist[i] is string)
686 { 686 {
687 token = pathlist[i].ToString(); 687 token = pathlist[i].ToString();
@@ -699,16 +699,16 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
699 { 699 {
700 token = "." + pathlist[i].ToString() + "."; 700 token = "." + pathlist[i].ToString() + ".";
701 } 701 }
702 702
703 path += token + "."; 703 path += token + ".";
704 } 704 }
705 705
706 return path; 706 return path;
707 } 707 }
708 708
709 // ----------------------------------------------------------------- 709 // -----------------------------------------------------------------
710 /// <summary> 710 /// <summary>
711 /// 711 ///
712 /// </summary> 712 /// </summary>
713 // ----------------------------------------------------------------- 713 // -----------------------------------------------------------------
714 private void DoJsonRezObject(UUID hostID, UUID scriptID, UUID reqID, string name, Vector3 pos, Vector3 vel, Quaternion rot, string param) 714 private void DoJsonRezObject(UUID hostID, UUID scriptID, UUID reqID, string name, Vector3 pos, Vector3 vel, Quaternion rot, string param)
@@ -728,6 +728,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
728 728
729 // hpos = host.RootPart.GetWorldPosition() 729 // hpos = host.RootPart.GetWorldPosition()
730 // float dist = (float)llVecDist(hpos, pos); 730 // float dist = (float)llVecDist(hpos, pos);
731 // if (dist > m_ScriptDistanceFactor * 10.0f)
732 // return;
731 733
732 TaskInventoryItem item = host.RootPart.Inventory.GetInventoryItem(name); 734 TaskInventoryItem item = host.RootPart.Inventory.GetInventoryItem(name);
733 if (item == null) 735 if (item == null)
@@ -744,8 +746,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
744 746
745 List<SceneObjectGroup> objlist; 747 List<SceneObjectGroup> objlist;
746 List<Vector3> veclist; 748 List<Vector3> veclist;
747 749
748 bool success = host.RootPart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist); 750 Vector3 bbox = new Vector3();
751 float offsetHeight;
752 bool success = host.RootPart.Inventory.GetRezReadySceneObjects(item, out objlist, out veclist, out bbox, out offsetHeight);
749 if (! success) 753 if (! success)
750 { 754 {
751 GenerateRuntimeError("Failed to create object"); 755 GenerateRuntimeError("Failed to create object");
@@ -779,7 +783,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
779 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint; 783 group.RootPart.Shape.LastAttachPoint = (byte)group.AttachmentPoint;
780 } 784 }
781 785
782 group.FromPartID = host.RootPart.UUID; 786 group.RezzerID = host.RootPart.UUID;
783 m_scene.AddNewSceneObject(group, true, curpos, rot, vel); 787 m_scene.AddNewSceneObject(group, true, curpos, rot, vel);
784 788
785 UUID storeID = group.UUID; 789 UUID storeID = group.UUID;
@@ -797,7 +801,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
797 801
798 group.ScheduleGroupForFullUpdate(); 802 group.ScheduleGroupForFullUpdate();
799 803
800 // send the reply back to the host object, use the integer param to indicate the number 804 // send the reply back to the host object, use the integer param to indicate the number
801 // of remaining objects 805 // of remaining objects
802 m_comms.DispatchReply(scriptID, objlist.Count-i-1, group.RootPart.UUID.ToString(), reqID.ToString()); 806 m_comms.DispatchReply(scriptID, objlist.Count-i-1, group.RootPart.UUID.ToString(), reqID.ToString());
803 } 807 }
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 99a7076..77ee785 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -180,7 +180,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
180 TestHelpers.InMethod(); 180 TestHelpers.InMethod();
181// TestHelpers.EnableLogging(); 181// TestHelpers.EnableLogging();
182 182
183 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); 183 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
184 184
185 { 185 {
186 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello.World"); 186 string value = (string)InvokeOp("JsonGetValue", storeId, "Hello.World");
@@ -213,7 +213,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
213 TestHelpers.InMethod(); 213 TestHelpers.InMethod();
214// TestHelpers.EnableLogging(); 214// TestHelpers.EnableLogging();
215 215
216 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }"); 216 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Two' } }");
217 217
218 { 218 {
219 string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World"); 219 string value = (string)InvokeOp("JsonGetJson", storeId, "Hello.World");
@@ -246,11 +246,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
246// TestHelpers.InMethod(); 246// TestHelpers.InMethod();
247//// TestHelpers.EnableLogging(); 247//// TestHelpers.EnableLogging();
248// 248//
249// UUID storeId 249// UUID storeId
250// = (UUID)m_smcm.InvokeOperation( 250// = (UUID)m_smcm.InvokeOperation(
251// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" }); 251// UUID.Zero, UUID.Zero, "JsonCreateStore", new object[] { "{ 'Hello' : 'World' }" });
252// 252//
253// string value 253// string value
254// = (string)m_smcm.InvokeOperation( 254// = (string)m_smcm.InvokeOperation(
255// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" }); 255// UUID.Zero, UUID.Zero, "JsonTakeValue", new object[] { storeId, "Hello" });
256// 256//
@@ -271,7 +271,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
271 271
272 // Test remove of node in object pointing to a string 272 // Test remove of node in object pointing to a string
273 { 273 {
274 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); 274 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
275 275
276 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); 276 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
277 Assert.That(returnValue, Is.EqualTo(1)); 277 Assert.That(returnValue, Is.EqualTo(1));
@@ -285,7 +285,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
285 285
286 // Test remove of node in object pointing to another object 286 // Test remove of node in object pointing to another object
287 { 287 {
288 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Wally' } }"); 288 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'Wally' } }");
289 289
290 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello"); 290 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
291 Assert.That(returnValue, Is.EqualTo(1)); 291 Assert.That(returnValue, Is.EqualTo(1));
@@ -299,7 +299,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
299 299
300 // Test remove of node in an array 300 // Test remove of node in an array
301 { 301 {
302 UUID storeId 302 UUID storeId
303 = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : [ 'value1', 'value2' ] }"); 303 = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : [ 'value1', 'value2' ] }");
304 304
305 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]"); 305 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
@@ -320,7 +320,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
320 320
321 // Test remove of non-existing value 321 // Test remove of non-existing value
322 { 322 {
323 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); 323 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }");
324 324
325 int fakeValueRemove = (int)InvokeOp("JsonRemoveValue", storeId, "Cheese"); 325 int fakeValueRemove = (int)InvokeOp("JsonRemoveValue", storeId, "Cheese");
326 Assert.That(fakeValueRemove, Is.EqualTo(0)); 326 Assert.That(fakeValueRemove, Is.EqualTo(0));
@@ -340,7 +340,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
340// TestHelpers.InMethod(); 340// TestHelpers.InMethod();
341//// TestHelpers.EnableLogging(); 341//// TestHelpers.EnableLogging();
342// 342//
343// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); 343// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
344// 344//
345// { 345// {
346// int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World"); 346// int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World");
@@ -372,7 +372,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
372// TestHelpers.InMethod(); 372// TestHelpers.InMethod();
373//// TestHelpers.EnableLogging(); 373//// TestHelpers.EnableLogging();
374// 374//
375// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); 375// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }");
376// 376//
377// { 377// {
378// int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World"); 378// int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World");
@@ -437,7 +437,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
437 TestHelpers.InMethod(); 437 TestHelpers.InMethod();
438// TestHelpers.EnableLogging(); 438// TestHelpers.EnableLogging();
439 439
440 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); 440 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }");
441 441
442 { 442 {
443 int result = (int)InvokeOp("JsonGetNodeType", storeId, "."); 443 int result = (int)InvokeOp("JsonGetNodeType", storeId, ".");
@@ -509,7 +509,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
509// TestHelpers.EnableLogging(); 509// TestHelpers.EnableLogging();
510 510
511 { 511 {
512 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 512 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
513 513
514 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); 514 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
515 Assert.That(result, Is.EqualTo(1)); 515 Assert.That(result, Is.EqualTo(1));
@@ -520,7 +520,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
520 520
521 // Test setting a key containing periods with delineation 521 // Test setting a key containing periods with delineation
522 { 522 {
523 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 523 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
524 524
525 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times"); 525 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times");
526 Assert.That(result, Is.EqualTo(1)); 526 Assert.That(result, Is.EqualTo(1));
@@ -533,7 +533,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
533 533
534 // Test setting a key containing unbalanced ] without delineation. Expecting failure 534 // Test setting a key containing unbalanced ] without delineation. Expecting failure
535 { 535 {
536 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 536 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
537 537
538 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun]Circus", "Times"); 538 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun]Circus", "Times");
539 Assert.That(result, Is.EqualTo(0)); 539 Assert.That(result, Is.EqualTo(0));
@@ -544,7 +544,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
544 544
545 // Test setting a key containing unbalanced [ without delineation. Expecting failure 545 // Test setting a key containing unbalanced [ without delineation. Expecting failure
546 { 546 {
547 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 547 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
548 548
549 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[Circus", "Times"); 549 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[Circus", "Times");
550 Assert.That(result, Is.EqualTo(0)); 550 Assert.That(result, Is.EqualTo(0));
@@ -555,7 +555,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
555 555
556 // Test setting a key containing unbalanced [] without delineation. Expecting failure 556 // Test setting a key containing unbalanced [] without delineation. Expecting failure
557 { 557 {
558 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 558 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
559 559
560 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[]Circus", "Times"); 560 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun[]Circus", "Times");
561 Assert.That(result, Is.EqualTo(0)); 561 Assert.That(result, Is.EqualTo(0));
@@ -566,7 +566,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
566 566
567 // Test setting a key containing unbalanced ] with delineation 567 // Test setting a key containing unbalanced ] with delineation
568 { 568 {
569 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 569 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
570 570
571 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun]Circus}", "Times"); 571 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun]Circus}", "Times");
572 Assert.That(result, Is.EqualTo(1)); 572 Assert.That(result, Is.EqualTo(1));
@@ -577,7 +577,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
577 577
578 // Test setting a key containing unbalanced [ with delineation 578 // Test setting a key containing unbalanced [ with delineation
579 { 579 {
580 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 580 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
581 581
582 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[Circus}", "Times"); 582 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[Circus}", "Times");
583 Assert.That(result, Is.EqualTo(1)); 583 Assert.That(result, Is.EqualTo(1));
@@ -588,7 +588,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
588 588
589 // Test setting a key containing empty balanced [] with delineation 589 // Test setting a key containing empty balanced [] with delineation
590 { 590 {
591 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 591 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
592 592
593 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[]Circus}", "Times"); 593 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[]Circus}", "Times");
594 Assert.That(result, Is.EqualTo(1)); 594 Assert.That(result, Is.EqualTo(1));
@@ -600,7 +600,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
600// // Commented out as this currently unexpectedly fails. 600// // Commented out as this currently unexpectedly fails.
601// // Test setting a key containing brackets around an integer with delineation 601// // Test setting a key containing brackets around an integer with delineation
602// { 602// {
603// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 603// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
604// 604//
605// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times"); 605// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times");
606// Assert.That(result, Is.EqualTo(1)); 606// Assert.That(result, Is.EqualTo(1));
@@ -610,10 +610,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
610// } 610// }
611 611
612 // *** Test {} *** 612 // *** Test {} ***
613 613
614 // Test setting a key containing unbalanced } without delineation. Expecting failure (?) 614 // Test setting a key containing unbalanced } without delineation. Expecting failure (?)
615 { 615 {
616 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 616 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
617 617
618 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun}Circus", "Times"); 618 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun}Circus", "Times");
619 Assert.That(result, Is.EqualTo(0)); 619 Assert.That(result, Is.EqualTo(0));
@@ -624,7 +624,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
624 624
625 // Test setting a key containing unbalanced { without delineation. Expecting failure (?) 625 // Test setting a key containing unbalanced { without delineation. Expecting failure (?)
626 { 626 {
627 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 627 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
628 628
629 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun{Circus", "Times"); 629 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun{Circus", "Times");
630 Assert.That(result, Is.EqualTo(0)); 630 Assert.That(result, Is.EqualTo(0));
@@ -636,7 +636,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
636// // Commented out as this currently unexpectedly fails. 636// // Commented out as this currently unexpectedly fails.
637// // Test setting a key containing unbalanced } 637// // Test setting a key containing unbalanced }
638// { 638// {
639// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 639// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
640// 640//
641// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times"); 641// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times");
642// Assert.That(result, Is.EqualTo(0)); 642// Assert.That(result, Is.EqualTo(0));
@@ -644,7 +644,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
644 644
645 // Test setting a key containing unbalanced { with delineation 645 // Test setting a key containing unbalanced { with delineation
646 { 646 {
647 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 647 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
648 648
649 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Circus}", "Times"); 649 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Circus}", "Times");
650 Assert.That(result, Is.EqualTo(1)); 650 Assert.That(result, Is.EqualTo(1));
@@ -655,7 +655,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
655 655
656 // Test setting a key containing balanced {} with delineation. This should fail. 656 // Test setting a key containing balanced {} with delineation. This should fail.
657 { 657 {
658 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 658 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
659 659
660 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Filled}Circus}", "Times"); 660 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Filled}Circus}", "Times");
661 Assert.That(result, Is.EqualTo(0)); 661 Assert.That(result, Is.EqualTo(0));
@@ -666,7 +666,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
666 666
667 // Test setting to location that does not exist. This should fail. 667 // Test setting to location that does not exist. This should fail.
668 { 668 {
669 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}"); 669 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
670 670
671 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times"); 671 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
672 Assert.That(result, Is.EqualTo(0)); 672 Assert.That(result, Is.EqualTo(0));
@@ -691,7 +691,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
691 691
692 // Single quoted token case 692 // Single quoted token case
693 { 693 {
694 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 694 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
695 695
696 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'"); 696 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "'Times'");
697 Assert.That(result, Is.EqualTo(1)); 697 Assert.That(result, Is.EqualTo(1));
@@ -702,7 +702,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
702 702
703 // Sub-tree case 703 // Sub-tree case
704 { 704 {
705 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 705 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
706 706
707 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }"); 707 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "{ 'Filled' : 'Times' }");
708 Assert.That(result, Is.EqualTo(1)); 708 Assert.That(result, Is.EqualTo(1));
@@ -713,7 +713,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
713 713
714 // If setting single strings in JsonSetValueJson, these must be single quoted tokens, not bare strings. 714 // If setting single strings in JsonSetValueJson, these must be single quoted tokens, not bare strings.
715 { 715 {
716 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 716 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
717 717
718 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times"); 718 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun", "Times");
719 Assert.That(result, Is.EqualTo(0)); 719 Assert.That(result, Is.EqualTo(0));
@@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
724 724
725 // Test setting to location that does not exist. This should fail. 725 // Test setting to location that does not exist. This should fail.
726 { 726 {
727 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 727 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
728 728
729 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'"); 729 int result = (int)InvokeOp("JsonSetJson", storeId, "Fun.Circus", "'Times'");
730 Assert.That(result, Is.EqualTo(0)); 730 Assert.That(result, Is.EqualTo(0));
@@ -757,7 +757,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
757 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); 757 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
758 m_scene.AddSceneObject(so); 758 m_scene.AddSceneObject(so);
759 759
760 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); 760 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
761 761
762 { 762 {
763 string notecardName = "nc1"; 763 string notecardName = "nc1";
@@ -820,14 +820,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
820 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1)); 820 SceneObjectGroup so = SceneHelpers.CreateSceneObject(1, TestHelpers.ParseTail(0x1));
821 m_scene.AddSceneObject(so); 821 m_scene.AddSceneObject(so);
822 822
823 UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }"); 823 UUID creatingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello':'World' }");
824 824
825 // Write notecard 825 // Write notecard
826 InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "", notecardName); 826 InvokeOpOnHost("JsonWriteNotecard", so.UUID, creatingStoreId, "", notecardName);
827 827
828 { 828 {
829 // Read notecard 829 // Read notecard
830 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); 830 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
831 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "", notecardName); 831 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "", notecardName);
832 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 832 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
833 833
@@ -837,10 +837,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
837 837
838 { 838 {
839 // Read notecard to new single component path 839 // Read notecard to new single component path
840 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); 840 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
841 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName); 841 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make", notecardName);
842 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 842 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
843 843
844 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello"); 844 string value = (string)InvokeOp("JsonGetValue", receivingStoreId, "Hello");
845 Assert.That(value, Is.EqualTo("")); 845 Assert.That(value, Is.EqualTo(""));
846 846
@@ -850,7 +850,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
850 850
851 { 851 {
852 // Read notecard to new multi-component path. This should not work. 852 // Read notecard to new multi-component path. This should not work.
853 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}"); 853 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{}");
854 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); 854 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
855 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 855 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
856 856
@@ -863,7 +863,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
863 863
864 { 864 {
865 // Read notecard to existing multi-component path. This should work 865 // Read notecard to existing multi-component path. This should work
866 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); 866 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
867 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName); 867 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "make.it", notecardName);
868 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 868 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
869 869
@@ -876,7 +876,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
876 876
877 { 877 {
878 // Read notecard to invalid path. This should not work. 878 // Read notecard to invalid path. This should not work.
879 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }"); 879 UUID receivingStoreId = (UUID)InvokeOp("JsonCreateStore", "{ 'make' : { 'it' : 'so' } }");
880 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName); 880 UUID readNotecardRequestId = (UUID)InvokeOpOnHost("JsonReadNotecard", so.UUID, receivingStoreId, "/", notecardName);
881 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero)); 881 Assert.That(readNotecardRequestId, Is.Not.EqualTo(UUID.Zero));
882 882