A pretty major restructuring of the simian method invocations in order to
service access capabilities. In conjunction with the corresponding Simian updates, this enables explicit per-simulator capability-based access to grid services. That enables grid owners to add or revoke access to the grid on a simulator by simulator basis.TeleportWork
parent
3c540f0d33
commit
64f2dc778a
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
@ -122,7 +123,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region IAssetService
|
#region IAssetService
|
||||||
|
|
||||||
public AssetBase Get(string id)
|
public AssetBase Get(string id)
|
||||||
{
|
{
|
||||||
|
@ -140,8 +141,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetRemote(id);
|
return SimianGetOperation(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AssetBase GetCached(string id)
|
public AssetBase GetCached(string id)
|
||||||
{
|
{
|
||||||
|
@ -164,8 +166,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
AssetMetadata metadata = null;
|
|
||||||
|
|
||||||
// Cache fetch
|
// Cache fetch
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
{
|
{
|
||||||
|
@ -174,50 +174,18 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return asset.Metadata;
|
return asset.Metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
Uri url;
|
// return GetRemoteMetadata(id);
|
||||||
|
return SimianGetMetadataOperation(id);
|
||||||
// Determine if id is an absolute URL or a grid-relative UUID
|
|
||||||
if (!Uri.TryCreate(id, UriKind.Absolute, out url))
|
|
||||||
url = new Uri(m_serverUrl + id);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
|
|
||||||
request.Method = "HEAD";
|
|
||||||
|
|
||||||
using (WebResponse response = request.GetResponse())
|
|
||||||
{
|
|
||||||
using (Stream responseStream = response.GetResponseStream())
|
|
||||||
{
|
|
||||||
// Create the metadata object
|
|
||||||
metadata = new AssetMetadata();
|
|
||||||
metadata.ContentType = response.ContentType;
|
|
||||||
metadata.ID = id;
|
|
||||||
|
|
||||||
UUID uuid;
|
|
||||||
if (UUID.TryParse(id, out uuid))
|
|
||||||
metadata.FullID = uuid;
|
|
||||||
|
|
||||||
string lastModifiedStr = response.Headers.Get("Last-Modified");
|
|
||||||
if (!String.IsNullOrEmpty(lastModifiedStr))
|
|
||||||
{
|
|
||||||
DateTime lastModified;
|
|
||||||
if (DateTime.TryParse(lastModifiedStr, out lastModified))
|
|
||||||
metadata.CreationDate = lastModified;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return metadata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GetData(string id)
|
public byte[] GetData(string id)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
|
{
|
||||||
|
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset = Get(id);
|
||||||
|
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
|
@ -255,7 +223,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
Util.FireAndForget(
|
Util.FireAndForget(
|
||||||
delegate(object o)
|
delegate(object o)
|
||||||
{
|
{
|
||||||
AssetBase asset = GetRemote(id);
|
AssetBase asset = SimianGetOperation(id);
|
||||||
handler(id, sender, asset);
|
handler(id, sender, asset);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -278,7 +246,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
}
|
}
|
||||||
|
|
||||||
bool storedInCache = false;
|
bool storedInCache = false;
|
||||||
string errorMessage = null;
|
|
||||||
|
|
||||||
// AssetID handling
|
// AssetID handling
|
||||||
if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID)
|
if (String.IsNullOrEmpty(asset.ID) || asset.ID == ZeroID)
|
||||||
|
@ -307,83 +274,9 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
return asset.ID;
|
return asset.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Distinguish public and private assets
|
return SimianStoreOperation(asset);
|
||||||
bool isPublic = true;
|
|
||||||
switch ((AssetType)asset.Type)
|
|
||||||
{
|
|
||||||
case AssetType.CallingCard:
|
|
||||||
case AssetType.Gesture:
|
|
||||||
case AssetType.LSLBytecode:
|
|
||||||
case AssetType.LSLText:
|
|
||||||
isPublic = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure ContentType is set
|
|
||||||
if (String.IsNullOrEmpty(asset.Metadata.ContentType))
|
|
||||||
asset.Metadata.ContentType = SLUtil.SLAssetTypeToContentType(asset.Type);
|
|
||||||
|
|
||||||
// Build the remote storage request
|
|
||||||
List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
|
||||||
{
|
|
||||||
new MultipartForm.Parameter("AssetID", asset.FullID.ToString()),
|
|
||||||
new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID),
|
|
||||||
new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"),
|
|
||||||
new MultipartForm.Parameter("Public", isPublic ? "1" : "0"),
|
|
||||||
new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Make the remote storage request
|
|
||||||
try
|
|
||||||
{
|
|
||||||
// Simian does not require the asset ID to be in the URL because it's in the post data.
|
|
||||||
// By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
|
|
||||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
|
|
||||||
|
|
||||||
using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
|
|
||||||
{
|
|
||||||
using (Stream responseStream = response.GetResponseStream())
|
|
||||||
{
|
|
||||||
string responseStr = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
responseStr = responseStream.GetStreamString();
|
|
||||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
|
||||||
if (responseOSD.Type == OSDType.Map)
|
|
||||||
{
|
|
||||||
OSDMap responseMap = (OSDMap)responseOSD;
|
|
||||||
if (responseMap["Success"].AsBoolean())
|
|
||||||
return asset.ID;
|
|
||||||
else
|
|
||||||
errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorMessage = "Response format was invalid:\n" + responseStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
if (!String.IsNullOrEmpty(responseStr))
|
|
||||||
errorMessage = "Failed to parse the response:\n" + responseStr;
|
|
||||||
else
|
|
||||||
errorMessage = "Failed to retrieve the response: " + ex.Message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException ex)
|
|
||||||
{
|
|
||||||
errorMessage = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
|
|
||||||
asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update an asset's content
|
/// Update an asset's content
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -393,11 +286,17 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool UpdateContent(string id, byte[] data)
|
public bool UpdateContent(string id, byte[] data)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrEmpty(m_serverUrl))
|
||||||
|
{
|
||||||
|
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
}
|
||||||
|
|
||||||
AssetBase asset = Get(id);
|
AssetBase asset = Get(id);
|
||||||
|
|
||||||
if (asset == null)
|
if (asset == null)
|
||||||
{
|
{
|
||||||
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset " + id + " for updating");
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to fetch asset {0} for updating", id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,83 +319,347 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
throw new InvalidOperationException();
|
throw new InvalidOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
//string errorMessage = String.Empty;
|
|
||||||
string url = m_serverUrl + id;
|
|
||||||
|
|
||||||
if (m_cache != null)
|
if (m_cache != null)
|
||||||
m_cache.Expire(id);
|
m_cache.Expire(id);
|
||||||
|
|
||||||
|
return SimianDeleteOperation(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion IAssetService
|
||||||
|
|
||||||
|
#region SimianOperations
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes the xRemoveAsset operation on the simian server to delete an asset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private bool SimianDeleteOperation(string id)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
request.Method = "DELETE";
|
|
||||||
|
|
||||||
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
|
|
||||||
{
|
|
||||||
if (response.StatusCode != HttpStatusCode.NoContent)
|
|
||||||
{
|
{
|
||||||
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Unexpected response when deleting asset " + url + ": " +
|
{ "RequestMethod", "xRemoveAsset" },
|
||||||
response.StatusCode + " (" + response.StatusDescription + ")");
|
{ "AssetID", id }
|
||||||
}
|
};
|
||||||
}
|
|
||||||
|
|
||||||
|
OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
|
||||||
|
if (! response["Success"].AsBoolean())
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset; {0}",response["Message"].AsString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Failed to delete asset " + id + " from the asset service: " + ex.Message);
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to delete asset {0}; {1}", id, ex.Message);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion IAssetService
|
/// <summary>
|
||||||
|
/// Invokes the xAddAsset operation on the simian server to create or update an asset
|
||||||
private AssetBase GetRemote(string id)
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private string SimianStoreOperation(AssetBase asset)
|
||||||
{
|
{
|
||||||
AssetBase asset = null;
|
|
||||||
Uri url;
|
|
||||||
|
|
||||||
// Determine if id is an absolute URL or a grid-relative UUID
|
|
||||||
if (!Uri.TryCreate(id, UriKind.Absolute, out url))
|
|
||||||
url = new Uri(m_serverUrl + id);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
|
|
||||||
using (WebResponse response = request.GetResponse())
|
|
||||||
{
|
|
||||||
using (Stream responseStream = response.GetResponseStream())
|
|
||||||
{
|
{
|
||||||
string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty;
|
{ "RequestMethod", "xAddAsset" },
|
||||||
|
{ "ContentType", asset.Metadata.ContentType },
|
||||||
// Create the asset object
|
{ "EncodedData", Convert.ToBase64String(asset.Data) },
|
||||||
asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID);
|
{ "AssetID", asset.FullID.ToString() },
|
||||||
|
{ "CreatorID", asset.Metadata.CreatorID },
|
||||||
UUID assetID;
|
{ "Temporary", asset.Temporary ? "1" : "0" },
|
||||||
if (UUID.TryParse(id, out assetID))
|
{ "Name", asset.Name }
|
||||||
asset.FullID = assetID;
|
};
|
||||||
|
|
||||||
// Grab the asset data from the response stream
|
OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
|
||||||
using (MemoryStream stream = new MemoryStream())
|
if (! response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
responseStream.CopyStream(stream, Int32.MaxValue);
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",response["Message"].AsString());
|
||||||
asset.Data = stream.ToArray();
|
return null;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cache store
|
// asset.ID is always set before calling this function
|
||||||
if (m_cache != null && asset != null)
|
return asset.ID;
|
||||||
m_cache.Cache(asset);
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[SIMIAN ASSET CONNECTOR] failed to store asset; {0}",ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes the xGetAsset operation on the simian server to get data associated with an asset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private AssetBase SimianGetOperation(string id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
|
{
|
||||||
|
{ "RequestMethod", "xGetAsset" },
|
||||||
|
{ "ID", id }
|
||||||
|
};
|
||||||
|
|
||||||
|
OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
|
||||||
|
if (! response["Success"].AsBoolean())
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset; {0}",response["Message"].AsString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetBase asset = new AssetBase();
|
||||||
|
|
||||||
|
asset.ID = id;
|
||||||
|
asset.Name = String.Empty;
|
||||||
|
asset.Metadata.ContentType = response["ContentType"].AsString(); // this will also set the asset Type property
|
||||||
|
asset.CreatorID = response["CreatorID"].AsString();
|
||||||
|
asset.Data = System.Convert.FromBase64String(response["EncodedData"].AsString());
|
||||||
|
asset.Local = false;
|
||||||
|
asset.Temporary = response["Temporary"];
|
||||||
|
|
||||||
return asset;
|
return asset;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message);
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: failed to retrieve asset {0}; {1}", id, ex.Message);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invokes the xGetAssetMetadata operation on the simian server to retrieve metadata for an asset
|
||||||
|
/// This operation is generally used to determine if an asset exists in the database
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private AssetMetadata SimianGetMetadataOperation(string id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
|
{
|
||||||
|
{ "RequestMethod", "xGetAssetMetadata" },
|
||||||
|
{ "ID", id }
|
||||||
|
};
|
||||||
|
|
||||||
|
OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
|
||||||
|
if (! response["Success"].AsBoolean())
|
||||||
|
{
|
||||||
|
// this is not really an error, this call is used to test existence
|
||||||
|
// m_log.DebugFormat("[SIMIAN ASSET CONNECTOR] Failed to get asset metadata; {0}",response["Message"].AsString());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetMetadata metadata = new AssetMetadata();
|
||||||
|
metadata.ID = id;
|
||||||
|
metadata.ContentType = response["ContentType"].AsString();
|
||||||
|
metadata.CreatorID = response["CreatorID"].AsString();
|
||||||
|
metadata.Local = false;
|
||||||
|
metadata.Temporary = response["Temporary"];
|
||||||
|
|
||||||
|
string lastModifiedStr = response["Last-Modified"].AsString();
|
||||||
|
if (! String.IsNullOrEmpty(lastModifiedStr))
|
||||||
|
{
|
||||||
|
DateTime lastModified;
|
||||||
|
if (DateTime.TryParse(lastModifiedStr, out lastModified))
|
||||||
|
metadata.CreationDate = lastModified;
|
||||||
|
}
|
||||||
|
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to get asset metadata; {0}", ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
// private AssetMetadata GetRemoteMetadata(string id)
|
||||||
|
// {
|
||||||
|
// Uri url;
|
||||||
|
// AssetMetadata metadata = null;
|
||||||
|
|
||||||
|
// // Determine if id is an absolute URL or a grid-relative UUID
|
||||||
|
// if (!Uri.TryCreate(id, UriKind.Absolute, out url))
|
||||||
|
// url = new Uri(m_serverUrl + id);
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
|
||||||
|
// request.Method = "HEAD";
|
||||||
|
|
||||||
|
// using (WebResponse response = request.GetResponse())
|
||||||
|
// {
|
||||||
|
// using (Stream responseStream = response.GetResponseStream())
|
||||||
|
// {
|
||||||
|
// // Create the metadata object
|
||||||
|
// metadata = new AssetMetadata();
|
||||||
|
// metadata.ContentType = response.ContentType;
|
||||||
|
// metadata.ID = id;
|
||||||
|
|
||||||
|
// UUID uuid;
|
||||||
|
// if (UUID.TryParse(id, out uuid))
|
||||||
|
// metadata.FullID = uuid;
|
||||||
|
|
||||||
|
// string lastModifiedStr = response.Headers.Get("Last-Modified");
|
||||||
|
// if (!String.IsNullOrEmpty(lastModifiedStr))
|
||||||
|
// {
|
||||||
|
// DateTime lastModified;
|
||||||
|
// if (DateTime.TryParse(lastModifiedStr, out lastModified))
|
||||||
|
// metadata.CreationDate = lastModified;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset HEAD from " + url + " failed: " + ex.Message);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return metadata;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private AssetBase GetRemote(string id)
|
||||||
|
// {
|
||||||
|
// AssetBase asset = null;
|
||||||
|
// Uri url;
|
||||||
|
|
||||||
|
// // Determine if id is an absolute URL or a grid-relative UUID
|
||||||
|
// if (!Uri.TryCreate(id, UriKind.Absolute, out url))
|
||||||
|
// url = new Uri(m_serverUrl + id);
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// HttpWebRequest request = UntrustedHttpWebRequest.Create(url);
|
||||||
|
|
||||||
|
// using (WebResponse response = request.GetResponse())
|
||||||
|
// {
|
||||||
|
// using (Stream responseStream = response.GetResponseStream())
|
||||||
|
// {
|
||||||
|
// string creatorID = response.Headers.GetOne("X-Asset-Creator-Id") ?? String.Empty;
|
||||||
|
|
||||||
|
// // Create the asset object
|
||||||
|
// asset = new AssetBase(id, String.Empty, SLUtil.ContentTypeToSLAssetType(response.ContentType), creatorID);
|
||||||
|
|
||||||
|
// UUID assetID;
|
||||||
|
// if (UUID.TryParse(id, out assetID))
|
||||||
|
// asset.FullID = assetID;
|
||||||
|
|
||||||
|
// // Grab the asset data from the response stream
|
||||||
|
// using (MemoryStream stream = new MemoryStream())
|
||||||
|
// {
|
||||||
|
// responseStream.CopyStream(stream, Int32.MaxValue);
|
||||||
|
// asset.Data = stream.ToArray();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Cache store
|
||||||
|
// if (m_cache != null && asset != null)
|
||||||
|
// m_cache.Cache(asset);
|
||||||
|
|
||||||
|
// return asset;
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// m_log.Warn("[SIMIAN ASSET CONNECTOR]: Asset GET from " + url + " failed: " + ex.Message);
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private string StoreRemote(AssetBase asset)
|
||||||
|
// {
|
||||||
|
// // Distinguish public and private assets
|
||||||
|
// bool isPublic = true;
|
||||||
|
// switch ((AssetType)asset.Type)
|
||||||
|
// {
|
||||||
|
// case AssetType.CallingCard:
|
||||||
|
// case AssetType.Gesture:
|
||||||
|
// case AssetType.LSLBytecode:
|
||||||
|
// case AssetType.LSLText:
|
||||||
|
// isPublic = false;
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// string errorMessage = null;
|
||||||
|
|
||||||
|
// // Build the remote storage request
|
||||||
|
// List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
||||||
|
// {
|
||||||
|
// new MultipartForm.Parameter("AssetID", asset.FullID.ToString()),
|
||||||
|
// new MultipartForm.Parameter("CreatorID", asset.Metadata.CreatorID),
|
||||||
|
// new MultipartForm.Parameter("Temporary", asset.Temporary ? "1" : "0"),
|
||||||
|
// new MultipartForm.Parameter("Public", isPublic ? "1" : "0"),
|
||||||
|
// new MultipartForm.File("Asset", asset.Name, asset.Metadata.ContentType, asset.Data)
|
||||||
|
// };
|
||||||
|
|
||||||
|
// // Make the remote storage request
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// // Simian does not require the asset ID to be in the URL because it's in the post data.
|
||||||
|
// // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs
|
||||||
|
// HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString());
|
||||||
|
|
||||||
|
// using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
|
||||||
|
// {
|
||||||
|
// using (Stream responseStream = response.GetResponseStream())
|
||||||
|
// {
|
||||||
|
// string responseStr = null;
|
||||||
|
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// responseStr = responseStream.GetStreamString();
|
||||||
|
// OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||||
|
// if (responseOSD.Type == OSDType.Map)
|
||||||
|
// {
|
||||||
|
// OSDMap responseMap = (OSDMap)responseOSD;
|
||||||
|
// if (responseMap["Success"].AsBoolean())
|
||||||
|
// return asset.ID;
|
||||||
|
// else
|
||||||
|
// errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// errorMessage = "Response format was invalid:\n" + responseStr;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// if (!String.IsNullOrEmpty(responseStr))
|
||||||
|
// errorMessage = "Failed to parse the response:\n" + responseStr;
|
||||||
|
// else
|
||||||
|
// errorMessage = "Failed to retrieve the response: " + ex.Message;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (WebException ex)
|
||||||
|
// {
|
||||||
|
// errorMessage = ex.Message;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// m_log.WarnFormat("[SIMIAN ASSET CONNECTOR]: Failed to store asset \"{0}\" ({1}, {2}): {3}",
|
||||||
|
// asset.Name, asset.ID, asset.Metadata.ContentType, errorMessage);
|
||||||
|
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", principalID.ToString() }
|
{ "UserID", principalID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Identities"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Identities"] is OSDArray)
|
||||||
{
|
{
|
||||||
bool md5hashFound = false;
|
bool md5hashFound = false;
|
||||||
|
@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "SessionID", token }
|
{ "SessionID", token }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -175,7 +175,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", principalID.ToString() }
|
{ "UserID", principalID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
@ -198,7 +198,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", principalID.ToString() }
|
{ "UserID", principalID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
||||||
{
|
{
|
||||||
OSDMap userMap = (OSDMap)response["User"];
|
OSDMap userMap = (OSDMap)response["User"];
|
||||||
|
@ -218,7 +218,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", principalID.ToString() }
|
{ "UserID", principalID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -297,7 +297,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
return response["SessionID"].AsUUID().ToString();
|
return response["SessionID"].AsUUID().ToString();
|
||||||
else
|
else
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDMap map = null;
|
OSDMap map = null;
|
||||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "LLPackedAppearance", OSDParser.SerializeJsonString(map) }
|
{ "LLPackedAppearance", OSDParser.SerializeJsonString(map) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (! success)
|
if (! success)
|
||||||
|
@ -189,7 +189,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDMap map = null;
|
OSDMap map = null;
|
||||||
|
@ -306,7 +306,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "LLAttachments", OSDParser.SerializeJsonString(items) }
|
{ "LLAttachments", OSDParser.SerializeJsonString(items) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
|
@ -153,7 +153,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Value", flags.ToString() }
|
{ "Value", flags.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -180,7 +180,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Key", friend }
|
{ "Key", friend }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -200,7 +200,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Type", "Friend" }
|
{ "Type", "Friend" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
return (OSDArray)response["Entries"];
|
return (OSDArray)response["Entries"];
|
||||||
|
@ -221,7 +221,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Type", "Friend" }
|
{ "Type", "Friend" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Entries"] is OSDArray)
|
||||||
{
|
{
|
||||||
return (OSDArray)response["Entries"];
|
return (OSDArray)response["Entries"];
|
||||||
|
|
|
@ -26,8 +26,122 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
using log4net;
|
||||||
using Mono.Addins;
|
using Mono.Addins;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
|
using OpenSim.Framework;
|
||||||
|
using OpenSim.Region.Framework.Interfaces;
|
||||||
|
using OpenSim.Region.Framework.Scenes;
|
||||||
|
using OpenSim.Services.Interfaces;
|
||||||
|
using OpenMetaverse;
|
||||||
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
[assembly: Addin("SimianGrid", "1.0")]
|
[assembly: Addin("SimianGrid", "1.0")]
|
||||||
[assembly: AddinDependency("OpenSim", "0.5")]
|
[assembly: AddinDependency("OpenSim", "0.5")]
|
||||||
|
|
||||||
|
namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
{
|
||||||
|
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")]
|
||||||
|
public class SimianGrid : ISharedRegionModule
|
||||||
|
{
|
||||||
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
private IConfig m_config = null;
|
||||||
|
private bool m_enabled = true;
|
||||||
|
|
||||||
|
private String m_simianURL;
|
||||||
|
|
||||||
|
#region IRegionModule Members
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return this.GetType().Name; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void Initialise(IConfigSource config)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m_config = config.Configs["SimianGrid"];
|
||||||
|
|
||||||
|
if (m_config != null)
|
||||||
|
{
|
||||||
|
m_simianURL = m_config.GetString("SimianServiceURL");
|
||||||
|
if (String.IsNullOrEmpty(m_simianURL))
|
||||||
|
m_log.ErrorFormat("[SimianGrid] service URL is not defined");
|
||||||
|
|
||||||
|
InitialiseSimCap();
|
||||||
|
SimulatorCapability = SimulatorCapability.Trim();
|
||||||
|
m_log.WarnFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void PostInitialise() { }
|
||||||
|
public void Close() { }
|
||||||
|
public void AddRegion(Scene scene) { }
|
||||||
|
public void RemoveRegion(Scene scene) { }
|
||||||
|
public void RegionLoaded(Scene scene) { }
|
||||||
|
|
||||||
|
public Type ReplaceableInterface
|
||||||
|
{
|
||||||
|
get { return null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Try a variety of methods for finding the simian simulator capability; first check the
|
||||||
|
/// configuration itself, then look for a file that contains the cap, then finally look
|
||||||
|
/// for an environment variable that contains it.
|
||||||
|
///</summary>
|
||||||
|
private void InitialiseSimCap()
|
||||||
|
{
|
||||||
|
if (m_config.Contains("SimulatorCapability"))
|
||||||
|
{
|
||||||
|
SimulatorCapability = m_config.GetString("SimulatorCapability");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_config.Contains("SimulatorCapabilityFile"))
|
||||||
|
{
|
||||||
|
String filename = m_config.GetString("SimulatorCapabilityFile");
|
||||||
|
if (System.IO.File.Exists(filename))
|
||||||
|
{
|
||||||
|
SimulatorCapability = System.IO.File.ReadAllText(filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_config.Contains("SimulatorCapabilityVariable"))
|
||||||
|
{
|
||||||
|
String envname = m_config.GetString("SimulatorCapabilityVariable");
|
||||||
|
String envvalue = System.Environment.GetEnvironmentVariable(envname);
|
||||||
|
if (envvalue != null)
|
||||||
|
{
|
||||||
|
SimulatorCapability = envvalue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
public static String SimulatorCapability = UUID.Zero.ToString();
|
||||||
|
public static OSDMap PostToService(string url, NameValueCollection data)
|
||||||
|
{
|
||||||
|
data["cap"] = SimulatorCapability;
|
||||||
|
return WebUtil.PostToService(url, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -43,7 +44,8 @@ using OpenSim.Region.Framework.Scenes;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Region.OptionalModules.Simian
|
//namespace OpenSim.Region.OptionalModules.Simian
|
||||||
|
namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -196,67 +198,84 @@ namespace OpenSim.Region.OptionalModules.Simian
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
NameValueCollection requestArgs = new NameValueCollection
|
||||||
{
|
|
||||||
new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
|
|
||||||
new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
|
|
||||||
new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
|
|
||||||
};
|
|
||||||
|
|
||||||
string errorMessage = null;
|
|
||||||
int tickstart = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
// Make the remote storage request
|
|
||||||
try
|
|
||||||
{
|
|
||||||
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
|
|
||||||
request.Timeout = 20000;
|
|
||||||
request.ReadWriteTimeout = 5000;
|
|
||||||
|
|
||||||
using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
|
|
||||||
{
|
{
|
||||||
using (Stream responseStream = response.GetResponseStream())
|
{ "RequestMethod", "xAddMapTile" },
|
||||||
{
|
{ "X", scene.RegionInfo.RegionLocX.ToString() },
|
||||||
string responseStr = responseStream.GetStreamString();
|
{ "Y", scene.RegionInfo.RegionLocY.ToString() },
|
||||||
OSD responseOSD = OSDParser.Deserialize(responseStr);
|
{ "ContentType", "image/png" },
|
||||||
if (responseOSD.Type == OSDType.Map)
|
{ "EncodedData", System.Convert.ToBase64String(pngData) }
|
||||||
{
|
};
|
||||||
OSDMap responseMap = (OSDMap)responseOSD;
|
|
||||||
if (responseMap["Success"].AsBoolean())
|
OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs);
|
||||||
return;
|
if (! response["Success"].AsBoolean())
|
||||||
|
|
||||||
errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errorMessage = "Response format was invalid:\n" + responseStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (WebException we)
|
|
||||||
{
|
{
|
||||||
errorMessage = we.Message;
|
m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString());
|
||||||
if (we.Status == WebExceptionStatus.ProtocolError)
|
return;
|
||||||
{
|
|
||||||
HttpWebResponse webResponse = (HttpWebResponse)we.Response;
|
|
||||||
errorMessage = String.Format("[{0}] {1}",
|
|
||||||
webResponse.StatusCode,webResponse.StatusDescription);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
errorMessage = ex.Message;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// This just dumps a warning for any operation that takes more than 100 ms
|
|
||||||
int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
|
||||||
m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
|
// List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>()
|
||||||
pngData.Length, scene.RegionInfo.RegionName, errorMessage);
|
// {
|
||||||
|
// new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()),
|
||||||
|
// new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()),
|
||||||
|
// new MultipartForm.File("Tile", "tile.png", "image/png", pngData)
|
||||||
|
// };
|
||||||
|
|
||||||
|
// string errorMessage = null;
|
||||||
|
// int tickstart = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
|
// // Make the remote storage request
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl);
|
||||||
|
// request.Timeout = 20000;
|
||||||
|
// request.ReadWriteTimeout = 5000;
|
||||||
|
|
||||||
|
// using (HttpWebResponse response = MultipartForm.Post(request, postParameters))
|
||||||
|
// {
|
||||||
|
// using (Stream responseStream = response.GetResponseStream())
|
||||||
|
// {
|
||||||
|
// string responseStr = responseStream.GetStreamString();
|
||||||
|
// OSD responseOSD = OSDParser.Deserialize(responseStr);
|
||||||
|
// if (responseOSD.Type == OSDType.Map)
|
||||||
|
// {
|
||||||
|
// OSDMap responseMap = (OSDMap)responseOSD;
|
||||||
|
// if (responseMap["Success"].AsBoolean())
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// errorMessage = "Upload failed: " + responseMap["Message"].AsString();
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// errorMessage = "Response format was invalid:\n" + responseStr;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (WebException we)
|
||||||
|
// {
|
||||||
|
// errorMessage = we.Message;
|
||||||
|
// if (we.Status == WebExceptionStatus.ProtocolError)
|
||||||
|
// {
|
||||||
|
// HttpWebResponse webResponse = (HttpWebResponse)we.Response;
|
||||||
|
// errorMessage = String.Format("[{0}] {1}",
|
||||||
|
// webResponse.StatusCode,webResponse.StatusDescription);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// errorMessage = ex.Message;
|
||||||
|
// }
|
||||||
|
// finally
|
||||||
|
// {
|
||||||
|
// // This just dumps a warning for any operation that takes more than 100 ms
|
||||||
|
// int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
|
||||||
|
// m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}",
|
||||||
|
// pngData.Length, scene.RegionInfo.RegionName, errorMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -129,7 +129,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
else
|
else
|
||||||
|
@ -145,7 +145,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Enabled", "0" }
|
{ "Enabled", "0" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -192,7 +192,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString());
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region with uuid {0}",regionID.ToString());
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString());
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] uuid request successful {0}",response["Name"].AsString());
|
||||||
|
@ -220,7 +220,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString());
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request grid at {0}",position.ToString());
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString());
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] position request successful {0}",response["Name"].AsString());
|
||||||
|
@ -261,7 +261,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name);
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions with name {0}",name);
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
|
||||||
|
@ -299,7 +299,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
//m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
|
//m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request regions by range {0} to {1}",minPosition.ToString(),maxPosition.ToString());
|
||||||
|
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDArray array = response["Scenes"] as OSDArray;
|
OSDArray array = response["Scenes"] as OSDArray;
|
||||||
|
@ -350,7 +350,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Enabled", "1" }
|
{ "Enabled", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
|
// m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name);
|
||||||
|
@ -380,7 +380,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
|
|
||||||
m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
|
m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString());
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDMap extraData = response["ExtraData"] as OSDMap;
|
OSDMap extraData = response["ExtraData"] as OSDMap;
|
||||||
|
@ -410,7 +410,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
if (onlyEnabled)
|
if (onlyEnabled)
|
||||||
requestArgs["Enabled"] = "1";
|
requestArgs["Enabled"] = "1";
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_ServerURI, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
return ResponseToGridRegion(response);
|
return ResponseToGridRegion(response);
|
||||||
|
|
|
@ -156,7 +156,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "OwnerID", userID.ToString() }
|
{ "OwnerID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -182,7 +182,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "0" }
|
{ "ChildrenOnly", "0" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray items = (OSDArray)response["Items"];
|
OSDArray items = (OSDArray)response["Items"];
|
||||||
|
@ -244,7 +244,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "1" }
|
{ "ChildrenOnly", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray items = (OSDArray)response["Items"];
|
OSDArray items = (OSDArray)response["Items"];
|
||||||
|
@ -274,7 +274,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "OwnerID", userID.ToString() }
|
{ "OwnerID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Folder"] is OSDMap)
|
if (response["Success"].AsBoolean() && response["Folder"] is OSDMap)
|
||||||
{
|
{
|
||||||
OSDMap folder = (OSDMap)response["Folder"];
|
OSDMap folder = (OSDMap)response["Folder"];
|
||||||
|
@ -312,7 +312,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "1" }
|
{ "ChildrenOnly", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]);
|
List<InventoryItemBase> items = GetItemsFromResponse((OSDArray)response["Items"]);
|
||||||
|
@ -349,7 +349,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "1" }
|
{ "ChildrenOnly", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray items = (OSDArray)response["Items"];
|
OSDArray items = (OSDArray)response["Items"];
|
||||||
|
@ -383,7 +383,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "1" }
|
{ "ChildrenOnly", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray items = (OSDArray)response["Items"];
|
OSDArray items = (OSDArray)response["Items"];
|
||||||
|
@ -423,7 +423,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ChildrenOnly", "1" }
|
{ "ChildrenOnly", "1" }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
if (response["Success"].AsBoolean() && response["Items"] is OSDArray)
|
||||||
{
|
{
|
||||||
OSDArray items = (OSDArray)response["Items"];
|
OSDArray items = (OSDArray)response["Items"];
|
||||||
|
@ -454,7 +454,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) }
|
{ "ContentType", SLUtil.SLAssetTypeToContentType(folder.Type) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -518,7 +518,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ItemID", itemID.ToString() }
|
{ "ItemID", itemID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -546,7 +546,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "FolderID", folder.ID.ToString() }
|
{ "FolderID", folder.ID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -623,7 +623,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
{ "ExtraData", OSDParser.SerializeJsonString(extraData) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -847,7 +847,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Items", String.Join(",", itemIDs) }
|
{ "Items", String.Join(",", itemIDs) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -885,7 +885,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDMap user = response["User"] as OSDMap;
|
OSDMap user = response["User"] as OSDMap;
|
||||||
|
@ -916,7 +916,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "Gestures", OSDParser.SerializeJsonString(gestures) }
|
{ "Gestures", OSDParser.SerializeJsonString(gestures) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_userServerUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_userServerUrl, requestArgs);
|
||||||
if (!response["Success"].AsBoolean())
|
if (!response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " +
|
m_log.Warn("[SIMIAN INVENTORY CONNECTOR]: Failed to save active gestures for " + userID + ": " +
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
requestArgs["SecureSessionID"] = secureSessionID.ToString();
|
requestArgs["SecureSessionID"] = secureSessionID.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "SessionID", sessionID.ToString() }
|
{ "SessionID", sessionID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -187,7 +187,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "SceneID", regionID.ToString() }
|
{ "SceneID", regionID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -232,7 +232,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserIDList", String.Join(",",userIDs) }
|
{ "UserIDList", String.Join(",",userIDs) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap sessionListResponse = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap sessionListResponse = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (! sessionListResponse["Success"].AsBoolean())
|
if (! sessionListResponse["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString());
|
m_log.WarnFormat("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve sessions: {0}",sessionListResponse["Message"].AsString());
|
||||||
|
@ -275,7 +275,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) }
|
{ "LastLocation", SerializeLocation(regionID, lastPosition, lastLookAt) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -295,7 +295,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "HomeLocation", SerializeLocation(regionID, position, lookAt) }
|
{ "HomeLocation", SerializeLocation(regionID, position, lookAt) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -340,7 +340,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "SessionID", sessionID.ToString() }
|
{ "SessionID", sessionID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
return response;
|
return response;
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "SceneLookAt", lastLookAt.ToString() }
|
{ "SceneLookAt", lastLookAt.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
|
@ -392,7 +392,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", client.AgentId.ToString() }
|
{ "UserID", client.AgentId.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
string email = response["Email"].AsString();
|
string email = response["Email"].AsString();
|
||||||
|
|
||||||
if (!response["Success"].AsBoolean())
|
if (!response["Success"].AsBoolean())
|
||||||
|
@ -443,7 +443,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ key, OSDParser.SerializeJsonString(value) }
|
{ key, OSDParser.SerializeJsonString(value) }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
@ -462,7 +462,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserID", userID.ToString() }
|
{ "UserID", userID.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
if (response["Success"].AsBoolean() && response["User"] is OSDMap)
|
||||||
{
|
{
|
||||||
return (OSDMap)response["User"];
|
return (OSDMap)response["User"];
|
||||||
|
|
|
@ -165,7 +165,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "NameQuery", query }
|
{ "NameQuery", query }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDArray array = response["Users"] as OSDArray;
|
OSDArray array = response["Users"] as OSDArray;
|
||||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "AccessLevel", data.UserLevel.ToString() }
|
{ "AccessLevel", data.UserLevel.ToString() }
|
||||||
};
|
};
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
|
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
|
@ -219,7 +219,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
{ "UserTitle", data.UserTitle }
|
{ "UserTitle", data.UserTitle }
|
||||||
};
|
};
|
||||||
|
|
||||||
response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
bool success = response["Success"].AsBoolean();
|
bool success = response["Success"].AsBoolean();
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
@ -252,7 +252,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
|
||||||
string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
|
string lookupValue = (requestArgs.Count > 1) ? requestArgs[1] : "(Unknown)";
|
||||||
// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
|
// m_log.DebugFormat("[SIMIAN ACCOUNT CONNECTOR]: Looking up user account with query: " + lookupValue);
|
||||||
|
|
||||||
OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
|
OSDMap response = SimianGrid.PostToService(m_serverUrl, requestArgs);
|
||||||
if (response["Success"].AsBoolean())
|
if (response["Success"].AsBoolean())
|
||||||
{
|
{
|
||||||
OSDMap user = response["User"] as OSDMap;
|
OSDMap user = response["User"] as OSDMap;
|
||||||
|
|
Loading…
Reference in New Issue