Merge branch 'master' into careminster

This commit is contained in:
Melanie
2013-02-22 01:28:54 +00:00
141 changed files with 12110 additions and 779 deletions

View File

@@ -84,11 +84,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
protected static Regex m_PathComponent = new Regex("\\.({[^}]+}|\\[[0-9]+\\]|\\[\\+\\])");
// extract the internals of an array reference
protected static Regex m_SimpleArrayPattern = new Regex("\\[([0-9]+)\\]");
protected static Regex m_ArrayPattern = new Regex("\\[([0-9]+|\\+)\\]");
protected static Regex m_SimpleArrayPattern = new Regex("^\\[([0-9]+)\\]$");
protected static Regex m_ArrayPattern = new Regex("^\\[([0-9]+|\\+)\\]$");
// extract the internals of a has reference
protected static Regex m_HashPattern = new Regex("{([^}]+)}");
protected static Regex m_HashPattern = new Regex("^{([^}]+)}$");
// -----------------------------------------------------------------
/// <summary>
@@ -168,28 +168,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
return JsonStoreNodeType.Undefined;
}
// -----------------------------------------------------------------
/// <summary>
///
/// </summary>
// -----------------------------------------------------------------
public bool TestPath(string expr, bool useJson)
{
Stack<string> path;
if (! ParsePathExpression(expr,out path))
return false;
OSD result = ProcessPathExpression(ValueStore,path);
if (result == null)
return false;
if (useJson || OSDBaseType(result.Type))
return true;
return false;
}
// -----------------------------------------------------------------
/// <summary>
///

View File

@@ -297,38 +297,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
return JsonStoreNodeType.Undefined;
}
// -----------------------------------------------------------------
/// <summary>
///
/// </summary>
// -----------------------------------------------------------------
public bool TestPath(UUID storeID, string path, bool useJson)
{
if (! m_enabled) return false;
JsonStore map = null;
lock (m_JsonValueStore)
{
if (! m_JsonValueStore.TryGetValue(storeID,out map))
{
m_log.InfoFormat("[JsonStore] Missing store {0}",storeID);
return false;
}
}
try
{
lock (map)
return map.TestPath(path,useJson);
}
catch (Exception e)
{
m_log.Error(string.Format("[JsonStore]: Path test failed for {0} in {1}", path, storeID), e);
}
return false;
}
// -----------------------------------------------------------------
/// <summary>
///

View File

@@ -168,32 +168,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
{
m_comms.RegisterScriptInvocations(this);
m_comms.RegisterConstants(this);
// m_comms.RegisterScriptInvocation(this, "JsonCreateStore");
// m_comms.RegisterScriptInvocation(this, "JsonAttachObjectStore");
// m_comms.RegisterScriptInvocation(this, "JsonDestroyStore");
// m_comms.RegisterScriptInvocation(this, "JsonTestStore");
// m_comms.RegisterScriptInvocation(this, "JsonReadNotecard");
// m_comms.RegisterScriptInvocation(this, "JsonWriteNotecard");
// m_comms.RegisterScriptInvocation(this, "JsonTestPathList");
// m_comms.RegisterScriptInvocation(this, "JsonTestPath");
// m_comms.RegisterScriptInvocation(this, "JsonTestPathJson");
// m_comms.RegisterScriptInvocation(this, "JsonGetValue");
// m_comms.RegisterScriptInvocation(this, "JsonGetValueJson");
// m_comms.RegisterScriptInvocation(this, "JsonTakeValue");
// m_comms.RegisterScriptInvocation(this, "JsonTakeValueJson");
// m_comms.RegisterScriptInvocation(this, "JsonReadValue");
// m_comms.RegisterScriptInvocation(this, "JsonReadValueJson");
// m_comms.RegisterScriptInvocation(this, "JsonSetValue");
// m_comms.RegisterScriptInvocation(this, "JsonSetValueJson");
// m_comms.RegisterScriptInvocation(this, "JsonRemoveValue");
}
catch (Exception e)
{
@@ -341,18 +315,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore
return (int)m_store.GetPathType(storeID,path);
}
[ScriptInvocation]
public int JsonTestPath(UUID hostID, UUID scriptID, UUID storeID, string path)
{
return m_store.TestPath(storeID,path,false) ? 1 : 0;
}
[ScriptInvocation]
public int JsonTestPathJson(UUID hostID, UUID scriptID, UUID storeID, string path)
{
return m_store.TestPath(storeID,path,true) ? 1 : 0;
}
// -----------------------------------------------------------------
/// <summary>
///

View File

@@ -158,8 +158,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
Assert.That(dsrv, Is.EqualTo(1));
int tprv = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(tprv, Is.EqualTo(0));
int tprv = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));
}
[Test]
@@ -277,8 +277,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
Assert.That(returnValue, Is.EqualTo(1));
int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(result, Is.EqualTo(0));
int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));
string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
Assert.That(returnValue2, Is.EqualTo(""));
@@ -291,8 +291,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
Assert.That(returnValue, Is.EqualTo(1));
int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
Assert.That(result, Is.EqualTo(0));
int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));
string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello");
Assert.That(returnValue2, Is.EqualTo(""));
@@ -306,11 +306,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
Assert.That(returnValue, Is.EqualTo(1));
int result = (int)InvokeOp("JsonTestPath", storeId, "Hello[0]");
Assert.That(result, Is.EqualTo(1));
int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[0]");
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE));
result = (int)InvokeOp("JsonTestPath", storeId, "Hello[1]");
Assert.That(result, Is.EqualTo(0));
result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[1]");
Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));
string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]");
Assert.That(stringReturnValue, Is.EqualTo("value2"));
@@ -400,7 +400,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
// }
[Test]
public void TestGetArrayLength()
public void TestJsonGetArrayLength()
{
TestHelpers.InMethod();
// TestHelpers.EnableLogging();