Change the signature of the forms requester data in preparation to getting

to where lists can be sent as requests
mysql-performance
Melanie 2009-12-27 03:31:53 +00:00
parent 4799f1ce92
commit cbe434149e
6 changed files with 74 additions and 74 deletions

View File

@ -160,9 +160,9 @@ namespace OpenSim.Server.Base
}
}
public static Dictionary<string, string> ParseQueryString(string query)
public static Dictionary<string, object> ParseQueryString(string query)
{
Dictionary<string, string> result = new Dictionary<string, string>();
Dictionary<string, object> result = new Dictionary<string, object>();
string[] terms = query.Split(new char[] {'&'});
if (terms.Length == 0)
@ -186,17 +186,17 @@ namespace OpenSim.Server.Base
return result;
}
public static string BuildQueryString(Dictionary<string, string> data)
public static string BuildQueryString(Dictionary<string, object> data)
{
string qstring = String.Empty;
foreach (KeyValuePair<string, string> kvp in data)
foreach (KeyValuePair<string, object> kvp in data)
{
string part;
if (kvp.Value != String.Empty)
if (kvp.Value.ToString() != String.Empty)
{
part = System.Web.HttpUtility.UrlEncode(kvp.Key) +
"=" + System.Web.HttpUtility.UrlEncode(kvp.Value);
"=" + System.Web.HttpUtility.UrlEncode(kvp.Value.ToString());
}
else
{

View File

@ -86,14 +86,14 @@ namespace OpenSim.Server.Handlers.Authentication
private byte[] DoPlainMethods(string body)
{
Dictionary<string, string> request =
Dictionary<string, object> request =
ServerUtils.ParseQueryString(body);
int lifetime = 30;
if (request.ContainsKey("LIFETIME"))
{
lifetime = Convert.ToInt32(request["LIFETIME"]);
lifetime = Convert.ToInt32(request["LIFETIME"].ToString());
if (lifetime > 30)
lifetime = 30;
}
@ -103,12 +103,12 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("PRINCIPAL"))
return FailureResult();
string method = request["METHOD"];
string method = request["METHOD"].ToString();
UUID principalID;
string token;
if (!UUID.TryParse(request["PRINCIPAL"], out principalID))
if (!UUID.TryParse(request["PRINCIPAL"].ToString(), out principalID))
return FailureResult();
switch (method)
@ -117,7 +117,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("PASSWORD"))
return FailureResult();
token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"], lifetime);
token = m_AuthenticationService.Authenticate(principalID, request["PASSWORD"].ToString(), lifetime);
if (token != String.Empty)
return SuccessResult(token);
@ -126,7 +126,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("TOKEN"))
return FailureResult();
if (m_AuthenticationService.Verify(principalID, request["TOKEN"], lifetime))
if (m_AuthenticationService.Verify(principalID, request["TOKEN"].ToString(), lifetime))
return SuccessResult();
return FailureResult();
@ -134,7 +134,7 @@ namespace OpenSim.Server.Handlers.Authentication
if (!request.ContainsKey("TOKEN"))
return FailureResult();
if (m_AuthenticationService.Release(principalID, request["TOKEN"]))
if (m_AuthenticationService.Release(principalID, request["TOKEN"].ToString()))
return SuccessResult();
return FailureResult();

View File

@ -69,13 +69,13 @@ namespace OpenSim.Server.Handlers.Grid
try
{
Dictionary<string, string> request =
Dictionary<string, object> request =
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
string method = request["METHOD"];
string method = request["METHOD"].ToString();
switch (method)
{
@ -117,22 +117,22 @@ namespace OpenSim.Server.Handlers.Grid
#region Method-specific handlers
byte[] Register(Dictionary<string, string> request)
byte[] Register(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"], out scopeID);
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to register region");
int versionNumberMin = 0, versionNumberMax = 0;
if (request.ContainsKey("VERSIONMIN"))
Int32.TryParse(request["VERSIONMIN"], out versionNumberMin);
Int32.TryParse(request["VERSIONMIN"].ToString(), out versionNumberMin);
else
m_log.WarnFormat("[GRID HANDLER]: no minimum protocol version in request to register region");
if (request.ContainsKey("VERSIONMAX"))
Int32.TryParse(request["VERSIONMAX"], out versionNumberMax);
Int32.TryParse(request["VERSIONMAX"].ToString(), out versionNumberMax);
else
m_log.WarnFormat("[GRID HANDLER]: no maximum protocol version in request to register region");
@ -147,8 +147,8 @@ namespace OpenSim.Server.Handlers.Grid
GridRegion rinfo = null;
try
{
foreach (KeyValuePair<string, string> kvp in request)
rinfoData[kvp.Key] = kvp.Value;
foreach (KeyValuePair<string, object> kvp in request)
rinfoData[kvp.Key] = kvp.Value.ToString();
rinfo = new GridRegion(rinfoData);
}
catch (Exception e)
@ -166,11 +166,11 @@ namespace OpenSim.Server.Handlers.Grid
return FailureResult();
}
byte[] Deregister(Dictionary<string, string> request)
byte[] Deregister(Dictionary<string, object> request)
{
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out regionID);
if (request.ContainsKey("REGIONID"))
UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to deregister region");
@ -183,17 +183,17 @@ namespace OpenSim.Server.Handlers.Grid
}
byte[] GetNeighbours(Dictionary<string, string> request)
byte[] GetNeighbours(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out regionID);
if (request.ContainsKey("REGIONID"))
UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
@ -221,17 +221,17 @@ namespace OpenSim.Server.Handlers.Grid
}
byte[] GetRegionByUUID(Dictionary<string, string> request)
byte[] GetRegionByUUID(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get neighbours");
UUID regionID = UUID.Zero;
if (request["REGIONID"] != null)
UUID.TryParse(request["REGIONID"], out regionID);
if (request.ContainsKey("REGIONID"))
UUID.TryParse(request["REGIONID"].ToString(), out regionID);
else
m_log.WarnFormat("[GRID HANDLER]: no regionID in request to get neighbours");
@ -250,21 +250,21 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
byte[] GetRegionByPosition(Dictionary<string, string> request)
byte[] GetRegionByPosition(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by position");
int x = 0, y = 0;
if (request["X"] != null)
Int32.TryParse(request["X"], out x);
if (request.ContainsKey("X"))
Int32.TryParse(request["X"].ToString(), out x);
else
m_log.WarnFormat("[GRID HANDLER]: no X in request to get region by position");
if (request["Y"] != null)
Int32.TryParse(request["Y"], out y);
if (request.ContainsKey("Y"))
Int32.TryParse(request["Y"].ToString(), out y);
else
m_log.WarnFormat("[GRID HANDLER]: no Y in request to get region by position");
@ -283,17 +283,17 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
byte[] GetRegionByName(Dictionary<string, string> request)
byte[] GetRegionByName(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
if (request.ContainsKey("NAME"))
regionName = request["NAME"].ToString();
else
m_log.WarnFormat("[GRID HANDLER]: no name in request to get region by name");
@ -312,23 +312,23 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
byte[] GetRegionsByName(Dictionary<string, string> request)
byte[] GetRegionsByName(Dictionary<string, object> request)
{
UUID scopeID = UUID.Zero;
if (request["SCOPEID"] != null)
UUID.TryParse(request["SCOPEID"], out scopeID);
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get regions by name");
string regionName = string.Empty;
if (request["NAME"] != null)
regionName = request["NAME"];
if (request.ContainsKey("NAME"))
regionName = request["NAME"].ToString();
else
m_log.WarnFormat("[GRID HANDLER]: no NAME in request to get regions by name");
int max = 0;
if (request["MAX"] != null)
Int32.TryParse(request["MAX"], out max);
if (request.ContainsKey("MAX"))
Int32.TryParse(request["MAX"].ToString(), out max);
else
m_log.WarnFormat("[GRID HANDLER]: no MAX in request to get regions by name");
@ -355,30 +355,30 @@ namespace OpenSim.Server.Handlers.Grid
return encoding.GetBytes(xmlString);
}
byte[] GetRegionRange(Dictionary<string, string> request)
byte[] GetRegionRange(Dictionary<string, object> request)
{
//m_log.DebugFormat("[GRID HANDLER]: GetRegionRange");
UUID scopeID = UUID.Zero;
if (request.ContainsKey("SCOPEID"))
UUID.TryParse(request["SCOPEID"], out scopeID);
UUID.TryParse(request["SCOPEID"].ToString(), out scopeID);
else
m_log.WarnFormat("[GRID HANDLER]: no scopeID in request to get region range");
int xmin = 0, xmax = 0, ymin = 0, ymax = 0;
if (request.ContainsKey("XMIN"))
Int32.TryParse(request["XMIN"], out xmin);
Int32.TryParse(request["XMIN"].ToString(), out xmin);
else
m_log.WarnFormat("[GRID HANDLER]: no XMIN in request to get region range");
if (request.ContainsKey("XMAX"))
Int32.TryParse(request["XMAX"], out xmax);
Int32.TryParse(request["XMAX"].ToString(), out xmax);
else
m_log.WarnFormat("[GRID HANDLER]: no XMAX in request to get region range");
if (request.ContainsKey("YMIN"))
Int32.TryParse(request["YMIN"], out ymin);
Int32.TryParse(request["YMIN"].ToString(), out ymin);
else
m_log.WarnFormat("[GRID HANDLER]: no YMIN in request to get region range");
if (request.ContainsKey("YMAX"))
Int32.TryParse(request["YMAX"], out ymax);
Int32.TryParse(request["YMAX"].ToString(), out ymax);
else
m_log.WarnFormat("[GRID HANDLER]: no YMAX in request to get region range");

View File

@ -68,13 +68,13 @@ namespace OpenSim.Server.Handlers.Presence
try
{
Dictionary<string, string> request =
Dictionary<string, object> request =
ServerUtils.ParseQueryString(body);
if (!request.ContainsKey("METHOD"))
return FailureResult();
string method = request["METHOD"];
string method = request["METHOD"].ToString();
switch (method)
{
@ -92,12 +92,12 @@ namespace OpenSim.Server.Handlers.Presence
}
byte[] Report(Dictionary<string, string> request)
byte[] Report(Dictionary<string, object> request)
{
PresenceInfo info = new PresenceInfo();
info.Data = new Dictionary<string, string>();
if (request["PrincipalID"] == null || request["RegionID"] == null)
if (!request.ContainsKey("PrincipalID") || !request.ContainsKey("RegionID"))
return FailureResult();
if (!UUID.TryParse(request["PrincipalID"].ToString(),

View File

@ -84,7 +84,7 @@ namespace OpenSim.Services.Connectors
public string Authenticate(UUID principalID, string password, int lifetime)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["LIFETIME"] = lifetime.ToString();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["PASSWORD"] = password;
@ -106,7 +106,7 @@ namespace OpenSim.Services.Connectors
public bool Verify(UUID principalID, string token, int lifetime)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["LIFETIME"] = lifetime.ToString();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["TOKEN"] = token;
@ -128,7 +128,7 @@ namespace OpenSim.Services.Connectors
public bool Release(UUID principalID, string token)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["PRINCIPAL"] = principalID.ToString();
sendData["TOKEN"] = token;

View File

@ -89,7 +89,7 @@ namespace OpenSim.Services.Connectors
public virtual bool RegisterRegion(UUID scopeID, GridRegion regionInfo)
{
Dictionary<string, object> rinfo = regionInfo.ToKeyValuePairs();
Dictionary<string, string> sendData = new Dictionary<string,string>();
Dictionary<string, object> sendData = new Dictionary<string,object>();
foreach (KeyValuePair<string, object> kvp in rinfo)
sendData[kvp.Key] = (string)kvp.Value;
@ -130,7 +130,7 @@ namespace OpenSim.Services.Connectors
public virtual bool DeregisterRegion(UUID regionID)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["REGIONID"] = regionID.ToString();
@ -162,7 +162,7 @@ namespace OpenSim.Services.Connectors
public virtual List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["REGIONID"] = regionID.ToString();
@ -212,7 +212,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["REGIONID"] = regionID.ToString();
@ -258,7 +258,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["X"] = x.ToString();
@ -303,7 +303,7 @@ namespace OpenSim.Services.Connectors
public virtual GridRegion GetRegionByName(UUID scopeID, string regionName)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["NAME"] = regionName;
@ -344,7 +344,7 @@ namespace OpenSim.Services.Connectors
public virtual List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["NAME"] = name;
@ -396,7 +396,7 @@ namespace OpenSim.Services.Connectors
public virtual List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
{
Dictionary<string, string> sendData = new Dictionary<string, string>();
Dictionary<string, object> sendData = new Dictionary<string, object>();
sendData["SCOPEID"] = scopeID.ToString();
sendData["XMIN"] = xmin.ToString();