Formatting cleanup.

0.6.0-stable
Jeff Ames 2008-05-16 01:22:11 +00:00
parent e25818d832
commit 65c5efe43b
261 changed files with 3718 additions and 3831 deletions

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]

View File

@ -58,7 +58,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
try try
{ {
if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && if (openSim.ConfigSource.Configs["RemoteAdmin"] != null &&
openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false))
{ {
m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); m_log.Info("[RADMIN]: Remote Admin Plugin Enabled");
@ -96,7 +96,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password"); throw new Exception("wrong password");
LLUUID regionID = new LLUUID((string) requestData["regionID"]); LLUUID regionID = new LLUUID((string) requestData["regionID"]);
responseData["accepted"] = "true"; responseData["accepted"] = "true";
@ -106,10 +106,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
throw new Exception("region not found"); throw new Exception("region not found");
responseData["rebooting"] = "true"; responseData["rebooting"] = "true";
rebootedScene.Restart(30); rebootedScene.Restart(30);
} }
catch(Exception e) catch(Exception e)
{ {
m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN]: Restart region: failed: {0}", e.Message);
@ -136,7 +136,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (requiredPassword != String.Empty && if (requiredPassword != String.Empty &&
(!requestData.Contains("password") || (string) requestData["password"] != requiredPassword)) (!requestData.Contains("password") || (string) requestData["password"] != requiredPassword))
throw new Exception("wrong password"); throw new Exception("wrong password");
string message = (string) requestData["message"]; string message = (string) requestData["message"];
m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message); m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
@ -167,7 +167,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString()); m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}", request.ToString());
foreach (string k in requestData.Keys) foreach (string k in requestData.Keys)
{ {
m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}", m_log.DebugFormat("[RADMIN]: Load Terrain: XmlRpc {0}: >{1}< {2}",
k, (string)requestData[k], ((string)requestData[k]).Length); k, (string)requestData[k], ((string)requestData[k]).Length);
} }
@ -198,7 +198,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData; response.Value = responseData;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString());
@ -227,14 +227,14 @@ namespace OpenSim.ApplicationPlugins.RemoteController
int timeout = 2000; int timeout = 2000;
if (requestData.ContainsKey("shutdown") && if (requestData.ContainsKey("shutdown") &&
((string) requestData["shutdown"] == "delayed") && ((string) requestData["shutdown"] == "delayed") &&
requestData.ContainsKey("milliseconds")) requestData.ContainsKey("milliseconds"))
{ {
timeout = (Int32) requestData["milliseconds"]; timeout = (Int32) requestData["milliseconds"];
m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() + m_app.SceneManager.SendGeneralMessage("Region is going down in " + ((int) (timeout/1000)).ToString() +
" second(s). Please save what you are doing and log out."); " second(s). Please save what you are doing and log out.");
} }
else else
{ {
m_app.SceneManager.SendGeneralMessage("Region is going down now."); m_app.SceneManager.SendGeneralMessage("Region is going down now.");
@ -248,7 +248,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["success"] = "true"; responseData["success"] = "true";
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN] Shutdown: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString()); m_log.DebugFormat("[RADMIN] Shutdown: failed: {0}", e.ToString());
@ -272,7 +272,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
foreach (string p in param) foreach (string p in param)
{ {
if (!requestData.Contains(p)) if (!requestData.Contains(p))
throw new Exception(String.Format("missing string parameter {0}", p)); throw new Exception(String.Format("missing string parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p])) if (String.IsNullOrEmpty((string)requestData[p]))
throw new Exception(String.Format("parameter {0} is empty", p)); throw new Exception(String.Format("parameter {0} is empty", p));
@ -284,7 +284,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
foreach (string p in param) foreach (string p in param)
{ {
if (!requestData.Contains(p)) if (!requestData.Contains(p))
throw new Exception(String.Format("missing integer parameter {0}", p)); throw new Exception(String.Format("missing integer parameter {0}", p));
} }
} }
@ -324,7 +324,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <description>if true, persist the region info /// <description>if true, persist the region info
/// ('true' or 'false')</description></item> /// ('true' or 'false')</description></item>
/// </list> /// </list>
/// ///
/// XmlRpcCreateRegionMethod returns /// XmlRpcCreateRegionMethod returns
/// <list type="table"> /// <list type="table">
/// <listheader><term>name</term><description>description</description></listheader> /// <listheader><term>name</term><description>description</description></listheader>
@ -346,9 +346,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try { try {
checkStringParameters(request, new string[] { "password", checkStringParameters(request, new string[] { "password",
"region_name", "region_name",
"region_master_first", "region_master_last", "region_master_first", "region_master_last",
"region_master_password", "region_master_password",
"listen_ip", "external_address"}); "listen_ip", "external_address"});
checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"});
@ -360,16 +360,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// extract or generate region ID now // extract or generate region ID now
Scene scene = null; Scene scene = null;
LLUUID regionID = LLUUID.Zero; LLUUID regionID = LLUUID.Zero;
if (requestData.ContainsKey("region_id") && if (requestData.ContainsKey("region_id") &&
!String.IsNullOrEmpty((string)requestData["region_id"])) !String.IsNullOrEmpty((string)requestData["region_id"]))
{ {
regionID = (string) requestData["region_id"]; regionID = (string) requestData["region_id"];
if (m_app.SceneManager.TryGetScene(regionID, out scene)) if (m_app.SceneManager.TryGetScene(regionID, out scene))
throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>",
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
} }
else else
{ {
regionID = LLUUID.Random(); regionID = LLUUID.Random();
m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID); m_log.DebugFormat("[RADMIN] CreateRegion: new region UUID {0}", regionID);
@ -385,7 +385,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// check for collisions: region name, region UUID, // check for collisions: region name, region UUID,
// region location // region location
if (m_app.SceneManager.TryGetScene(region.RegionName, out scene)) if (m_app.SceneManager.TryGetScene(region.RegionName, out scene))
throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>", throw new Exception(String.Format("region name already in use by region {0}, UUID {1}, <{2},{3}>",
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
@ -395,43 +395,43 @@ namespace OpenSim.ApplicationPlugins.RemoteController
region.RegionLocX, region.RegionLocY, region.RegionLocX, region.RegionLocY,
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
// Security risk [and apparently not used] // Security risk [and apparently not used]
// if (requestData.ContainsKey("datastore")) // if (requestData.ContainsKey("datastore"))
// region.DataStore = (string) requestData["datastore"]; // region.DataStore = (string) requestData["datastore"];
region.InternalEndPoint = region.InternalEndPoint =
new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0); new IPEndPoint(IPAddress.Parse((string) requestData["listen_ip"]), 0);
region.InternalEndPoint.Port = (Int32) requestData["listen_port"]; region.InternalEndPoint.Port = (Int32) requestData["listen_port"];
if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0"); if (0 == region.InternalEndPoint.Port) throw new Exception("listen_port is 0");
if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene)) if (m_app.SceneManager.TryGetScene(region.InternalEndPoint, out scene))
throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>", throw new Exception(String.Format("region internal IP {0} and port {1} already in use by region {2}, UUID {3}, <{4},{5}>",
region.InternalEndPoint.Address, region.InternalEndPoint.Address,
region.InternalEndPoint.Port, region.InternalEndPoint.Port,
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY)); scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
region.ExternalHostName = (string) requestData["external_address"]; region.ExternalHostName = (string) requestData["external_address"];
region.MasterAvatarFirstName = (string) requestData["region_master_first"]; region.MasterAvatarFirstName = (string) requestData["region_master_first"];
region.MasterAvatarLastName = (string) requestData["region_master_last"]; region.MasterAvatarLastName = (string) requestData["region_master_last"];
region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"]; region.MasterAvatarSandboxPassword = (string) requestData["region_master_password"];
bool persist = Convert.ToBoolean((string)requestData["persist"]); bool persist = Convert.ToBoolean((string)requestData["persist"]);
if (persist) if (persist)
{ {
string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"), string regionConfigPath = Path.Combine(Path.Combine(Util.configDir(), "Regions"),
String.Format("{0}x{1}-{2}.xml", String.Format("{0}x{1}-{2}.xml",
region.RegionLocX.ToString(), region.RegionLocX.ToString(),
region.RegionLocY.ToString(), region.RegionLocY.ToString(),
regionID.ToString())); regionID.ToString()));
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}", m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
region.RegionID, regionConfigPath); region.RegionID, regionConfigPath);
region.SaveRegionToFile("dynamic region", regionConfigPath); region.SaveRegionToFile("dynamic region", regionConfigPath);
} }
m_app.CreateRegion(region); m_app.CreateRegion(region);
responseData["success"] = "true"; responseData["success"] = "true";
@ -476,7 +476,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
/// <item><term>start_region_y</term> /// <item><term>start_region_y</term>
/// <description>avatar's start region coordinates, Y value</description></item> /// <description>avatar's start region coordinates, Y value</description></item>
/// </list> /// </list>
/// ///
/// XmlRpcCreateUserMethod returns /// XmlRpcCreateUserMethod returns
/// <list type="table"> /// <list type="table">
/// <listheader><term>name</term><description>description</description></listheader> /// <listheader><term>name</term><description>description</description></listheader>
@ -497,10 +497,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try
{ {
// check completeness // check completeness
checkStringParameters(request, new string[] { "password", "user_firstname", checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password" }); "user_lastname", "user_password" });
checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" }); checkIntegerParams(request, new string[] { "start_region_x", "start_region_y" });
@ -514,16 +514,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
string passwd = (string) requestData["user_password"]; string passwd = (string) requestData["user_password"];
uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]); uint regX = Convert.ToUInt32((Int32)requestData["start_region_x"]);
uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]); uint regY = Convert.ToUInt32((Int32)requestData["start_region_y"]);
UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname); UserProfileData userProfile = m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
if (null != userProfile) if (null != userProfile)
throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname)); throw new Exception(String.Format("avatar {0} {1} already exists", firstname, lastname));
LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY); LLUUID userID = m_app.CreateUser(firstname, lastname, passwd, regX, regY);
if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}", if (userID == LLUUID.Zero) throw new Exception(String.Format("failed to create new user {0} {1}",
firstname, lastname)); firstname, lastname));
responseData["success"] = "true"; responseData["success"] = "true";
responseData["avatar_uuid"] = userID.ToString(); responseData["avatar_uuid"] = userID.ToString();
@ -531,7 +531,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID); m_log.InfoFormat("[RADMIN]: CreateUser: User {0} {1} created, UUID {2}", firstname, lastname, userID);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message); m_log.ErrorFormat("[RADMIN] CreateUser: failed: {0}", e.Message);
m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString()); m_log.DebugFormat("[RADMIN] CreateUser: failed: {0}", e.ToString());
@ -553,33 +553,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
Hashtable responseData = new Hashtable(); Hashtable responseData = new Hashtable();
try try
{ {
// check completeness // check completeness
foreach (string p in new string[] { "password", "filename" }) foreach (string p in new string[] { "password", "filename" })
{ {
if (!requestData.Contains(p)) if (!requestData.Contains(p))
throw new Exception(String.Format("missing parameter {0}", p)); throw new Exception(String.Format("missing parameter {0}", p));
if (String.IsNullOrEmpty((string)requestData[p])) if (String.IsNullOrEmpty((string)requestData[p]))
throw new Exception(String.Format("parameter {0} is empty")); throw new Exception(String.Format("parameter {0} is empty"));
} }
// check password // check password
if (!String.IsNullOrEmpty(requiredPassword) && if (!String.IsNullOrEmpty(requiredPassword) &&
(string)requestData["password"] != requiredPassword) throw new Exception("wrong password"); (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
string filename = (string)requestData["filename"]; string filename = (string)requestData["filename"];
if (requestData.Contains("region_uuid")) if (requestData.Contains("region_uuid"))
{ {
LLUUID region_uuid = (string)requestData["region_uuid"]; LLUUID region_uuid = (string)requestData["region_uuid"];
if (!m_app.SceneManager.TrySetCurrentScene(region_uuid)) if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString())); throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString()); m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
} }
else if (requestData.Contains("region_name")) else if (requestData.Contains("region_name"))
{ {
string region_name = (string)requestData["region_name"]; string region_name = (string)requestData["region_name"];
if (!m_app.SceneManager.TrySetCurrentScene(region_name)) if (!m_app.SceneManager.TrySetCurrentScene(region_name))
throw new Exception(String.Format("failed to switch to region {0}", region_name)); throw new Exception(String.Format("failed to switch to region {0}", region_name));
m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name); m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
} }
@ -589,7 +589,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0)); m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new LLVector3(0, 0, 0));
responseData["loaded"] = "true"; responseData["loaded"] = "true";
response.Value = responseData; response.Value = responseData;
} }
catch (Exception e) catch (Exception e)
@ -600,10 +600,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
responseData["loaded"] = "false"; responseData["loaded"] = "false";
responseData["switched"] = "false"; responseData["switched"] = "false";
responseData["error"] = e.Message; responseData["error"] = e.Message;
response.Value = responseData; response.Value = responseData;
} }
return response; return response;
} }

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using libsecondlife; using libsecondlife;
@ -65,7 +65,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
region_external_hostname = regInfo.ExternalHostName; region_external_hostname = regInfo.ExternalHostName;
if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName)) if (!String.IsNullOrEmpty(regInfo.MasterAvatarFirstName))
region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName, region_owner = String.Format("{0} {1}", regInfo.MasterAvatarFirstName,
regInfo.MasterAvatarLastName); regInfo.MasterAvatarLastName);
} }
} }

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
@ -57,12 +57,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
[Extension("/OpenSim/Startup")] [Extension("/OpenSim/Startup")]
public class RestRegionPlugin : RestPlugin public class RestRegionPlugin : RestPlugin
{ {
private static readonly log4net.ILog _log = private static readonly log4net.ILog _log =
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
#region overriding properties #region overriding properties
public override string Name public override string Name
{ {
get { return "REGION"; } get { return "REGION"; }
} }
@ -86,7 +86,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
try try
{ {
base.Initialise(openSim); base.Initialise(openSim);
if (IsEnabled) if (IsEnabled)
m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
else else
m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
@ -122,7 +122,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw); XmlTextWriter xw = new XmlTextWriter(sw);
xw.Formatting = Formatting.Indented; xw.Formatting = Formatting.Indented;
xw.WriteStartElement(String.Empty, "regions", String.Empty); xw.WriteStartElement(String.Empty, "regions", String.Empty);
foreach (Scene s in App.SceneManager.Scenes) foreach (Scene s in App.SceneManager.Scenes)
{ {
@ -132,7 +132,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
} }
xw.WriteEndElement(); xw.WriteEndElement();
xw.Close(); xw.Close();
return sw.ToString(); return sw.ToString();
} }
@ -154,7 +154,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
xs.Serialize(xw, new RegionDetails(scene.RegionInfo)); xs.Serialize(xw, new RegionDetails(scene.RegionInfo));
xw.Close(); xw.Close();
return sw.ToString(); return sw.ToString();
} }
#endregion methods #endregion methods

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System; using System;
@ -54,7 +54,7 @@ namespace OpenSim.ApplicationPlugins.Rest
{ {
#region properties #region properties
protected static readonly log4net.ILog m_log = protected static readonly log4net.ILog m_log =
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IConfig _config; // Configuration source: Rest Plugins private IConfig _config; // Configuration source: Rest Plugins
@ -100,8 +100,8 @@ namespace OpenSim.ApplicationPlugins.Rest
/// </summary> /// </summary>
public bool IsEnabled public bool IsEnabled
{ {
get get
{ {
return (null != _pluginConfig) && _pluginConfig.GetBoolean("enabled", false); return (null != _pluginConfig) && _pluginConfig.GetBoolean("enabled", false);
} }
} }
@ -109,7 +109,7 @@ namespace OpenSim.ApplicationPlugins.Rest
/// <summary> /// <summary>
/// OpenSimMain application /// OpenSimMain application
/// </summary> /// </summary>
public OpenSimMain App public OpenSimMain App
{ {
get { return _app; } get { return _app; }
} }
@ -117,7 +117,7 @@ namespace OpenSim.ApplicationPlugins.Rest
/// <summary> /// <summary>
/// RPC server /// RPC server
/// </summary> /// </summary>
public BaseHttpServer HttpServer public BaseHttpServer HttpServer
{ {
get { return _httpd; } get { return _httpd; }
} }
@ -171,7 +171,7 @@ namespace OpenSim.ApplicationPlugins.Rest
return; return;
} }
if (!_config.GetBoolean("enabled", false)) if (!_config.GetBoolean("enabled", false))
{ {
m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID); m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
return; return;
@ -184,10 +184,10 @@ namespace OpenSim.ApplicationPlugins.Rest
_godkey = _config.GetString("god_key", String.Empty); _godkey = _config.GetString("god_key", String.Empty);
// Retrive prefix if any. // Retrive prefix if any.
_prefix = _config.GetString("prefix", "/admin"); _prefix = _config.GetString("prefix", "/admin");
// Get plugin specific config // Get plugin specific config
_pluginConfig = openSim.ConfigSource.Configs[ConfigName]; _pluginConfig = openSim.ConfigSource.Configs[ConfigName];
m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID); m_log.InfoFormat("{0} Rest Plugins Enabled", MsgID);
} }
catch (Exception e) catch (Exception e)
@ -200,7 +200,7 @@ namespace OpenSim.ApplicationPlugins.Rest
// not possible for the openSim pointer to be null. However // not possible for the openSim pointer to be null. However
// were the implementation to be changed, this could // were the implementation to be changed, this could
// result in a silent initialization failure. Harmless // result in a silent initialization failure. Harmless
// except for lack of function and lack of any // except for lack of function and lack of any
// diagnostic indication as to why. The same is true if // diagnostic indication as to why. The same is true if
// the HTTP server reference is bad. // the HTTP server reference is bad.
// We should at least issue a message... // We should at least issue a message...
@ -214,7 +214,7 @@ namespace OpenSim.ApplicationPlugins.Rest
public void AddRestStreamHandler(string httpMethod, string path, RestMethod method) public void AddRestStreamHandler(string httpMethod, string path, RestMethod method)
{ {
if (!path.StartsWith(_prefix)) if (!path.StartsWith(_prefix))
{ {
path = String.Format("{0}{1}", _prefix, path); path = String.Format("{0}{1}", _prefix, path);
} }
@ -226,7 +226,7 @@ namespace OpenSim.ApplicationPlugins.Rest
m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path); m_log.DebugFormat("{0} Added REST handler {1} {2}", MsgID, httpMethod, path);
} }
public bool VerifyGod(string key) public bool VerifyGod(string key)
{ {
if (String.IsNullOrEmpty(key)) return false; if (String.IsNullOrEmpty(key)) return false;

View File

@ -126,7 +126,7 @@ namespace OpenSim.Data.Base
{ {
int ordinal = m_source.GetOrdinal(name); int ordinal = m_source.GetOrdinal(name);
int int32 = m_source.GetInt32(ordinal); int int32 = m_source.GetInt32(ordinal);
return int32; return int32;
} }
public Int64 GetInt64(string name) public Int64 GetInt64(string name)

View File

@ -30,7 +30,7 @@ using System.Collections.Generic;
using System.Data.Common; using System.Data.Common;
namespace OpenSim.Data.Base namespace OpenSim.Data.Base
{ {
public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj); public delegate TField ObjectGetAccessor<TObj, TField>(TObj obj);
public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value); public delegate void ObjectSetAccessor<TObj, TField>(TObj obj, TField value);

View File

@ -29,7 +29,7 @@ using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -42,8 +42,8 @@ using System.Security;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -55,11 +55,11 @@ using System.Security;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -28,7 +28,7 @@
using libsecondlife; using libsecondlife;
namespace OpenSim.Data namespace OpenSim.Data
{ {
public enum DataResponse public enum DataResponse
{ {
RESPONSE_OK, RESPONSE_OK,
@ -74,7 +74,7 @@ namespace OpenSim.Data
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
/// <summary> /// <summary>
/// Authenticates a sim by use of its recv key. /// Authenticates a sim by use of its recv key.
/// WARNING: Insecure /// WARNING: Insecure
/// </summary> /// </summary>
/// <param name="UUID">The UUID sent by the sim</param> /// <param name="UUID">The UUID sent by the sim</param>

View File

@ -28,7 +28,7 @@
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
/* /*
Taken from public code listing at by Alex Pinsker Taken from public code listing at by Alex Pinsker
http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
*/ */

View File

@ -216,7 +216,7 @@ namespace OpenSim.Data.MSSQL
override public string Version override public string Version
{ {
// get { return database.getVersion(); } // get { return database.getVersion(); }
get { return database.getVersion(); } get { return database.getVersion(); }
} }

View File

@ -140,7 +140,7 @@ namespace OpenSim.Data.MSSQL
m_landAccessListTable = createLandAccessListTable(); m_landAccessListTable = createLandAccessListTable();
m_dataSet.Tables.Add(m_landAccessListTable); m_dataSet.Tables.Add(m_landAccessListTable);
setupLandAccessCommands(m_landAccessListDataAdapter, m_connection); setupLandAccessCommands(m_landAccessListDataAdapter, m_connection);
m_landAccessListDataAdapter.Fill(m_landAccessListTable); m_landAccessListDataAdapter.Fill(m_landAccessListTable);
} }
} }
@ -172,7 +172,7 @@ namespace OpenSim.Data.MSSQL
public void RemoveObject(LLUUID obj, LLUUID regionUUID) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
// Instance.RemoveObject(obj, regionUUID); // Instance.RemoveObject(obj, regionUUID);
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
DataTable prims = m_primTable; DataTable prims = m_primTable;
@ -222,7 +222,7 @@ namespace OpenSim.Data.MSSQL
/// <summary> /// <summary>
/// Load persisted objects from region storage. /// Load persisted objects from region storage.
/// </summary> /// </summary>
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {
// return Instance.LoadObjects(regionUUID); // return Instance.LoadObjects(regionUUID);
@ -328,12 +328,12 @@ namespace OpenSim.Data.MSSQL
TaskInventoryItem item = buildItem(row); TaskInventoryItem item = buildItem(row);
inventory.Add(item); inventory.Add(item);
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
} }
prim.RestoreInventoryItems(inventory); prim.RestoreInventoryItems(inventory);
// XXX A nasty little hack to recover the folder id for the prim (which is currently stored in // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
// every item). This data should really be stored in the prim table itself. // every item). This data should really be stored in the prim table itself.
if (dbItemRows.Length > 0) if (dbItemRows.Length > 0)
{ {
@ -527,7 +527,7 @@ namespace OpenSim.Data.MSSQL
/*********************************************************************** /***********************************************************************
* *
* Database Definition Functions * Database Definition Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -742,7 +742,7 @@ namespace OpenSim.Data.MSSQL
} }
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
* *
* These should be database independant * These should be database independant
@ -1198,7 +1198,7 @@ namespace OpenSim.Data.MSSQL
m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID);
// For now, we're just going to crudely remove all the previous inventory items // For now, we're just going to crudely remove all the previous inventory items
// no matter whether they have changed or not, and replace them with the current set. // no matter whether they have changed or not, and replace them with the current set.
lock (m_dataSet) lock (m_dataSet)
{ {
@ -1209,7 +1209,7 @@ namespace OpenSim.Data.MSSQL
{ {
// m_log.InfoFormat( // m_log.InfoFormat(
// "[REGION DB]: " + // "[REGION DB]: " +
// "Adding item {0}, {1} to prim ID {2}", // "Adding item {0}, {1} to prim ID {2}",
// newItem.Name, newItem.ItemID, newItem.ParentPartID); // newItem.Name, newItem.ItemID, newItem.ParentPartID);
DataRow newItemRow = m_itemsTable.NewRow(); DataRow newItemRow = m_itemsTable.NewRow();
@ -1282,7 +1282,7 @@ namespace OpenSim.Data.MSSQL
sql += subsql; sql += subsql;
sql += " where " + pk; sql += " where " + pk;
SqlCommand cmd = new SqlCommand(sql); SqlCommand cmd = new SqlCommand(sql);
// this provides the binding for all our parameters, so // this provides the binding for all our parameters, so
// much less code than it used to be // much less code than it used to be
@ -1329,7 +1329,7 @@ namespace OpenSim.Data.MSSQL
/// This is a convenience function that collapses 5 repetitive /// This is a convenience function that collapses 5 repetitive
/// lines for defining SqlParameters to 2 parameters: /// lines for defining SqlParameters to 2 parameters:
/// column name and database type. /// column name and database type.
/// ///
/// It assumes certain conventions like :param as the param /// It assumes certain conventions like :param as the param
/// name to replace in parametrized queries, and that source /// name to replace in parametrized queries, and that source
/// version is always current version, both of which are fine /// version is always current version, both of which are fine
@ -1424,7 +1424,7 @@ namespace OpenSim.Data.MSSQL
SqlCommand tcmd = new SqlCommand(createTerrain, conn); SqlCommand tcmd = new SqlCommand(createTerrain, conn);
SqlCommand lcmd = new SqlCommand(createLand, conn); SqlCommand lcmd = new SqlCommand(createLand, conn);
SqlCommand lalcmd = new SqlCommand(createLandAccessList, conn); SqlCommand lalcmd = new SqlCommand(createLandAccessList, conn);
conn.Open(); conn.Open();
try try
{ {
@ -1604,6 +1604,6 @@ namespace OpenSim.Data.MSSQL
{ {
return DbType.String; return DbType.String;
} }
} }
} }
} }

View File

@ -79,7 +79,7 @@ namespace OpenSim.Data.MSSQL
private void TestTables() private void TestTables()
{ {
IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>()); IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>());
try try
{ {
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -88,7 +88,7 @@ namespace OpenSim.Data.MSSQL
catch (Exception) catch (Exception)
{ {
m_log.Info("[GRID DB]: MSSQL Database doesn't exist... creating"); m_log.Info("[GRID DB]: MSSQL Database doesn't exist... creating");
database.ExecuteResourceSql("Mssql-regions.sql"); database.ExecuteResourceSql("Mssql-regions.sql");
} }
} }
@ -161,7 +161,7 @@ namespace OpenSim.Data.MSSQL
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Returns a sim profile from its UUID /// Returns a sim profile from its UUID
/// </summary> /// </summary>
@ -255,17 +255,17 @@ namespace OpenSim.Data.MSSQL
{ {
//Insert new region //Insert new region
string sql = string sql =
"UPDATE " + m_regionsTableName + @" SET "UPDATE " + m_regionsTableName + @" SET
[regionHandle]=@regionHandle, [regionName]=@regionName, [regionHandle]=@regionHandle, [regionName]=@regionName,
[regionRecvKey]=@regionRecvKey, [regionSecret]=@regionSecret, [regionSendKey]=@regionSendKey, [regionRecvKey]=@regionRecvKey, [regionSecret]=@regionSecret, [regionSendKey]=@regionSendKey,
[regionDataURI]=@regionDataURI, [serverIP]=@serverIP, [serverPort]=@serverPort, [serverURI]=@serverURI, [regionDataURI]=@regionDataURI, [serverIP]=@serverIP, [serverPort]=@serverPort, [serverURI]=@serverURI,
[locX]=@locX, [locY]=@locY, [locZ]=@locZ, [eastOverrideHandle]=@eastOverrideHandle, [locX]=@locX, [locY]=@locY, [locZ]=@locZ, [eastOverrideHandle]=@eastOverrideHandle,
[westOverrideHandle]=@westOverrideHandle, [southOverrideHandle]=@southOverrideHandle, [westOverrideHandle]=@westOverrideHandle, [southOverrideHandle]=@southOverrideHandle,
[northOverrideHandle]=@northOverrideHandle, [regionAssetURI]=@regionAssetURI, [northOverrideHandle]=@northOverrideHandle, [regionAssetURI]=@regionAssetURI,
[regionAssetRecvKey]=@regionAssetRecvKey, [regionAssetSendKey]=@regionAssetSendKey, [regionAssetRecvKey]=@regionAssetRecvKey, [regionAssetSendKey]=@regionAssetSendKey,
[regionUserURI]=@regionUserURI, [regionUserRecvKey]=@regionUserRecvKey, [regionUserSendKey]=@regionUserSendKey, [regionUserURI]=@regionUserURI, [regionUserRecvKey]=@regionUserRecvKey, [regionUserSendKey]=@regionUserSendKey,
[regionMapTexture]=@regionMapTexture, [serverHttpPort]=@serverHttpPort, [regionMapTexture]=@regionMapTexture, [serverHttpPort]=@serverHttpPort,
[serverRemotingPort]=@serverRemotingPort, [owner_uuid]=@owner_uuid [serverRemotingPort]=@serverRemotingPort, [owner_uuid]=@owner_uuid
where [uuid]=@uuid"; where [uuid]=@uuid";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();

View File

@ -80,7 +80,7 @@ namespace OpenSim.Data.MSSQL
if (tableName == null) if (tableName == null)
{ {
database.ExecuteResourceSql("CreateFoldersTable.sql"); database.ExecuteResourceSql("CreateFoldersTable.sql");
//database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql"); //database.ExecuteResourceSql("UpgradeFoldersTableToVersion2.sql");
return; return;
} }
} }
@ -236,9 +236,9 @@ namespace OpenSim.Data.MSSQL
// There should only ever be one root folder for a user. However, if there's more // There should only ever be one root folder for a user. However, if there's more
// than one we'll simply use the first one rather than failing. It would be even // than one we'll simply use the first one rather than failing. It would be even
// nicer to print some message to this effect, but this feels like it's too low a // nicer to print some message to this effect, but this feels like it's too low a
// to put such a message out, and it's too minor right now to spare the time to // to put such a message out, and it's too minor right now to spare the time to
// suitably refactor. // suitably refactor.
if (items.Count > 0) if (items.Count > 0)
{ {
rootFolder = items[0]; rootFolder = items[0];
@ -326,7 +326,7 @@ namespace OpenSim.Data.MSSQL
item.GroupID = new LLUUID(reader["groupID"].ToString()); item.GroupID = new LLUUID(reader["groupID"].ToString());
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"]; item.Flags = (uint) reader["flags"];
return item; return item;
} }
catch (SqlException e) catch (SqlException e)
@ -455,7 +455,7 @@ namespace OpenSim.Data.MSSQL
+ ", @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID" + ", @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID"
+ ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType" + ", @inventoryBasePermissions, @inventoryEveryOnePermissions, @salePrice, @saleType"
+ ", @creationDate, @groupID, @groupOwned, @flags);"; + ", @creationDate, @groupID, @groupOwned, @flags);";
try try
{ {
Dictionary<string, string> param = new Dictionary<string, string>(); Dictionary<string, string> param = new Dictionary<string, string>();
@ -472,7 +472,7 @@ namespace OpenSim.Data.MSSQL
param["creatorID"] = item.Creator.ToString(); param["creatorID"] = item.Creator.ToString();
param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions); param["inventoryBasePermissions"] = Convert.ToString(item.BasePermissions);
param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions); param["inventoryEveryOnePermissions"] = Convert.ToString(item.EveryOnePermissions);
param["salePrice"] = Convert.ToString(item.SalePrice); param["salePrice"] = Convert.ToString(item.SalePrice);
param["saleType"] = Convert.ToString(item.SaleType); param["saleType"] = Convert.ToString(item.SaleType);
param["creationDate"] = Convert.ToString(item.CreationDate); param["creationDate"] = Convert.ToString(item.CreationDate);
@ -550,7 +550,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void deleteInventoryItem(LLUUID itemID) public void deleteInventoryItem(LLUUID itemID)
@ -667,7 +667,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// Append a list of all the child folders of a parent folder /// Append a list of all the child folders of a parent folder
/// </summary> /// </summary>
/// <param name="folders">list where folders will be appended</param> /// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param> /// <param name="parentID">ID of parent</param>

View File

@ -442,7 +442,7 @@ namespace OpenSim.Data.MSSQL
return returnval; return returnval;
} }
/// <summary> /// <summary>
/// Execute a SQL statement stored in a resource, as a string /// Execute a SQL statement stored in a resource, as a string
/// </summary> /// </summary>
@ -509,7 +509,7 @@ namespace OpenSim.Data.MSSQL
throw new Exception(string.Format("Resource '{0}' was not found", name)); throw new Exception(string.Format("Resource '{0}' was not found", name));
} }
/// <summary> /// <summary>
/// Returns the version of this DB provider /// Returns the version of this DB provider
/// </summary> /// </summary>
/// <returns>A string containing the DB provider</returns> /// <returns>A string containing the DB provider</returns>

View File

@ -105,7 +105,7 @@ namespace OpenSim.Data.MSSQL
{ {
database.ExecuteResourceSql("Mssql-users.sql"); database.ExecuteResourceSql("Mssql-users.sql");
} }
cmd = database.Query("select top 1 * from " + m_agentsTableName, new Dictionary<string, string>()); cmd = database.Query("select top 1 * from " + m_agentsTableName, new Dictionary<string, string>());
try try
{ {
@ -747,7 +747,7 @@ namespace OpenSim.Data.MSSQL
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
// override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
// { // {
// return new AvatarAppearance(); // return new AvatarAppearance();
// } // }
@ -761,12 +761,12 @@ namespace OpenSim.Data.MSSQL
{ {
return; return;
} }
override public void RemoveAttachment(LLUUID user, LLUUID item) override public void RemoveAttachment(LLUUID user, LLUUID item)
{ {
return; return;
} }
override public List<LLUUID> GetAttachments(LLUUID user) override public List<LLUUID> GetAttachments(LLUUID user)
{ {
return new List<LLUUID>(); return new List<LLUUID>();

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -49,7 +49,7 @@ namespace OpenSim.Data.MapperFactory
return new MSSQLDatabaseMapper(connectionString); return new MSSQLDatabaseMapper(connectionString);
default: default:
throw new ArgumentException("Unknown Database Mapper type [" + type + "]."); throw new ArgumentException("Unknown Database Mapper type [" + type + "].");
} }
} }
} }
} }

View File

@ -79,7 +79,7 @@ namespace OpenSim.Data.MySQL
_dbConnection.Connection); _dbConnection.Connection);
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
p.Value = assetID.GetBytes(); p.Value = assetID.GetBytes();
try try
{ {
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
} }
override public void CreateAsset(AssetBase asset) override public void CreateAsset(AssetBase asset)
{ {
lock (_dbConnection) lock (_dbConnection)
{ {
MySqlCommand cmd = MySqlCommand cmd =
@ -119,10 +119,10 @@ namespace OpenSim.Data.MySQL
"REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" + "REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)", "VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)",
_dbConnection.Connection); _dbConnection.Connection);
// need to ensure we dispose // need to ensure we dispose
try try
{ {
using (cmd) using (cmd)
{ {
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16); MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
@ -145,7 +145,7 @@ namespace OpenSim.Data.MySQL
"MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString() "MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString()
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name); + Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
_dbConnection.Reconnect(); _dbConnection.Reconnect();
} }
} }
} }

View File

@ -50,12 +50,12 @@ namespace OpenSim.Data.MySQL
private const string m_terrainSelect = "select * from terrain limit 1"; private const string m_terrainSelect = "select * from terrain limit 1";
private const string m_landSelect = "select * from land"; private const string m_landSelect = "select * from land";
private const string m_landAccessListSelect = "select * from landaccesslist"; private const string m_landAccessListSelect = "select * from landaccesslist";
/// <summary> /// <summary>
/// We're only using this to version the table! /// We're only using this to version the table!
/// </summary> /// </summary>
private DataSet m_dataSet; private DataSet m_dataSet;
private MySqlDataAdapter m_primDataAdapter; private MySqlDataAdapter m_primDataAdapter;
@ -65,16 +65,16 @@ namespace OpenSim.Data.MySQL
private MySqlDataAdapter m_terrainDataAdapter; private MySqlDataAdapter m_terrainDataAdapter;
private MySqlDataAdapter m_landDataAdapter; private MySqlDataAdapter m_landDataAdapter;
private MySqlDataAdapter m_landAccessListDataAdapter; private MySqlDataAdapter m_landAccessListDataAdapter;
private DataTable m_primTable; private DataTable m_primTable;
private DataTable m_shapeTable; private DataTable m_shapeTable;
private DataTable m_itemsTable; private DataTable m_itemsTable;
private DataTable m_terrainTable; private DataTable m_terrainTable;
private DataTable m_landTable; private DataTable m_landTable;
private DataTable m_landAccessListTable; private DataTable m_landAccessListTable;
// Temporary attribute while this is experimental // Temporary attribute while this is experimental
private bool persistPrimInventories; private bool persistPrimInventories;
/*********************************************************************** /***********************************************************************
* *
@ -98,9 +98,9 @@ namespace OpenSim.Data.MySQL
MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, m_connection); MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, m_connection);
m_shapeDataAdapter = new MySqlDataAdapter(shapeSelectCmd); m_shapeDataAdapter = new MySqlDataAdapter(shapeSelectCmd);
MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, m_connection); MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, m_connection);
m_itemsDataAdapter = new MySqlDataAdapter(itemsSelectCmd); m_itemsDataAdapter = new MySqlDataAdapter(itemsSelectCmd);
MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, m_connection); MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, m_connection);
m_terrainDataAdapter = new MySqlDataAdapter(terrainSelectCmd); m_terrainDataAdapter = new MySqlDataAdapter(terrainSelectCmd);
@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection); MySqlCommand landAccessListSelectCmd = new MySqlCommand(m_landAccessListSelect, m_connection);
m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd); m_landAccessListDataAdapter = new MySqlDataAdapter(landAccessListSelectCmd);
TestTables(m_connection); TestTables(m_connection);
lock (m_dataSet) lock (m_dataSet)
@ -125,13 +125,13 @@ namespace OpenSim.Data.MySQL
m_dataSet.Tables.Add(m_shapeTable); m_dataSet.Tables.Add(m_shapeTable);
SetupShapeCommands(m_shapeDataAdapter, m_connection); SetupShapeCommands(m_shapeDataAdapter, m_connection);
m_shapeDataAdapter.Fill(m_shapeTable); m_shapeDataAdapter.Fill(m_shapeTable);
if (persistPrimInventories) if (persistPrimInventories)
{ {
m_itemsTable = createItemsTable(); m_itemsTable = createItemsTable();
m_dataSet.Tables.Add(m_itemsTable); m_dataSet.Tables.Add(m_itemsTable);
SetupItemsCommands(m_itemsDataAdapter, m_connection); SetupItemsCommands(m_itemsDataAdapter, m_connection);
m_itemsDataAdapter.Fill(m_itemsTable); m_itemsDataAdapter.Fill(m_itemsTable);
} }
m_terrainTable = createTerrainTable(); m_terrainTable = createTerrainTable();
@ -195,7 +195,7 @@ namespace OpenSim.Data.MySQL
UpgradeLandTable(tableList["land"], dbconn); UpgradeLandTable(tableList["land"], dbconn);
//database.Close(); //database.Close();
} }
/// <summary> /// <summary>
@ -290,12 +290,12 @@ namespace OpenSim.Data.MySQL
{ {
shapeRow.Delete(); shapeRow.Delete();
} }
if (persistPrimInventories) if (persistPrimInventories)
{ {
RemoveItems(uuid); RemoveItems(uuid);
} }
// Remove prim row // Remove prim row
row.Delete(); row.Delete();
} }
@ -309,18 +309,18 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
private void RemoveItems(LLUUID uuid) private void RemoveItems(LLUUID uuid)
{ {
String sql = String.Format("primID = '{0}'", uuid); String sql = String.Format("primID = '{0}'", uuid);
DataRow[] itemRows = m_itemsTable.Select(sql); DataRow[] itemRows = m_itemsTable.Select(sql);
foreach (DataRow itemRow in itemRows) foreach (DataRow itemRow in itemRows)
{ {
itemRow.Delete(); itemRow.Delete();
} }
} }
/// <summary> /// <summary>
/// Load persisted objects from region storage. /// Load persisted objects from region storage.
/// </summary> /// </summary>
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {
Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>(); Dictionary<LLUUID, SceneObjectGroup> createdObjects = new Dictionary<LLUUID, SceneObjectGroup>();
@ -341,17 +341,17 @@ namespace OpenSim.Data.MySQL
foreach (DataRow primRow in primsForRegion) foreach (DataRow primRow in primsForRegion)
{ {
try try
{ {
string uuid = (string) primRow["UUID"]; string uuid = (string) primRow["UUID"];
string objID = (string) primRow["SceneGroupID"]; string objID = (string) primRow["SceneGroupID"];
SceneObjectPart prim = buildPrim(primRow); SceneObjectPart prim = buildPrim(primRow);
if (uuid == objID) //is new SceneObjectGroup ? if (uuid == objID) //is new SceneObjectGroup ?
{ {
SceneObjectGroup group = new SceneObjectGroup(); SceneObjectGroup group = new SceneObjectGroup();
DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID)); DataRow shapeRow = shapes.Rows.Find(Util.ToRawUuidString(prim.UUID));
if (shapeRow != null) if (shapeRow != null)
{ {
@ -384,11 +384,11 @@ namespace OpenSim.Data.MySQL
} }
createdObjects[new LLUUID(objID)].AddPart(prim); createdObjects[new LLUUID(objID)].AddPart(prim);
} }
if (persistPrimInventories) if (persistPrimInventories)
{ {
LoadItems(prim); LoadItems(prim);
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -403,7 +403,7 @@ namespace OpenSim.Data.MySQL
} }
return retvals; return retvals;
} }
/// <summary> /// <summary>
/// Load in a prim's persisted inventory. /// Load in a prim's persisted inventory.
/// </summary> /// </summary>
@ -411,31 +411,31 @@ namespace OpenSim.Data.MySQL
private void LoadItems(SceneObjectPart prim) private void LoadItems(SceneObjectPart prim)
{ {
//m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); //m_log.InfoFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
DataTable dbItems = m_itemsTable; DataTable dbItems = m_itemsTable;
String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql); DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
foreach (DataRow row in dbItemRows) foreach (DataRow row in dbItemRows)
{ {
TaskInventoryItem item = buildItem(row); TaskInventoryItem item = buildItem(row);
inventory.Add(item); inventory.Add(item);
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
} }
prim.RestoreInventoryItems(inventory); prim.RestoreInventoryItems(inventory);
// XXX A nasty little hack to recover the folder id for the prim (which is currently stored in // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
// every item). This data should really be stored in the prim table itself. // every item). This data should really be stored in the prim table itself.
if (dbItemRows.Length > 0) if (dbItemRows.Length > 0)
{ {
prim.FolderID = inventory[0].ParentID; prim.FolderID = inventory[0].ParentID;
} }
} }
public void StoreTerrain(double[,] ter, LLUUID regionID) public void StoreTerrain(double[,] ter, LLUUID regionID)
{ {
@ -474,8 +474,8 @@ namespace OpenSim.Data.MySQL
{ {
m_connection.Open(); m_connection.Open();
} }
lock (m_dataSet) lock (m_dataSet)
{ {
using (MySqlDataReader row = cmd.ExecuteReader()) using (MySqlDataReader row = cmd.ExecuteReader())
{ {
@ -498,7 +498,7 @@ namespace OpenSim.Data.MySQL
m_log.Info("[REGION DB]: No terrain found for region"); m_log.Info("[REGION DB]: No terrain found for region");
return null; return null;
} }
m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString()); m_log.Info("[REGION DB]: Loaded terrain revision r" + rev.ToString());
} }
} }
@ -558,7 +558,7 @@ namespace OpenSim.Data.MySQL
fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID); fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
landaccesslist.Rows.Add(newAccessRow); landaccesslist.Rows.Add(newAccessRow);
} }
Commit(); Commit();
} }
} }
@ -624,7 +624,7 @@ namespace OpenSim.Data.MySQL
/*********************************************************************** /***********************************************************************
* *
* Database Definition Functions * Database Definition Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -803,7 +803,7 @@ namespace OpenSim.Data.MySQL
return shapes; return shapes;
} }
private static DataTable createItemsTable() private static DataTable createItemsTable()
{ {
DataTable items = new DataTable("primitems"); DataTable items = new DataTable("primitems");
@ -812,8 +812,8 @@ namespace OpenSim.Data.MySQL
createCol(items, "primID", typeof (String)); createCol(items, "primID", typeof (String));
createCol(items, "assetID", typeof (String)); createCol(items, "assetID", typeof (String));
createCol(items, "parentFolderID", typeof (String)); createCol(items, "parentFolderID", typeof (String));
createCol(items, "invType", typeof (Int32)); createCol(items, "invType", typeof (Int32));
createCol(items, "assetType", typeof (Int32)); createCol(items, "assetType", typeof (Int32));
createCol(items, "name", typeof (String)); createCol(items, "name", typeof (String));
@ -834,10 +834,10 @@ namespace OpenSim.Data.MySQL
items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]}; items.PrimaryKey = new DataColumn[] {items.Columns["itemID"]};
return items; return items;
} }
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
* *
* These should be database independant * These should be database independant
@ -932,8 +932,8 @@ namespace OpenSim.Data.MySQL
} }
return prim; return prim;
} }
/// <summary> /// <summary>
/// Build a prim inventory item from the persisted data. /// Build a prim inventory item from the persisted data.
/// </summary> /// </summary>
@ -942,15 +942,15 @@ namespace OpenSim.Data.MySQL
private static TaskInventoryItem buildItem(DataRow row) private static TaskInventoryItem buildItem(DataRow row)
{ {
TaskInventoryItem taskItem = new TaskInventoryItem(); TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ItemID = new LLUUID((String)row["itemID"]); taskItem.ItemID = new LLUUID((String)row["itemID"]);
taskItem.ParentPartID = new LLUUID((String)row["primID"]); taskItem.ParentPartID = new LLUUID((String)row["primID"]);
taskItem.AssetID = new LLUUID((String)row["assetID"]); taskItem.AssetID = new LLUUID((String)row["assetID"]);
taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); taskItem.ParentID = new LLUUID((String)row["parentFolderID"]);
taskItem.InvType = Convert.ToInt32(row["invType"]); taskItem.InvType = Convert.ToInt32(row["invType"]);
taskItem.Type = Convert.ToInt32(row["assetType"]); taskItem.Type = Convert.ToInt32(row["assetType"]);
taskItem.Name = (String)row["name"]; taskItem.Name = (String)row["name"];
taskItem.Description = (String)row["description"]; taskItem.Description = (String)row["description"];
taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
@ -958,15 +958,15 @@ namespace OpenSim.Data.MySQL
taskItem.OwnerID = new LLUUID((String)row["ownerID"]); taskItem.OwnerID = new LLUUID((String)row["ownerID"]);
taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]);
taskItem.GroupID = new LLUUID((String)row["groupID"]); taskItem.GroupID = new LLUUID((String)row["groupID"]);
taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]);
taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]);
taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]);
taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]);
taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]);
return taskItem; return taskItem;
} }
private static LandData buildLandData(DataRow row) private static LandData buildLandData(DataRow row)
{ {
@ -1117,17 +1117,17 @@ namespace OpenSim.Data.MySQL
} }
} }
} }
private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
{ {
row["itemID"] = taskItem.ItemID; row["itemID"] = taskItem.ItemID;
row["primID"] = taskItem.ParentPartID; row["primID"] = taskItem.ParentPartID;
row["assetID"] = taskItem.AssetID; row["assetID"] = taskItem.AssetID;
row["parentFolderID"] = taskItem.ParentID; row["parentFolderID"] = taskItem.ParentID;
row["invType"] = taskItem.InvType; row["invType"] = taskItem.InvType;
row["assetType"] = taskItem.Type; row["assetType"] = taskItem.Type;
row["name"] = taskItem.Name; row["name"] = taskItem.Name;
row["description"] = taskItem.Description; row["description"] = taskItem.Description;
row["creationDate"] = taskItem.CreationDate; row["creationDate"] = taskItem.CreationDate;
@ -1140,7 +1140,7 @@ namespace OpenSim.Data.MySQL
row["basePermissions"] = taskItem.BaseMask; row["basePermissions"] = taskItem.BaseMask;
row["everyonePermissions"] = taskItem.EveryoneMask; row["everyonePermissions"] = taskItem.EveryoneMask;
row["groupPermissions"] = taskItem.GroupMask; row["groupPermissions"] = taskItem.GroupMask;
} }
private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID) private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
{ {
@ -1322,39 +1322,39 @@ namespace OpenSim.Data.MySQL
else else
{ {
fillShapeRow(shapeRow, prim); fillShapeRow(shapeRow, prim);
} }
} }
// see IRegionDatastore // see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
if (!persistPrimInventories) if (!persistPrimInventories)
return; return;
m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Persisting Prim Inventory with prim ID {0}", primID);
// For now, we're just going to crudely remove all the previous inventory items // For now, we're just going to crudely remove all the previous inventory items
// no matter whether they have changed or not, and replace them with the current set. // no matter whether they have changed or not, and replace them with the current set.
lock (m_dataSet) lock (m_dataSet)
{ {
RemoveItems(primID); RemoveItems(primID);
// repalce with current inventory details // repalce with current inventory details
foreach (TaskInventoryItem newItem in items) foreach (TaskInventoryItem newItem in items)
{ {
// m_log.InfoFormat( // m_log.InfoFormat(
// "[REGION DB]: " + // "[REGION DB]: " +
// "Adding item {0}, {1} to prim ID {2}", // "Adding item {0}, {1} to prim ID {2}",
// newItem.Name, newItem.ItemID, newItem.ParentPartID); // newItem.Name, newItem.ItemID, newItem.ParentPartID);
DataRow newItemRow = m_itemsTable.NewRow(); DataRow newItemRow = m_itemsTable.NewRow();
fillItemRow(newItemRow, newItem); fillItemRow(newItemRow, newItem);
m_itemsTable.Rows.Add(newItemRow); m_itemsTable.Rows.Add(newItemRow);
} }
} }
Commit(); Commit();
} }
/*********************************************************************** /***********************************************************************
* *
@ -1447,9 +1447,9 @@ namespace OpenSim.Data.MySQL
} }
sql += subsql; sql += subsql;
sql += ")"; sql += ")";
//m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql); //m_log.InfoFormat("[DATASTORE]: defineTable() sql {0}", sql);
return sql; return sql;
} }
@ -1466,7 +1466,7 @@ namespace OpenSim.Data.MySQL
/// This is a convenience function that collapses 5 repetitive /// This is a convenience function that collapses 5 repetitive
/// lines for defining MySqlParameters to 2 parameters: /// lines for defining MySqlParameters to 2 parameters:
/// column name and database type. /// column name and database type.
/// ///
/// It assumes certain conventions like ?param as the param /// It assumes certain conventions like ?param as the param
/// name to replace in parametrized queries, and that source /// name to replace in parametrized queries, and that source
/// version is always current version, both of which are fine /// version is always current version, both of which are fine
@ -1498,7 +1498,7 @@ namespace OpenSim.Data.MySQL
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn) private void SetupItemsCommands(MySqlDataAdapter da, MySqlConnection conn)
{ {
da.InsertCommand = createInsertCommand("primitems", m_itemsTable); da.InsertCommand = createInsertCommand("primitems", m_itemsTable);
@ -1511,7 +1511,7 @@ namespace OpenSim.Data.MySQL
delete.Parameters.Add(createMySqlParameter("itemID", typeof (String))); delete.Parameters.Add(createMySqlParameter("itemID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn) private void SetupTerrainCommands(MySqlDataAdapter da, MySqlConnection conn)
{ {
@ -1597,7 +1597,7 @@ namespace OpenSim.Data.MySQL
{ {
m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e); m_log.WarnFormat("[REGION DB]: Shapes Table Already Exists: {0}", e);
} }
try try
{ {
icmd.ExecuteNonQuery(); icmd.ExecuteNonQuery();
@ -1605,7 +1605,7 @@ namespace OpenSim.Data.MySQL
catch (MySqlException e) catch (MySqlException e)
{ {
m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e); m_log.WarnFormat("[REGION DB]: Items Table Already Exists: {0}", e);
} }
try try
{ {
@ -1643,7 +1643,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn); MySqlCommand shapeSelectCmd = new MySqlCommand(m_shapeSelect, conn);
MySqlDataAdapter sDa = new MySqlDataAdapter(shapeSelectCmd); MySqlDataAdapter sDa = new MySqlDataAdapter(shapeSelectCmd);
MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, conn); MySqlCommand itemsSelectCmd = new MySqlCommand(m_itemsSelect, conn);
MySqlDataAdapter iDa = new MySqlDataAdapter(itemsSelectCmd); MySqlDataAdapter iDa = new MySqlDataAdapter(itemsSelectCmd);
MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, conn); MySqlCommand terrainSelectCmd = new MySqlCommand(m_terrainSelect, conn);
MySqlDataAdapter tDa = new MySqlDataAdapter(terrainSelectCmd); MySqlDataAdapter tDa = new MySqlDataAdapter(terrainSelectCmd);
MySqlCommand landSelectCmd = new MySqlCommand(m_landSelect, conn); MySqlCommand landSelectCmd = new MySqlCommand(m_landSelect, conn);
@ -1656,10 +1656,10 @@ namespace OpenSim.Data.MySQL
{ {
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
if (persistPrimInventories) if (persistPrimInventories)
iDa.Fill(tmpDS, "primitems"); iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain"); tDa.Fill(tmpDS, "terrain");
lDa.Fill(tmpDS, "land"); lDa.Fill(tmpDS, "land");
lalDa.Fill(tmpDS, "landaccesslist"); lalDa.Fill(tmpDS, "landaccesslist");
@ -1672,10 +1672,10 @@ namespace OpenSim.Data.MySQL
pDa.Fill(tmpDS, "prims"); pDa.Fill(tmpDS, "prims");
sDa.Fill(tmpDS, "primshapes"); sDa.Fill(tmpDS, "primshapes");
if (persistPrimInventories) if (persistPrimInventories)
iDa.Fill(tmpDS, "primitems"); iDa.Fill(tmpDS, "primitems");
tDa.Fill(tmpDS, "terrain"); tDa.Fill(tmpDS, "terrain");
lDa.Fill(tmpDS, "land"); lDa.Fill(tmpDS, "land");
lalDa.Fill(tmpDS, "landaccesslist"); lalDa.Fill(tmpDS, "landaccesslist");
@ -1688,7 +1688,7 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
foreach (DataColumn col in createShapeTable().Columns) foreach (DataColumn col in createShapeTable().Columns)
{ {
if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName)) if (!tmpDS.Tables["primshapes"].Columns.Contains(col.ColumnName))
@ -1697,9 +1697,9 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
// XXX primitems should probably go here eventually // XXX primitems should probably go here eventually
foreach (DataColumn col in createTerrainTable().Columns) foreach (DataColumn col in createTerrainTable().Columns)
{ {
if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName)) if (!tmpDS.Tables["terrain"].Columns.Contains(col.ColumnName))
@ -1708,7 +1708,7 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
foreach (DataColumn col in createLandTable().Columns) foreach (DataColumn col in createLandTable().Columns)
{ {
if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName)) if (!tmpDS.Tables["land"].Columns.Contains(col.ColumnName))
@ -1717,7 +1717,7 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
foreach (DataColumn col in createLandAccessListTable().Columns) foreach (DataColumn col in createLandAccessListTable().Columns)
{ {
if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName)) if (!tmpDS.Tables["landaccesslist"].Columns.Contains(col.ColumnName))
@ -1726,7 +1726,7 @@ namespace OpenSim.Data.MySQL
return false; return false;
} }
} }
return true; return true;
} }
@ -1783,7 +1783,7 @@ namespace OpenSim.Data.MySQL
else if (type == typeof (Int64)) else if (type == typeof (Int64))
{ {
return "bigint"; return "bigint";
} }
else if (type == typeof (Double)) else if (type == typeof (Double))
{ {
return "float"; return "float";

View File

@ -40,7 +40,7 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
public class MySQLInventoryData : IInventoryData public class MySQLInventoryData : IInventoryData
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
@ -249,7 +249,7 @@ namespace OpenSim.Data.MySQL
// There should only ever be one root folder for a user. However, if there's more // There should only ever be one root folder for a user. However, if there's more
// than one we'll simply use the first one rather than failing. It would be even // than one we'll simply use the first one rather than failing. It would be even
// nicer to print some message to this effect, but this feels like it's too low a // nicer to print some message to this effect, but this feels like it's too low a
// to put such a message out, and it's too minor right now to spare the time to // to put such a message out, and it's too minor right now to spare the time to
// suitably refactor. // suitably refactor.
if (items.Count > 0) if (items.Count > 0)
@ -332,13 +332,13 @@ namespace OpenSim.Data.MySQL
item.InvType = (int) reader["invType"]; item.InvType = (int) reader["invType"];
item.Creator = new LLUUID((string) reader["creatorID"]); item.Creator = new LLUUID((string) reader["creatorID"]);
item.BasePermissions = (uint) reader["inventoryBasePermissions"]; item.BasePermissions = (uint) reader["inventoryBasePermissions"];
item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
item.SalePrice = (int) reader["salePrice"]; item.SalePrice = (int) reader["salePrice"];
item.SaleType = Convert.ToByte(reader["saleType"]); item.SaleType = Convert.ToByte(reader["saleType"]);
item.CreationDate = (int) reader["creationDate"]; item.CreationDate = (int) reader["creationDate"];
item.GroupID = new LLUUID(reader["groupID"].ToString()); item.GroupID = new LLUUID(reader["groupID"].ToString());
item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
item.Flags = (uint) reader["flags"]; item.Flags = (uint) reader["flags"];
return item; return item;
} }
@ -483,12 +483,12 @@ namespace OpenSim.Data.MySQL
result.Parameters.AddWithValue("?groupID", item.GroupID); result.Parameters.AddWithValue("?groupID", item.GroupID);
result.Parameters.AddWithValue("?groupOwned", item.GroupOwned); result.Parameters.AddWithValue("?groupOwned", item.GroupOwned);
result.Parameters.AddWithValue("?flags", item.Flags); result.Parameters.AddWithValue("?flags", item.Flags);
lock (database) lock (database)
{ {
result.ExecuteNonQuery(); result.ExecuteNonQuery();
} }
result.Dispose(); result.Dispose();
} }
catch (MySqlException e) catch (MySqlException e)
@ -507,7 +507,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void deleteInventoryItem(LLUUID itemID) public void deleteInventoryItem(LLUUID itemID)
@ -517,7 +517,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection); new MySqlCommand("DELETE FROM inventoryitems WHERE inventoryID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", itemID.ToString()); cmd.Parameters.AddWithValue("?uuid", itemID.ToString());
lock (database) lock (database)
{ {
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -596,7 +596,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// Append a list of all the child folders of a parent folder /// Append a list of all the child folders of a parent folder
/// </summary> /// </summary>
/// <param name="folders">list where folders will be appended</param> /// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param> /// <param name="parentID">ID of parent</param>
@ -623,11 +623,11 @@ namespace OpenSim.Data.MySQL
protected void deleteOneFolder(LLUUID folderID) protected void deleteOneFolder(LLUUID folderID)
{ {
try try
{ {
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection); new MySqlCommand("DELETE FROM inventoryfolders WHERE folderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (database) lock (database)
{ {
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
@ -647,7 +647,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection); new MySqlCommand("DELETE FROM inventoryitems WHERE parentFolderID=?uuid", database.Connection);
cmd.Parameters.AddWithValue("?uuid", folderID.ToString()); cmd.Parameters.AddWithValue("?uuid", folderID.ToString());
lock (database) lock (database)
{ {
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();

View File

@ -302,7 +302,7 @@ namespace OpenSim.Data.MySQL
// Region Main gotta-have-or-we-return-null parts // Region Main gotta-have-or-we-return-null parts
UInt64 tmp64; UInt64 tmp64;
if (!UInt64.TryParse(reader["regionHandle"].ToString(), out tmp64)) if (!UInt64.TryParse(reader["regionHandle"].ToString(), out tmp64))
{ {
return null; return null;
} }
else else
@ -310,7 +310,7 @@ namespace OpenSim.Data.MySQL
retval.regionHandle = tmp64; retval.regionHandle = tmp64;
} }
LLUUID tmp_uuid; LLUUID tmp_uuid;
if (!LLUUID.TryParse((string)reader["uuid"], out tmp_uuid)) if (!LLUUID.TryParse((string)reader["uuid"], out tmp_uuid))
{ {
return null; return null;
} }
@ -321,7 +321,7 @@ namespace OpenSim.Data.MySQL
// non-critical parts // non-critical parts
retval.regionName = (string)reader["regionName"]; retval.regionName = (string)reader["regionName"];
retval.originUUID = new LLUUID((string) reader["originUUID"]); retval.originUUID = new LLUUID((string) reader["originUUID"]);
// Secrets // Secrets
retval.regionRecvKey = (string) reader["regionRecvKey"]; retval.regionRecvKey = (string) reader["regionRecvKey"];
@ -360,8 +360,8 @@ namespace OpenSim.Data.MySQL
// World Map Addition // World Map Addition
LLUUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID); LLUUID.TryParse((string)reader["regionMapTexture"], out retval.regionMapTextureID);
LLUUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid); LLUUID.TryParse((string)reader["owner_uuid"], out retval.owner_uuid);
} }
else else
{ {
return null; return null;
@ -418,7 +418,7 @@ namespace OpenSim.Data.MySQL
LLUUID.TryParse((string) reader["sessionID"], out tmp); LLUUID.TryParse((string) reader["sessionID"], out tmp);
retval.SessionID = tmp; retval.SessionID = tmp;
LLUUID.TryParse((string)reader["secureSessionID"], out tmp); LLUUID.TryParse((string)reader["secureSessionID"], out tmp);
retval.SecureSessionID = tmp; retval.SecureSessionID = tmp;
@ -488,7 +488,7 @@ namespace OpenSim.Data.MySQL
if (reader.IsDBNull(reader.GetOrdinal("profileAboutText"))) if (reader.IsDBNull(reader.GetOrdinal("profileAboutText")))
retval.AboutText = ""; retval.AboutText = "";
else else
retval.AboutText = (string) reader["profileAboutText"]; retval.AboutText = (string) reader["profileAboutText"];
if (reader.IsDBNull(reader.GetOrdinal("profileFirstText"))) if (reader.IsDBNull(reader.GetOrdinal("profileFirstText")))
@ -511,7 +511,7 @@ namespace OpenSim.Data.MySQL
LLUUID.TryParse((string)reader["profileFirstImage"], out tmp); LLUUID.TryParse((string)reader["profileFirstImage"], out tmp);
retval.FirstLifeImage = tmp; retval.FirstLifeImage = tmp;
} }
if (reader.IsDBNull(reader.GetOrdinal("webLoginKey"))) if (reader.IsDBNull(reader.GetOrdinal("webLoginKey")))
{ {
retval.WebLoginKey = LLUUID.Zero; retval.WebLoginKey = LLUUID.Zero;

View File

@ -59,7 +59,7 @@ namespace OpenSim.Data.MySQL
{ {
// TODO: actually do something with our connect string // TODO: actually do something with our connect string
// instead of loading the second config // instead of loading the second config
IniFile iniFile = new IniFile("mysql_connection.ini"); IniFile iniFile = new IniFile("mysql_connection.ini");
string settingHostname = iniFile.ParseFileReadValue("hostname"); string settingHostname = iniFile.ParseFileReadValue("hostname");
string settingDatabase = iniFile.ParseFileReadValue("database"); string settingDatabase = iniFile.ParseFileReadValue("database");
@ -67,7 +67,7 @@ namespace OpenSim.Data.MySQL
string settingPassword = iniFile.ParseFileReadValue("password"); string settingPassword = iniFile.ParseFileReadValue("password");
string settingPooling = iniFile.ParseFileReadValue("pooling"); string settingPooling = iniFile.ParseFileReadValue("pooling");
string settingPort = iniFile.ParseFileReadValue("port"); string settingPort = iniFile.ParseFileReadValue("port");
m_usersTableName = iniFile.ParseFileReadValue("userstablename"); m_usersTableName = iniFile.ParseFileReadValue("userstablename");
if (m_usersTableName == null) if (m_usersTableName == null)
{ {
@ -206,15 +206,15 @@ namespace OpenSim.Data.MySQL
param["?friendID"] = friend.UUID.ToString(); param["?friendID"] = friend.UUID.ToString();
param["?friendPerms"] = perms.ToString(); param["?friendPerms"] = perms.ToString();
param["?datetimestamp"] = dtvalue.ToString(); param["?datetimestamp"] = dtvalue.ToString();
try try
{ {
lock (database) lock (database)
{ {
IDbCommand adder = IDbCommand adder =
database.Query( database.Query(
"INSERT INTO `" + m_userFriendsTableName + "` " + "INSERT INTO `" + m_userFriendsTableName + "` " +
"(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " + "(`ownerID`,`friendID`,`friendPerms`,`datetimestamp`) " +
"VALUES " + "VALUES " +
"(?ownerID,?friendID,?friendPerms,?datetimestamp)", "(?ownerID,?friendID,?friendPerms,?datetimestamp)",
param); param);
@ -325,7 +325,7 @@ namespace OpenSim.Data.MySQL
// This is not a real column in the database table, it's a joined column from the opposite record // This is not a real column in the database table, it's a joined column from the opposite record
fli.FriendListOwnerPerms = (uint)Convert.ToInt32(reader["ownerperms"]); fli.FriendListOwnerPerms = (uint)Convert.ToInt32(reader["ownerperms"]);
Lfli.Add(fli); Lfli.Add(fli);
} }
reader.Close(); reader.Close();
@ -599,7 +599,7 @@ namespace OpenSim.Data.MySQL
user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText, user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey); user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey);
} }
return true; return true;
} }
@ -630,7 +630,7 @@ namespace OpenSim.Data.MySQL
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
// override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
// { // {
// return new AvatarAppearance(); // return new AvatarAppearance();
// } // }
@ -644,12 +644,12 @@ namespace OpenSim.Data.MySQL
{ {
return; return;
} }
override public void RemoveAttachment(LLUUID user, LLUUID item) override public void RemoveAttachment(LLUUID user, LLUUID item)
{ {
return; return;
} }
override public List<LLUUID> GetAttachments(LLUUID user) override public List<LLUUID> GetAttachments(LLUUID user)
{ {
return new List<LLUUID>(); return new List<LLUUID>();

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -35,7 +35,7 @@ using NHibernate.UserTypes;
namespace OpenSim.Data.NHibernate namespace OpenSim.Data.NHibernate
{ {
[Serializable] [Serializable]
public class LLUUIDUserType: IUserType public class LLUUIDUserType: IUserType
{ {
public object Assemble(object cached, object owner) public object Assemble(object cached, object owner)
{ {
@ -69,7 +69,7 @@ namespace OpenSim.Data.NHibernate
public object NullSafeGet(IDataReader rs, string[] names, object owner) public object NullSafeGet(IDataReader rs, string[] names, object owner)
{ {
object uuid = null; object uuid = null;
int ord = rs.GetOrdinal(names[0]); int ord = rs.GetOrdinal(names[0]);
if (!rs.IsDBNull(ord)) if (!rs.IsDBNull(ord))

View File

@ -65,20 +65,20 @@ namespace OpenSim.Data.NHibernate
// TODO: make this a real exception type // TODO: make this a real exception type
throw new Exception("Malformed Inventory connection string '" + connect + "'"); throw new Exception("Malformed Inventory connection string '" + connect + "'");
} }
// NHibernate setup // NHibernate setup
cfg = new Configuration(); cfg = new Configuration();
cfg.SetProperty(Environment.ConnectionProvider, cfg.SetProperty(Environment.ConnectionProvider,
"NHibernate.Connection.DriverConnectionProvider"); "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(Environment.Dialect, cfg.SetProperty(Environment.Dialect,
"NHibernate.Dialect." + parts[0]); "NHibernate.Dialect." + parts[0]);
cfg.SetProperty(Environment.ConnectionDriver, cfg.SetProperty(Environment.ConnectionDriver,
"NHibernate.Driver." + parts[1]); "NHibernate.Driver." + parts[1]);
cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.SetProperty(Environment.ConnectionString, parts[2]);
cfg.AddAssembly("OpenSim.Data.NHibernate"); cfg.AddAssembly("OpenSim.Data.NHibernate");
HbmSerializer.Default.Validate = true; HbmSerializer.Default.Validate = true;
using ( MemoryStream stream = using ( MemoryStream stream =
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
cfg.AddInputStream(stream); cfg.AddInputStream(stream);

View File

@ -62,23 +62,23 @@ namespace OpenSim.Data.NHibernate
// TODO: make this a real exception type // TODO: make this a real exception type
throw new Exception("Malformed Inventory connection string '" + connect + "'"); throw new Exception("Malformed Inventory connection string '" + connect + "'");
} }
// Establish NHibernate Connection // Establish NHibernate Connection
cfg = new Configuration(); cfg = new Configuration();
cfg.SetProperty(Environment.ConnectionProvider, cfg.SetProperty(Environment.ConnectionProvider,
"NHibernate.Connection.DriverConnectionProvider"); "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(Environment.Dialect, cfg.SetProperty(Environment.Dialect,
"NHibernate.Dialect." + parts[0]); "NHibernate.Dialect." + parts[0]);
cfg.SetProperty(Environment.ConnectionDriver, cfg.SetProperty(Environment.ConnectionDriver,
"NHibernate.Driver." + parts[1]); "NHibernate.Driver." + parts[1]);
cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.SetProperty(Environment.ConnectionString, parts[2]);
cfg.AddAssembly("OpenSim.Data.NHibernate"); cfg.AddAssembly("OpenSim.Data.NHibernate");
HbmSerializer.Default.Validate = true; HbmSerializer.Default.Validate = true;
using ( MemoryStream stream = using ( MemoryStream stream =
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
cfg.AddInputStream(stream); cfg.AddInputStream(stream);
// If uncommented this will auto create tables, but it // If uncommented this will auto create tables, but it
// does drops of the old tables, so we need a smarter way // does drops of the old tables, so we need a smarter way
// to acturally manage this. // to acturally manage this.
@ -120,8 +120,8 @@ namespace OpenSim.Data.NHibernate
/***************************************************************** /*****************************************************************
* *
* Basic CRUD operations on Data * Basic CRUD operations on Data
* *
****************************************************************/ ****************************************************************/
// READ // READ
@ -195,7 +195,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void deleteInventoryItem(LLUUID itemID) public void deleteInventoryItem(LLUUID itemID)
@ -279,7 +279,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
public void deleteInventoryFolder(LLUUID folderID) public void deleteInventoryFolder(LLUUID folderID)
@ -353,7 +353,7 @@ namespace OpenSim.Data.NHibernate
{ {
updateInventoryItem(item); updateInventoryItem(item);
} }
/// <summary> /// <summary>
@ -403,9 +403,9 @@ namespace OpenSim.Data.NHibernate
return null; return null;
} }
} }
/// <summary> /// <summary>
/// Append a list of all the child folders of a parent folder /// Append a list of all the child folders of a parent folder
/// </summary> /// </summary>
/// <param name="folders">list where folders will be appended</param> /// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param> /// <param name="parentID">ID of parent</param>
@ -413,7 +413,7 @@ namespace OpenSim.Data.NHibernate
{ {
using (ISession session = factory.OpenSession()) using (ISession session = factory.OpenSession())
{ {
ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase)); ICriteria criteria = session.CreateCriteria(typeof(InventoryFolderBase));
criteria.Add(Expression.Eq("ParentID", parentID)); criteria.Add(Expression.Eq("ParentID", parentID));
foreach (InventoryFolderBase item in criteria.List()) foreach (InventoryFolderBase item in criteria.List())
@ -443,7 +443,7 @@ namespace OpenSim.Data.NHibernate
for (int i = 0; i < folders.Count; i++) for (int i = 0; i < folders.Count; i++)
getInventoryFolders(ref folders, folders[i].ID); getInventoryFolders(ref folders, folders[i].ID);
return folders; return folders;
} }
} }

View File

@ -64,20 +64,20 @@ namespace OpenSim.Data.NHibernate
// This is stubbing for now, it will become dynamic later and support different db backends // This is stubbing for now, it will become dynamic later and support different db backends
cfg = new Configuration(); cfg = new Configuration();
cfg.SetProperty(Environment.ConnectionProvider, cfg.SetProperty(Environment.ConnectionProvider,
"NHibernate.Connection.DriverConnectionProvider"); "NHibernate.Connection.DriverConnectionProvider");
cfg.SetProperty(Environment.Dialect, cfg.SetProperty(Environment.Dialect,
"NHibernate.Dialect." + parts[0]); "NHibernate.Dialect." + parts[0]);
cfg.SetProperty(Environment.ConnectionDriver, cfg.SetProperty(Environment.ConnectionDriver,
"NHibernate.Driver." + parts[1]); "NHibernate.Driver." + parts[1]);
cfg.SetProperty(Environment.ConnectionString, parts[2]); cfg.SetProperty(Environment.ConnectionString, parts[2]);
cfg.AddAssembly("OpenSim.Data.NHibernate"); cfg.AddAssembly("OpenSim.Data.NHibernate");
HbmSerializer.Default.Validate = true; HbmSerializer.Default.Validate = true;
using ( MemoryStream stream = using ( MemoryStream stream =
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
cfg.AddInputStream(stream); cfg.AddInputStream(stream);
// new SchemaExport(cfg).Create(true, true); // new SchemaExport(cfg).Create(true, true);
factory = cfg.BuildSessionFactory(); factory = cfg.BuildSessionFactory();
@ -122,7 +122,7 @@ namespace OpenSim.Data.NHibernate
// BUG: CATCHALL IS BAD. // BUG: CATCHALL IS BAD.
} }
catch (Exception) {} catch (Exception) {}
return (user != null); return (user != null);
} }
@ -151,7 +151,7 @@ namespace OpenSim.Data.NHibernate
// TODO: save agent // TODO: save agent
transaction.Commit(); transaction.Commit();
} }
} }
} }
else else
{ {
@ -162,7 +162,7 @@ namespace OpenSim.Data.NHibernate
private static void SetAgentData(LLUUID uuid, UserAgentData agent, ISession session) private static void SetAgentData(LLUUID uuid, UserAgentData agent, ISession session)
{ {
if (agent == null) if (agent == null)
{ {
// TODO: got to figure out how to do a delete right // TODO: got to figure out how to do a delete right
} }
@ -178,7 +178,7 @@ namespace OpenSim.Data.NHibernate
session.Update(agent); session.Update(agent);
} }
} }
} }
override public bool UpdateUserProfile(UserProfileData profile) override public bool UpdateUserProfile(UserProfileData profile)
{ {
@ -193,7 +193,7 @@ namespace OpenSim.Data.NHibernate
transaction.Commit(); transaction.Commit();
return true; return true;
} }
} }
} }
else else
{ {
@ -202,7 +202,7 @@ namespace OpenSim.Data.NHibernate
return true; return true;
} }
} }
override public void AddNewUserAgent(UserAgentData agent) override public void AddNewUserAgent(UserAgentData agent)
{ {
using (ISession session = factory.OpenSession()) using (ISession session = factory.OpenSession())
@ -212,9 +212,9 @@ namespace OpenSim.Data.NHibernate
session.Save(agent); session.Save(agent);
transaction.Commit(); transaction.Commit();
} }
} }
} }
public void UpdateUserAgent(UserAgentData agent) public void UpdateUserAgent(UserAgentData agent)
{ {
using (ISession session = factory.OpenSession()) using (ISession session = factory.OpenSession())
@ -224,7 +224,7 @@ namespace OpenSim.Data.NHibernate
session.Update(agent); session.Update(agent);
transaction.Commit(); transaction.Commit();
} }
} }
} }
override public UserAgentData GetAgentByUUID(LLUUID uuid) override public UserAgentData GetAgentByUUID(LLUUID uuid)
@ -262,7 +262,7 @@ namespace OpenSim.Data.NHibernate
{ {
return GetUserByName(fname, lname).CurrentAgent; return GetUserByName(fname, lname).CurrentAgent;
} }
override public UserAgentData GetAgentByName(string name) override public UserAgentData GetAgentByName(string name)
{ {
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]); return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
@ -273,7 +273,7 @@ namespace OpenSim.Data.NHibernate
List<AvatarPickerAvatar> results = new List<AvatarPickerAvatar>(); List<AvatarPickerAvatar> results = new List<AvatarPickerAvatar>();
string[] querysplit; string[] querysplit;
querysplit = query.Split(' '); querysplit = query.Split(' ');
if (querysplit.Length == 2) if (querysplit.Length == 2)
{ {
using (ISession session = factory.OpenSession()) using (ISession session = factory.OpenSession())
@ -293,7 +293,7 @@ namespace OpenSim.Data.NHibernate
} }
return results; return results;
} }
// TODO: actually implement these // TODO: actually implement these
public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) {return;} public override void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid) {return;}
public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;} public override void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey) {return;}
@ -306,7 +306,7 @@ namespace OpenSim.Data.NHibernate
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
public AvatarAppearance GetUserAppearance(LLUUID user) public AvatarAppearance GetUserAppearance(LLUUID user)
{ {
AvatarAppearance appearance; AvatarAppearance appearance;
// TODO: I'm sure I'll have to do something silly here // TODO: I'm sure I'll have to do something silly here
@ -345,19 +345,19 @@ namespace OpenSim.Data.NHibernate
} }
transaction.Commit(); transaction.Commit();
} }
} }
} }
override public void AddAttachment(LLUUID user, LLUUID item) override public void AddAttachment(LLUUID user, LLUUID item)
{ {
return; return;
} }
override public void RemoveAttachment(LLUUID user, LLUUID item) override public void RemoveAttachment(LLUUID user, LLUUID item)
{ {
return; return;
} }
override public List<LLUUID> GetAttachments(LLUUID user) override public List<LLUUID> GetAttachments(LLUUID user)
{ {
return new List<LLUUID>(); return new List<LLUUID>();

View File

@ -47,11 +47,11 @@ namespace OpenSim.Data.Null
public void RemoveObject(LLUUID obj, LLUUID regionUUID) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
} }
// see IRegionDatastore // see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
} }
public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID) public List<SceneObjectGroup> LoadObjects(LLUUID regionUUID)
{ {

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -95,6 +95,6 @@ namespace OpenSim.Data
} }
return value; return value;
} }
} }
} }

View File

@ -135,7 +135,7 @@ namespace OpenSim.Data
rowMapperSchema.AddMapping<byte[]>("ExtraParams", rowMapperSchema.AddMapping<byte[]>("ExtraParams",
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; }, delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; },
delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; }); delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; });
} }
public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader) public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader)

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -120,7 +120,7 @@ namespace OpenSim.Data
public LLUUID regionMapTextureID = new LLUUID("00000000-0000-1111-9999-000000000006"); public LLUUID regionMapTextureID = new LLUUID("00000000-0000-1111-9999-000000000006");
/// <summary> /// <summary>
/// this particular mod to the file provides support within the spec for RegionProfileData for the /// this particular mod to the file provides support within the spec for RegionProfileData for the
/// owner_uuid for the region /// owner_uuid for the region
/// </summary> /// </summary>
public LLUUID owner_uuid = LLUUID.Zero; public LLUUID owner_uuid = LLUUID.Zero;
@ -128,7 +128,7 @@ namespace OpenSim.Data
/// <summary> /// <summary>
/// OGS/OpenSim Specific original ID for a region after move/split /// OGS/OpenSim Specific original ID for a region after move/split
/// </summary> /// </summary>
public LLUUID originUUID; public LLUUID originUUID;
/// <summary> /// <summary>
/// Get Sim profile data from grid server when in grid mode /// Get Sim profile data from grid server when in grid mode
@ -163,7 +163,7 @@ namespace OpenSim.Data
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
simData.serverURI = (string)responseData["server_uri"]; simData.serverURI = (string)responseData["server_uri"];
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
simData.UUID = new LLUUID((string) responseData["region_UUID"]); simData.UUID = new LLUUID((string) responseData["region_UUID"]);
simData.regionName = (string) responseData["region_name"]; simData.regionName = (string) responseData["region_name"];
@ -206,7 +206,7 @@ namespace OpenSim.Data
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]); simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/"; simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
simData.serverURI = (string)responseData["server_uri"]; simData.serverURI = (string)responseData["server_uri"];
simData.UUID = new LLUUID((string) responseData["region_UUID"]); simData.UUID = new LLUUID((string) responseData["region_UUID"]);
simData.regionName = (string) responseData["region_name"]; simData.regionName = (string) responseData["region_name"];

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -51,7 +51,7 @@ namespace OpenSim.Data.SQLite
private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)"; private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)";
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
private const string assetSelect = "select * from assets"; private const string assetSelect = "select * from assets";
private SqliteConnection m_conn; private SqliteConnection m_conn;
@ -70,11 +70,11 @@ namespace OpenSim.Data.SQLite
override public AssetBase FetchAsset(LLUUID uuid) override public AssetBase FetchAsset(LLUUID uuid)
{ {
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
using (IDataReader reader = cmd.ExecuteReader()) using (IDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
{ {
@ -98,7 +98,7 @@ namespace OpenSim.Data.SQLite
{ {
m_log.Info("[ASSET DB]: Asset exists already, ignoring."); m_log.Info("[ASSET DB]: Asset exists already, ignoring.");
} }
else else
{ {
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
{ {
@ -110,7 +110,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -119,7 +119,7 @@ namespace OpenSim.Data.SQLite
override public void UpdateAsset(AssetBase asset) override public void UpdateAsset(AssetBase asset)
{ {
LogAssetLoad(asset); LogAssetLoad(asset);
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
@ -130,7 +130,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
@ -154,14 +154,14 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
using (IDataReader reader = cmd.ExecuteReader()) using (IDataReader reader = cmd.ExecuteReader())
{ {
if (reader.Read()) if (reader.Read())
{ {
reader.Close(); reader.Close();
return true; return true;
} }
else else
{ {
reader.Close(); reader.Close();
return false; return false;
@ -175,7 +175,7 @@ namespace OpenSim.Data.SQLite
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid))); cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -193,7 +193,7 @@ namespace OpenSim.Data.SQLite
/*********************************************************************** /***********************************************************************
* *
* Database Definition Functions * Database Definition Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -216,7 +216,7 @@ namespace OpenSim.Data.SQLite
} }
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
* *
* These should be database independant * These should be database independant

View File

@ -106,22 +106,22 @@ namespace OpenSim.Data.SQLite
// new fields // new fields
if (!Convert.IsDBNull(row["salePrice"])) if (!Convert.IsDBNull(row["salePrice"]))
item.SalePrice = Convert.ToInt32(row["salePrice"]); item.SalePrice = Convert.ToInt32(row["salePrice"]);
if (!Convert.IsDBNull(row["saleType"])) if (!Convert.IsDBNull(row["saleType"]))
item.SaleType = Convert.ToByte(row["saleType"]); item.SaleType = Convert.ToByte(row["saleType"]);
if (!Convert.IsDBNull(row["creationDate"])) if (!Convert.IsDBNull(row["creationDate"]))
item.CreationDate = Convert.ToInt32(row["creationDate"]); item.CreationDate = Convert.ToInt32(row["creationDate"]);
if (!Convert.IsDBNull(row["groupID"])) if (!Convert.IsDBNull(row["groupID"]))
item.GroupID = new LLUUID((string)row["groupID"]); item.GroupID = new LLUUID((string)row["groupID"]);
if (!Convert.IsDBNull(row["groupOwned"])) if (!Convert.IsDBNull(row["groupOwned"]))
item.GroupOwned = Convert.ToBoolean(row["groupOwned"]); item.GroupOwned = Convert.ToBoolean(row["groupOwned"]);
if (!Convert.IsDBNull(row["Flags"])) if (!Convert.IsDBNull(row["Flags"]))
item.Flags = Convert.ToUInt32(row["Flags"]); item.Flags = Convert.ToUInt32(row["Flags"]);
return item; return item;
} }
@ -221,7 +221,7 @@ namespace OpenSim.Data.SQLite
{ {
if (add) if (add)
m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID); m_log.ErrorFormat("[INVENTORY DB]: Interface Misuse: Attempting to Add inventory item that already exists: {0}", item.ID);
fillItemRow(inventoryRow, item); fillItemRow(inventoryRow, item);
} }
invItemsDa.Update(ds, "inventoryitems"); invItemsDa.Update(ds, "inventoryitems");
@ -314,9 +314,9 @@ namespace OpenSim.Data.SQLite
// There should only ever be one root folder for a user. However, if there's more // There should only ever be one root folder for a user. However, if there's more
// than one we'll simply use the first one rather than failing. It would be even // than one we'll simply use the first one rather than failing. It would be even
// nicer to print some message to this effect, but this feels like it's too low a // nicer to print some message to this effect, but this feels like it's too low a
// to put such a message out, and it's too minor right now to spare the time to // to put such a message out, and it's too minor right now to spare the time to
// suitably refactor. // suitably refactor.
if (folders.Count > 0) if (folders.Count > 0)
{ {
return folders[0]; return folders[0];
@ -327,7 +327,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// Append a list of all the child folders of a parent folder /// Append a list of all the child folders of a parent folder
/// </summary> /// </summary>
/// <param name="folders">list where folders will be appended</param> /// <param name="folders">list where folders will be appended</param>
/// <param name="parentID">ID of parent</param> /// <param name="parentID">ID of parent</param>
@ -435,7 +435,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void deleteInventoryItem(LLUUID itemID) public void deleteInventoryItem(LLUUID itemID)
@ -664,7 +664,7 @@ namespace OpenSim.Data.SQLite
{ {
string createInventoryItems = defineTable(createInventoryItemsTable()); string createInventoryItems = defineTable(createInventoryItemsTable());
string createInventoryFolders = defineTable(createInventoryFoldersTable()); string createInventoryFolders = defineTable(createInventoryFoldersTable());
SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn); SqliteCommand pcmd = new SqliteCommand(createInventoryItems, conn);
SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn); SqliteCommand scmd = new SqliteCommand(createInventoryFolders, conn);
@ -697,7 +697,7 @@ namespace OpenSim.Data.SQLite
// Very clumsy way of checking whether we need to upgrade the database table version and then updating. Only // Very clumsy way of checking whether we need to upgrade the database table version and then updating. Only
// putting up with this because this code should be blown away soon by nhibernate... // putting up with this because this code should be blown away soon by nhibernate...
conn.Open(); conn.Open();
SqliteCommand cmd; SqliteCommand cmd;
try try
{ {
@ -707,7 +707,7 @@ namespace OpenSim.Data.SQLite
catch (SqliteSyntaxException) catch (SqliteSyntaxException)
{ {
m_log.Info("[INVENTORY DB]: Upgrading sqlite inventory database to version 2"); m_log.Info("[INVENTORY DB]: Upgrading sqlite inventory database to version 2");
cmd = new SqliteCommand("alter table inventoryitems add column salePrice integer default 99;", conn); cmd = new SqliteCommand("alter table inventoryitems add column salePrice integer default 99;", conn);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd = new SqliteCommand("alter table inventoryitems add column saleType integer default 0;", conn); cmd = new SqliteCommand("alter table inventoryitems add column saleType integer default 0;", conn);
@ -719,15 +719,15 @@ namespace OpenSim.Data.SQLite
cmd = new SqliteCommand("alter table inventoryitems add column groupOwned integer default 0;", conn); cmd = new SqliteCommand("alter table inventoryitems add column groupOwned integer default 0;", conn);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd = new SqliteCommand("alter table inventoryitems add column flags integer default 0;", conn); cmd = new SqliteCommand("alter table inventoryitems add column flags integer default 0;", conn);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
pDa.Fill(tmpDS, "inventoryitems"); pDa.Fill(tmpDS, "inventoryitems");
} }
finally finally
{ {
conn.Close(); conn.Close();
} }
foreach (DataColumn col in createInventoryItemsTable().Columns) foreach (DataColumn col in createInventoryItemsTable().Columns)
{ {
if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName)) if (! tmpDS.Tables["inventoryitems"].Columns.Contains(col.ColumnName))

View File

@ -90,11 +90,11 @@ namespace OpenSim.Data.SQLite
SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn); SqliteCommand shapeSelectCmd = new SqliteCommand(shapeSelect, m_conn);
shapeDa = new SqliteDataAdapter(shapeSelectCmd); shapeDa = new SqliteDataAdapter(shapeSelectCmd);
// SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa); // SqliteCommandBuilder shapeCb = new SqliteCommandBuilder(shapeDa);
SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn); SqliteCommand itemsSelectCmd = new SqliteCommand(itemsSelect, m_conn);
itemsDa = new SqliteDataAdapter(itemsSelectCmd); itemsDa = new SqliteDataAdapter(itemsSelectCmd);
SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn); SqliteCommand terrainSelectCmd = new SqliteCommand(terrainSelect, m_conn);
terrainDa = new SqliteDataAdapter(terrainSelectCmd); terrainDa = new SqliteDataAdapter(terrainSelectCmd);
@ -117,7 +117,7 @@ namespace OpenSim.Data.SQLite
ds.Tables.Add(createShapeTable()); ds.Tables.Add(createShapeTable());
setupShapeCommands(shapeDa, m_conn); setupShapeCommands(shapeDa, m_conn);
if (persistPrimInventories) if (persistPrimInventories)
{ {
ds.Tables.Add(createItemsTable()); ds.Tables.Add(createItemsTable());
@ -183,8 +183,8 @@ namespace OpenSim.Data.SQLite
{ {
foreach (SceneObjectPart prim in obj.Children.Values) foreach (SceneObjectPart prim in obj.Children.Values)
{ {
if ((prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == 0 if ((prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Physics) == 0
&& (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Temporary) == 0 && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Temporary) == 0
&& (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.TemporaryOnRez) == 0) && (prim.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.TemporaryOnRez) == 0)
{ {
m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID); m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
@ -210,7 +210,7 @@ namespace OpenSim.Data.SQLite
public void RemoveObject(LLUUID obj, LLUUID regionUUID) public void RemoveObject(LLUUID obj, LLUUID regionUUID)
{ {
m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID); m_log.InfoFormat("[REGION DB]: Removing obj: {0} from region: {1}", obj.UUID, regionUUID);
DataTable prims = ds.Tables["prims"]; DataTable prims = ds.Tables["prims"];
DataTable shapes = ds.Tables["primshapes"]; DataTable shapes = ds.Tables["primshapes"];
@ -234,7 +234,7 @@ namespace OpenSim.Data.SQLite
} }
// Remove prim row // Remove prim row
row.Delete(); row.Delete();
} }
} }
@ -247,11 +247,11 @@ namespace OpenSim.Data.SQLite
/// </summary> /// </summary>
private void RemoveItems(LLUUID uuid) private void RemoveItems(LLUUID uuid)
{ {
DataTable items = ds.Tables["primitems"]; DataTable items = ds.Tables["primitems"];
String sql = String.Format("primID = '{0}'", uuid); String sql = String.Format("primID = '{0}'", uuid);
DataRow[] itemRows = items.Select(sql); DataRow[] itemRows = items.Select(sql);
foreach (DataRow itemRow in itemRows) foreach (DataRow itemRow in itemRows)
{ {
itemRow.Delete(); itemRow.Delete();
@ -286,7 +286,7 @@ namespace OpenSim.Data.SQLite
try try
{ {
SceneObjectPart prim = null; SceneObjectPart prim = null;
string uuid = (string) primRow["UUID"]; string uuid = (string) primRow["UUID"];
string objID = (string) primRow["SceneGroupID"]; string objID = (string) primRow["SceneGroupID"];
if (uuid == objID) //is new SceneObjectGroup ? if (uuid == objID) //is new SceneObjectGroup ?
@ -353,25 +353,25 @@ namespace OpenSim.Data.SQLite
private void LoadItems(SceneObjectPart prim) private void LoadItems(SceneObjectPart prim)
{ {
//m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID); //m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql); DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
foreach (DataRow row in dbItemRows) foreach (DataRow row in dbItemRows)
{ {
TaskInventoryItem item = buildItem(row); TaskInventoryItem item = buildItem(row);
inventory.Add(item); inventory.Add(item);
//m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID); //m_log.DebugFormat("[DATASTORE]: Restored item {0}, {1}", item.Name, item.ItemID);
} }
prim.RestoreInventoryItems(inventory); prim.RestoreInventoryItems(inventory);
// XXX A nasty little hack to recover the folder id for the prim (which is currently stored in // XXX A nasty little hack to recover the folder id for the prim (which is currently stored in
// every item). This data should really be stored in the prim table itself. // every item). This data should really be stored in the prim table itself.
if (dbItemRows.Length > 0) if (dbItemRows.Length > 0)
{ {
@ -548,12 +548,12 @@ namespace OpenSim.Data.SQLite
{ {
primDa.Update(ds, "prims"); primDa.Update(ds, "prims");
shapeDa.Update(ds, "primshapes"); shapeDa.Update(ds, "primshapes");
if (persistPrimInventories) if (persistPrimInventories)
{ {
itemsDa.Update(ds, "primitems"); itemsDa.Update(ds, "primitems");
} }
terrainDa.Update(ds, "terrain"); terrainDa.Update(ds, "terrain");
landDa.Update(ds, "land"); landDa.Update(ds, "land");
landAccessListDa.Update(ds, "landaccesslist"); landAccessListDa.Update(ds, "landaccesslist");
@ -569,7 +569,7 @@ namespace OpenSim.Data.SQLite
/*********************************************************************** /***********************************************************************
* *
* Database Definition Functions * Database Definition Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -705,8 +705,8 @@ namespace OpenSim.Data.SQLite
createCol(items, "primID", typeof (String)); createCol(items, "primID", typeof (String));
createCol(items, "assetID", typeof (String)); createCol(items, "assetID", typeof (String));
createCol(items, "parentFolderID", typeof (String)); createCol(items, "parentFolderID", typeof (String));
createCol(items, "invType", typeof (Int32)); createCol(items, "invType", typeof (Int32));
createCol(items, "assetType", typeof (Int32)); createCol(items, "assetType", typeof (Int32));
createCol(items, "name", typeof (String)); createCol(items, "name", typeof (String));
@ -784,7 +784,7 @@ namespace OpenSim.Data.SQLite
} }
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
* *
* These should be database independant * These should be database independant
@ -897,7 +897,7 @@ namespace OpenSim.Data.SQLite
return prim; return prim;
} }
/// <summary> /// <summary>
/// Build a prim inventory item from the persisted data. /// Build a prim inventory item from the persisted data.
/// </summary> /// </summary>
@ -906,15 +906,15 @@ namespace OpenSim.Data.SQLite
private static TaskInventoryItem buildItem(DataRow row) private static TaskInventoryItem buildItem(DataRow row)
{ {
TaskInventoryItem taskItem = new TaskInventoryItem(); TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ItemID = new LLUUID((String)row["itemID"]); taskItem.ItemID = new LLUUID((String)row["itemID"]);
taskItem.ParentPartID = new LLUUID((String)row["primID"]); taskItem.ParentPartID = new LLUUID((String)row["primID"]);
taskItem.AssetID = new LLUUID((String)row["assetID"]); taskItem.AssetID = new LLUUID((String)row["assetID"]);
taskItem.ParentID = new LLUUID((String)row["parentFolderID"]); taskItem.ParentID = new LLUUID((String)row["parentFolderID"]);
taskItem.InvType = Convert.ToInt32(row["invType"]); taskItem.InvType = Convert.ToInt32(row["invType"]);
taskItem.Type = Convert.ToInt32(row["assetType"]); taskItem.Type = Convert.ToInt32(row["assetType"]);
taskItem.Name = (String)row["name"]; taskItem.Name = (String)row["name"];
taskItem.Description = (String)row["description"]; taskItem.Description = (String)row["description"];
taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]); taskItem.CreationDate = Convert.ToUInt32(row["creationDate"]);
@ -922,13 +922,13 @@ namespace OpenSim.Data.SQLite
taskItem.OwnerID = new LLUUID((String)row["ownerID"]); taskItem.OwnerID = new LLUUID((String)row["ownerID"]);
taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]); taskItem.LastOwnerID = new LLUUID((String)row["lastOwnerID"]);
taskItem.GroupID = new LLUUID((String)row["groupID"]); taskItem.GroupID = new LLUUID((String)row["groupID"]);
taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]); taskItem.NextOwnerMask = Convert.ToUInt32(row["nextPermissions"]);
taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]); taskItem.OwnerMask = Convert.ToUInt32(row["currentPermissions"]);
taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]); taskItem.BaseMask = Convert.ToUInt32(row["basePermissions"]);
taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]); taskItem.EveryoneMask = Convert.ToUInt32(row["everyonePermissions"]);
taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]); taskItem.GroupMask = Convert.ToUInt32(row["groupPermissions"]);
return taskItem; return taskItem;
} }
@ -990,14 +990,14 @@ namespace OpenSim.Data.SQLite
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
m_conn.Close(); m_conn.Close();
m_conn.Dispose(); m_conn.Dispose();
m_log.Error("[REGION DB]: The land table was recently updated. You need to restart the simulator. Exiting now."); m_log.Error("[REGION DB]: The land table was recently updated. You need to restart the simulator. Exiting now.");
Thread.Sleep(10000); Thread.Sleep(10000);
// ICK! but it's better then A thousand red SQLITE error messages! // ICK! but it's better then A thousand red SQLITE error messages!
Environment.Exit(0); Environment.Exit(0);
} }
catch (Exception) catch (Exception)
{ {
@ -1006,7 +1006,7 @@ namespace OpenSim.Data.SQLite
Environment.Exit(0); Environment.Exit(0);
} }
} }
return newData; return newData;
} }
@ -1107,17 +1107,17 @@ namespace OpenSim.Data.SQLite
row["SitTargetOrientY"] = sitTargetOrient.Y; row["SitTargetOrientY"] = sitTargetOrient.Y;
row["SitTargetOrientZ"] = sitTargetOrient.Z; row["SitTargetOrientZ"] = sitTargetOrient.Z;
} }
private static void fillItemRow(DataRow row, TaskInventoryItem taskItem) private static void fillItemRow(DataRow row, TaskInventoryItem taskItem)
{ {
row["itemID"] = taskItem.ItemID; row["itemID"] = taskItem.ItemID;
row["primID"] = taskItem.ParentPartID; row["primID"] = taskItem.ParentPartID;
row["assetID"] = taskItem.AssetID; row["assetID"] = taskItem.AssetID;
row["parentFolderID"] = taskItem.ParentID; row["parentFolderID"] = taskItem.ParentID;
row["invType"] = taskItem.InvType; row["invType"] = taskItem.InvType;
row["assetType"] = taskItem.Type; row["assetType"] = taskItem.Type;
row["name"] = taskItem.Name; row["name"] = taskItem.Name;
row["description"] = taskItem.Description; row["description"] = taskItem.Description;
row["creationDate"] = taskItem.CreationDate; row["creationDate"] = taskItem.CreationDate;
@ -1294,37 +1294,37 @@ namespace OpenSim.Data.SQLite
fillShapeRow(shapeRow, prim); fillShapeRow(shapeRow, prim);
} }
} }
// see IRegionDatastore // see IRegionDatastore
public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(LLUUID primID, ICollection<TaskInventoryItem> items)
{ {
if (!persistPrimInventories) if (!persistPrimInventories)
return; return;
m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID); m_log.InfoFormat("[REGION DB]: Entered StorePrimInventory with prim ID {0}", primID);
DataTable dbItems = ds.Tables["primitems"]; DataTable dbItems = ds.Tables["primitems"];
// For now, we're just going to crudely remove all the previous inventory items // For now, we're just going to crudely remove all the previous inventory items
// no matter whether they have changed or not, and replace them with the current set. // no matter whether they have changed or not, and replace them with the current set.
lock (ds) lock (ds)
{ {
RemoveItems(primID); RemoveItems(primID);
// repalce with current inventory details // repalce with current inventory details
foreach (TaskInventoryItem newItem in items) foreach (TaskInventoryItem newItem in items)
{ {
// m_log.InfoFormat( // m_log.InfoFormat(
// "[DATASTORE]: ", // "[DATASTORE]: ",
// "Adding item {0}, {1} to prim ID {2}", // "Adding item {0}, {1} to prim ID {2}",
// newItem.Name, newItem.ItemID, newItem.ParentPartID); // newItem.Name, newItem.ItemID, newItem.ParentPartID);
DataRow newItemRow = dbItems.NewRow(); DataRow newItemRow = dbItems.NewRow();
fillItemRow(newItemRow, newItem); fillItemRow(newItemRow, newItem);
dbItems.Rows.Add(newItemRow); dbItems.Rows.Add(newItemRow);
} }
} }
Commit(); Commit();
} }
@ -1436,7 +1436,7 @@ namespace OpenSim.Data.SQLite
/// This is a convenience function that collapses 5 repetitive /// This is a convenience function that collapses 5 repetitive
/// lines for defining SqliteParameters to 2 parameters: /// lines for defining SqliteParameters to 2 parameters:
/// column name and database type. /// column name and database type.
/// ///
/// It assumes certain conventions like :param as the param /// It assumes certain conventions like :param as the param
/// name to replace in parametrized queries, and that source /// name to replace in parametrized queries, and that source
/// version is always current version, both of which are fine /// version is always current version, both of which are fine
@ -1451,7 +1451,7 @@ namespace OpenSim.Data.SQLite
param.SourceColumn = name; param.SourceColumn = name;
param.SourceVersion = DataRowVersion.Current; param.SourceVersion = DataRowVersion.Current;
return param; return param;
} }
private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupPrimCommands(SqliteDataAdapter da, SqliteConnection conn)
{ {
@ -1466,7 +1466,7 @@ namespace OpenSim.Data.SQLite
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupItemsCommands(SqliteDataAdapter da, SqliteConnection conn)
{ {
da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]); da.InsertCommand = createInsertCommand("primitems", ds.Tables["primitems"]);
@ -1479,7 +1479,7 @@ namespace OpenSim.Data.SQLite
delete.Parameters.Add(createSqliteParameter("itemID", typeof (String))); delete.Parameters.Add(createSqliteParameter("itemID", typeof (String)));
delete.Connection = conn; delete.Connection = conn;
da.DeleteCommand = delete; da.DeleteCommand = delete;
} }
private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupTerrainCommands(SqliteDataAdapter da, SqliteConnection conn)
{ {
@ -1660,7 +1660,7 @@ namespace OpenSim.Data.SQLite
return false; return false;
} }
} }
// XXX primitems should probably go here eventually // XXX primitems should probably go here eventually
foreach (DataColumn col in createTerrainTable().Columns) foreach (DataColumn col in createTerrainTable().Columns)

View File

@ -58,7 +58,7 @@ namespace OpenSim.Data.SQLite
private const string AvatarPickerAndSQL = "select * from users where username like :username and surname like :surname"; private const string AvatarPickerAndSQL = "select * from users where username like :username and surname like :surname";
private const string AvatarPickerOrSQL = "select * from users where username like :username or surname like :surname"; private const string AvatarPickerOrSQL = "select * from users where username like :username or surname like :surname";
private DataSet ds; private DataSet ds;
private SqliteDataAdapter da; private SqliteDataAdapter da;
private SqliteDataAdapter daf; private SqliteDataAdapter daf;
@ -67,16 +67,16 @@ namespace OpenSim.Data.SQLite
override public void Initialise(string connect) override public void Initialise(string connect)
{ {
// default to something sensible // default to something sensible
if (connect == "") if (connect == "")
connect = "URI=file:userprofiles.db,version=3"; connect = "URI=file:userprofiles.db,version=3";
SqliteConnection conn = new SqliteConnection(connect); SqliteConnection conn = new SqliteConnection(connect);
TestTables(conn); TestTables(conn);
// This sucks, but It doesn't seem to work with the dataset Syncing :P // This sucks, but It doesn't seem to work with the dataset Syncing :P
g_conn = conn; g_conn = conn;
g_conn.Open(); g_conn.Open();
ds = new DataSet(); ds = new DataSet();
da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn)); da = new SqliteDataAdapter(new SqliteCommand(userSelect, conn));
daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn)); daf = new SqliteDataAdapter(new SqliteCommand(userFriendsSelect, conn));
@ -159,7 +159,7 @@ namespace OpenSim.Data.SQLite
override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms) override public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
{ {
string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)"; string InsertFriends = "insert into userfriends(ownerID, friendID, friendPerms) values(:ownerID, :friendID, :perms)";
using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn)) using (SqliteCommand cmd = new SqliteCommand(InsertFriends, g_conn))
{ {
cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.UUID.ToString())); cmd.Parameters.Add(new SqliteParameter(":ownerID", friendlistowner.UUID.ToString()));
@ -228,11 +228,11 @@ namespace OpenSim.Data.SQLite
m_log.Error("[USER DB]: Exception getting friends list for user: " + ex.ToString()); m_log.Error("[USER DB]: Exception getting friends list for user: " + ex.ToString());
} }
} }
return returnlist; return returnlist;
} }
#endregion #endregion
@ -380,9 +380,9 @@ namespace OpenSim.Data.SQLite
else else
{ {
fillUserRow(row, user); fillUserRow(row, user);
} }
// This is why we're getting the 'logins never log-off'.. because It isn't clearing the // This is why we're getting the 'logins never log-off'.. because It isn't clearing the
// useragents table once the useragent is null // useragents table once the useragent is null
// //
// A database guy should look at this and figure out the best way to clear the useragents table. // A database guy should look at this and figure out the best way to clear the useragents table.
@ -403,7 +403,7 @@ namespace OpenSim.Data.SQLite
} }
else else
{ {
// I just added this to help the standalone login situation. // I just added this to help the standalone login situation.
//It still needs to be looked at by a Database guy //It still needs to be looked at by a Database guy
DataTable ua = ds.Tables["useragents"]; DataTable ua = ds.Tables["useragents"];
row = ua.Rows.Find(Util.ToRawUuidString(user.ID)); row = ua.Rows.Find(Util.ToRawUuidString(user.ID));
@ -480,7 +480,7 @@ namespace OpenSim.Data.SQLite
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
// override public AvatarAppearance GetUserAppearance(LLUUID user) // override public AvatarAppearance GetUserAppearance(LLUUID user)
// { // {
// return new AvatarAppearance(); // return new AvatarAppearance();
// } // }
@ -494,17 +494,17 @@ namespace OpenSim.Data.SQLite
{ {
return; return;
} }
override public void RemoveAttachment(LLUUID user, LLUUID item) override public void RemoveAttachment(LLUUID user, LLUUID item)
{ {
return; return;
} }
override public List<LLUUID> GetAttachments(LLUUID user) override public List<LLUUID> GetAttachments(LLUUID user)
{ {
return new List<LLUUID>(); return new List<LLUUID>();
} }
/// <summary> /// <summary>
/// Returns the name of the storage provider /// Returns the name of the storage provider
/// </summary> /// </summary>
@ -525,13 +525,13 @@ namespace OpenSim.Data.SQLite
/*********************************************************************** /***********************************************************************
* *
* DataTable creation * DataTable creation
* *
**********************************************************************/ **********************************************************************/
/*********************************************************************** /***********************************************************************
* *
* Database Definition Functions * Database Definition Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -610,7 +610,7 @@ namespace OpenSim.Data.SQLite
} }
/*********************************************************************** /***********************************************************************
* *
* Convert between ADO.NET <=> OpenSim Objects * Convert between ADO.NET <=> OpenSim Objects
* *
* These should be database independant * These should be database independant

View File

@ -39,7 +39,7 @@ namespace OpenSim.Data.SQLite
/*********************************************************************** /***********************************************************************
* *
* Database Definition Helper Functions * Database Definition Helper Functions
* *
* This should be db agnostic as we define them in ADO.NET terms * This should be db agnostic as we define them in ADO.NET terms
* *
**********************************************************************/ **********************************************************************/
@ -161,7 +161,7 @@ namespace OpenSim.Data.SQLite
/// This is a convenience function that collapses 5 repetitive /// This is a convenience function that collapses 5 repetitive
/// lines for defining SqliteParameters to 2 parameters: /// lines for defining SqliteParameters to 2 parameters:
/// column name and database type. /// column name and database type.
/// ///
/// It assumes certain conventions like :param as the param /// It assumes certain conventions like :param as the param
/// name to replace in parametrized queries, and that source /// name to replace in parametrized queries, and that source
/// version is always current version, both of which are fine /// version is always current version, both of which are fine

View File

@ -36,11 +36,11 @@ namespace OpenSim.Data
public abstract class UserDataBase : IUserData public abstract class UserDataBase : IUserData
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<LLUUID, AvatarAppearance> aplist = new Dictionary<LLUUID, AvatarAppearance>(); private Dictionary<LLUUID, AvatarAppearance> aplist = new Dictionary<LLUUID, AvatarAppearance>();
public abstract UserProfileData GetUserByUUID(LLUUID user); public abstract UserProfileData GetUserByUUID(LLUUID user);
public abstract UserProfileData GetUserByName(string fname, string lname); public abstract UserProfileData GetUserByName(string fname, string lname);
public abstract UserAgentData GetAgentByUUID(LLUUID user); public abstract UserAgentData GetAgentByUUID(LLUUID user);
public abstract UserAgentData GetAgentByName(string name); public abstract UserAgentData GetAgentByName(string name);
public abstract UserAgentData GetAgentByName(string fname, string lname); public abstract UserAgentData GetAgentByName(string fname, string lname);

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,7 +54,7 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //

View File

@ -38,7 +38,7 @@ using Nini.Config;
/// Loads assets from the filesystem location. Not yet a plugin, though it should be. /// Loads assets from the filesystem location. Not yet a plugin, though it should be.
/// </summary> /// </summary>
namespace OpenSim.Framework.AssetLoader.Filesystem namespace OpenSim.Framework.AssetLoader.Filesystem
{ {
public class AssetLoaderFileSystem : IAssetLoader public class AssetLoaderFileSystem : IAssetLoader
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -63,7 +63,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
return asset; return asset;
} }
protected static void LoadAsset(AssetBase info, bool image, string path) protected static void LoadAsset(AssetBase info, bool image, string path)
{ {
FileInfo fInfo = new FileInfo(path); FileInfo fInfo = new FileInfo(path);
@ -77,7 +77,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
info.Data = idata; info.Data = idata;
//info.loaded=true; //info.loaded=true;
} }
public void ForEachDefaultXmlAsset(Action<AssetBase> action) public void ForEachDefaultXmlAsset(Action<AssetBase> action)
{ {
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml"); string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
@ -91,28 +91,28 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
if (File.Exists(assetSetFilename)) if (File.Exists(assetSetFilename))
{ {
string assetSetPath = "ERROR"; string assetSetPath = "ERROR";
try try
{ {
XmlConfigSource source = new XmlConfigSource(assetSetFilename); XmlConfigSource source = new XmlConfigSource(assetSetFilename);
for (int i = 0; i < source.Configs.Count; i++) for (int i = 0; i < source.Configs.Count; i++)
{ {
assetSetPath = source.Configs[i].GetString("file", String.Empty); assetSetPath = source.Configs[i].GetString("file", String.Empty);
LoadXmlAssetSet(Path.Combine(Util.assetsDir(), assetSetPath), assets); LoadXmlAssetSet(Path.Combine(Util.assetsDir(), assetSetPath), assets);
} }
} }
catch (XmlException e) catch (XmlException e)
{ {
m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e); m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e);
} }
} }
else else
{ {
m_log.Error("[ASSETS]: Asset set control file assets/AssetSets.xml does not exist! No assets loaded."); m_log.Error("[ASSETS]: Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
} }
assets.ForEach(action); assets.ForEach(action);
} }
@ -124,7 +124,7 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
protected static void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets) protected static void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
{ {
m_log.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath); m_log.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath);
if (File.Exists(assetSetPath)) if (File.Exists(assetSetPath))
{ {
try try
@ -156,6 +156,6 @@ namespace OpenSim.Framework.AssetLoader.Filesystem
{ {
m_log.ErrorFormat("[ASSETS]: Asset set file {0} does not exist!", assetSetPath); m_log.ErrorFormat("[ASSETS]: Asset set file {0} does not exist!", assetSetPath);
} }
} }
} }
} }

View File

@ -56,7 +56,7 @@ namespace OpenSim.Framework
public readonly static int SKIRT = 12; public readonly static int SKIRT = 12;
private readonly static int MAX_WEARABLES = 13; private readonly static int MAX_WEARABLES = 13;
private static LLUUID BODY_ASSET = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"); private static LLUUID BODY_ASSET = new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73");
private static LLUUID BODY_ITEM = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"); private static LLUUID BODY_ITEM = new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9");
private static LLUUID SKIN_ASSET = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"); private static LLUUID SKIN_ASSET = new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb");
@ -204,7 +204,7 @@ namespace OpenSim.Framework
set { m_wearables[SKIRT].AssetID = value; } set { m_wearables[SKIRT].AssetID = value; }
} }
public void SetDefaultWearables() public void SetDefaultWearables()
{ {
m_wearables[BODY].AssetID = BODY_ASSET; m_wearables[BODY].AssetID = BODY_ASSET;
m_wearables[BODY].ItemID = BODY_ITEM; m_wearables[BODY].ItemID = BODY_ITEM;
@ -257,7 +257,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="texture"></param> /// <param name="texture"></param>
/// <param name="visualParam"></param> /// <param name="visualParam"></param>

View File

@ -72,7 +72,7 @@ namespace OpenSim.Framework
public void Remove(uint id) public void Remove(uint id)
{ {
//m_log.InfoFormat("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count); //m_log.InfoFormat("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count);
lock (m_clients) lock (m_clients)
{ {
m_clients.Remove(id); m_clients.Remove(id);

View File

@ -40,12 +40,12 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Manages local cache of assets and their sending to viewers. /// Manages local cache of assets and their sending to viewers.
/// ///
/// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either /// This class actually encapsulates two largely separate mechanisms. One mechanism fetches assets either
/// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and /// synchronously or async and passes the data back to the requester. The second mechanism fetches assets and
/// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and /// sends packetised data directly back to the client. The only point where they meet is AssetReceived() and
/// AssetNotFound(), which means they do share the same asset and texture caches. /// AssetNotFound(), which means they do share the same asset and texture caches.
/// ///
/// TODO Assets in this cache are effectively immortal (they are never disposed off through old age). /// TODO Assets in this cache are effectively immortal (they are never disposed off through old age).
/// This is not a huge problem at the moment since other memory use usually dwarfs that used by assets /// This is not a huge problem at the moment since other memory use usually dwarfs that used by assets
/// but it's something to bear in mind. /// but it's something to bear in mind.
@ -281,8 +281,8 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to /// Synchronously retreive an asset. If the asset isn't in the cache, a request will be made to the persistent store to
/// load it into the cache. /// load it into the cache.
/// ///
/// XXX We'll keep polling the cache until we get the asset or we exceed /// XXX We'll keep polling the cache until we get the asset or we exceed
/// the allowed number of polls. This isn't a very good way of doing things since a single thread /// the allowed number of polls. This isn't a very good way of doing things since a single thread
/// is processing inbound packets, so if the asset server is slow, we could block this for up to /// is processing inbound packets, so if the asset server is slow, we could block this for up to
@ -431,11 +431,11 @@ namespace OpenSim.Framework.Communications.Cache
//making a copy of the list is not ideal //making a copy of the list is not ideal
//but the old method of locking around this whole block of code was causing a multi-thread lock //but the old method of locking around this whole block of code was causing a multi-thread lock
//between this and the TextureDownloadModule //between this and the TextureDownloadModule
//while the localAsset thread running this and trying to send a texture to the callback in the //while the localAsset thread running this and trying to send a texture to the callback in the
//texturedownloadmodule , and hitting a lock in there. While the texturedownload thread (which was holding //texturedownloadmodule , and hitting a lock in there. While the texturedownload thread (which was holding
// the lock in the texturedownload module) was trying to // the lock in the texturedownload module) was trying to
//request a new asset and hitting a lock in here on the RequestLists. //request a new asset and hitting a lock in here on the RequestLists.
List<NewAssetRequest> theseRequests = new List<NewAssetRequest>(reqList.Requests); List<NewAssetRequest> theseRequests = new List<NewAssetRequest>(reqList.Requests);
reqList.Requests.Clear(); reqList.Requests.Clear();
@ -460,7 +460,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
// Notify requesters for this asset // Notify requesters for this asset
AssetRequestsList reqList = null; AssetRequestsList reqList = null;
lock (RequestLists) lock (RequestLists)
{ {
@ -552,7 +552,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
return; return;
} }
//it is in our cache //it is in our cache
AssetInfo asset = Assets[requestID]; AssetInfo asset = Assets[requestID];
// add to the AssetRequests list // add to the AssetRequests list
@ -679,14 +679,14 @@ namespace OpenSim.Framework.Communications.Cache
public byte AssetRequestSource = 2; public byte AssetRequestSource = 2;
public byte[] Params = null; public byte[] Params = null;
//public bool AssetInCache; //public bool AssetInCache;
//public int TimeRequested; //public int TimeRequested;
public int DiscardLevel = -1; public int DiscardLevel = -1;
public AssetRequest() public AssetRequest()
{ {
} }
} }
public class AssetInfo : AssetBase public class AssetInfo : AssetBase
{ {
public AssetInfo() public AssetInfo()

View File

@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
public abstract class AssetServerBase : IAssetServer public abstract class AssetServerBase : IAssetServer
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IAssetReceiver m_receiver; protected IAssetReceiver m_receiver;
@ -47,12 +47,12 @@ namespace OpenSim.Framework.Communications.Cache
// Temporarily hardcoded - should be a plugin // Temporarily hardcoded - should be a plugin
protected IAssetLoader assetLoader = new AssetLoaderFileSystem(); protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
protected abstract void StoreAsset(AssetBase asset); protected abstract void StoreAsset(AssetBase asset);
protected abstract void CommitAssets(); protected abstract void CommitAssets();
/// <summary> /// <summary>
/// This method must be implemented by a subclass to retrieve the asset named in the /// This method must be implemented by a subclass to retrieve the asset named in the
/// AssetRequest. If the asset is not found, null should be returned. /// AssetRequest. If the asset is not found, null should be returned.
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
@ -60,7 +60,7 @@ namespace OpenSim.Framework.Communications.Cache
protected abstract AssetBase GetAsset(AssetRequest req); protected abstract AssetBase GetAsset(AssetRequest req);
/// <summary> /// <summary>
/// Process an asset request. This method will call GetAsset(AssetRequest req) /// Process an asset request. This method will call GetAsset(AssetRequest req)
/// on the subclass. /// on the subclass.
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>

View File

@ -36,55 +36,55 @@ using log4net;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
internal delegate void AddItemDelegate(InventoryItemBase itemInfo); internal delegate void AddItemDelegate(InventoryItemBase itemInfo);
internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
internal delegate void DeleteItemDelegate(LLUUID itemID); internal delegate void DeleteItemDelegate(LLUUID itemID);
internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID);
internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID);
internal delegate void PurgeFolderDelegate(LLUUID folderID); internal delegate void PurgeFolderDelegate(LLUUID folderID);
internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID);
internal delegate void SendInventoryDescendentsDelegate( internal delegate void SendInventoryDescendentsDelegate(
IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems); IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems);
/// <summary> /// <summary>
/// Stores user profile and inventory data received from backend services for a particular user. /// Stores user profile and inventory data received from backend services for a particular user.
/// </summary> /// </summary>
public class CachedUserInfo public class CachedUserInfo
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// The comms manager holds references to services (user, grid, inventory, etc.) /// The comms manager holds references to services (user, grid, inventory, etc.)
/// </summary> /// </summary>
private readonly CommunicationsManager m_commsManager; private readonly CommunicationsManager m_commsManager;
public UserProfileData UserProfile { get { return m_userProfile; } } public UserProfileData UserProfile { get { return m_userProfile; } }
private readonly UserProfileData m_userProfile; private readonly UserProfileData m_userProfile;
/// <summary> /// <summary>
/// Has we received the user's inventory from the inventory service? /// Has we received the user's inventory from the inventory service?
/// </summary> /// </summary>
private bool m_hasInventory; private bool m_hasInventory;
/// <summary> /// <summary>
/// Inventory requests waiting for receipt of this user's inventory from the inventory service. /// Inventory requests waiting for receipt of this user's inventory from the inventory service.
/// </summary> /// </summary>
private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>(); private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>();
/// <summary> /// <summary>
/// Has this user info object yet received its inventory information from the invetnroy service? /// Has this user info object yet received its inventory information from the invetnroy service?
/// </summary> /// </summary>
public bool HasInventory { get { return m_hasInventory; } } public bool HasInventory { get { return m_hasInventory; } }
private InventoryFolderImpl m_rootFolder; private InventoryFolderImpl m_rootFolder;
public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } public InventoryFolderImpl RootFolder { get { return m_rootFolder; } }
/// <summary> /// <summary>
/// FIXME: This could be contained within a local variable - it doesn't need to be a field /// FIXME: This could be contained within a local variable - it doesn't need to be a field
/// </summary> /// </summary>
private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders
= new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); = new Dictionary<LLUUID, IList<InventoryFolderImpl>>();
/// <summary> /// <summary>
@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache
m_commsManager = commsManager; m_commsManager = commsManager;
m_userProfile = userProfile; m_userProfile = userProfile;
} }
/// <summary> /// <summary>
/// This allows a request to be added to be processed once we receive a user's inventory /// This allows a request to be added to be processed once we receive a user's inventory
/// from the inventory service. If we already have the inventory, the request /// from the inventory service. If we already have the inventory, the request
@ -118,7 +118,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
} }
/// <summary> /// <summary>
/// Store a folder pending arrival of its parent /// Store a folder pending arrival of its parent
/// </summary> /// </summary>
@ -126,7 +126,7 @@ namespace OpenSim.Framework.Communications.Cache
private void AddPendingFolder(InventoryFolderImpl folder) private void AddPendingFolder(InventoryFolderImpl folder)
{ {
LLUUID parentFolderId = folder.ParentID; LLUUID parentFolderId = folder.ParentID;
if (pendingCategorizationFolders.ContainsKey(parentFolderId)) if (pendingCategorizationFolders.ContainsKey(parentFolderId))
{ {
pendingCategorizationFolders[parentFolderId].Add(folder); pendingCategorizationFolders[parentFolderId].Add(folder);
@ -135,11 +135,11 @@ namespace OpenSim.Framework.Communications.Cache
{ {
IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>();
folders.Add(folder); folders.Add(folder);
pendingCategorizationFolders[parentFolderId] = folders; pendingCategorizationFolders[parentFolderId] = folders;
} }
} }
/// <summary> /// <summary>
/// Add any pending folders which were received before the given folder /// Add any pending folders which were received before the given folder
/// </summary> /// </summary>
@ -155,18 +155,18 @@ namespace OpenSim.Framework.Communications.Cache
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}",
// folder.name, folder.folderID, parent.name, parent.folderID); // folder.name, folder.folderID, parent.name, parent.folderID);
lock (newFolder.SubFolders) lock (newFolder.SubFolders)
{ {
if (!newFolder.SubFolders.ContainsKey(folder.ID)) if (!newFolder.SubFolders.ContainsKey(folder.ID))
{ {
newFolder.SubFolders.Add(folder.ID, folder); newFolder.SubFolders.Add(folder.ID, folder);
} }
} }
} }
} }
} }
/// <summary> /// <summary>
/// Callback invoked when the inventory is received from an async request to the inventory service /// Callback invoked when the inventory is received from an async request to the inventory service
/// </summary> /// </summary>
@ -177,12 +177,12 @@ namespace OpenSim.Framework.Communications.Cache
// FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these
// are simply being swallowed // are simply being swallowed
try try
{ {
foreach (InventoryFolderImpl folder in folders) foreach (InventoryFolderImpl folder in folders)
{ {
FolderReceive(folder); FolderReceive(folder);
} }
foreach (InventoryItemBase item in items) foreach (InventoryItemBase item in items)
{ {
ItemReceive(item); ItemReceive(item);
@ -191,15 +191,15 @@ namespace OpenSim.Framework.Communications.Cache
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e); m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e);
} }
// Deal with pending requests // Deal with pending requests
lock (m_pendingRequests) lock (m_pendingRequests)
{ {
// We're going to change inventory status within the lock to avoid a race condition // We're going to change inventory status within the lock to avoid a race condition
// where requests are processed after the AddRequest() method has been called. // where requests are processed after the AddRequest() method has been called.
m_hasInventory = true; m_hasInventory = true;
foreach (IInventoryRequest request in m_pendingRequests) foreach (IInventoryRequest request in m_pendingRequests)
{ {
request.Execute(); request.Execute();
@ -215,7 +215,7 @@ namespace OpenSim.Framework.Communications.Cache
private void FolderReceive(InventoryFolderImpl newFolder) private void FolderReceive(InventoryFolderImpl newFolder)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}",
// folderInfo.Name, folderInfo.ID, userID); // folderInfo.Name, folderInfo.ID, userID);
if (RootFolder == null) if (RootFolder == null)
@ -232,7 +232,7 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID); InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID);
if (parentFolder != null) if (parentFolder != null)
{ {
lock (parentFolder.SubFolders) lock (parentFolder.SubFolders)
@ -252,44 +252,44 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
AddPendingFolder(newFolder); AddPendingFolder(newFolder);
} }
} }
ResolvePendingFolders(newFolder); ResolvePendingFolders(newFolder);
} }
/// <summary> /// <summary>
/// Callback invoked when an item is received from an async request to the inventory service. /// Callback invoked when an item is received from an async request to the inventory service.
/// ///
/// We're assuming here that items are always received after all the folders /// We're assuming here that items are always received after all the folders
/// received. /// received.
/// </summary> /// </summary>
/// <param name="folderInfo"></param> /// <param name="folderInfo"></param>
private void ItemReceive(InventoryItemBase itemInfo) private void ItemReceive(InventoryItemBase itemInfo)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Received item {0} {1} for user {2}", // "[INVENTORY CACHE]: Received item {0} {1} for user {2}",
// itemInfo.Name, itemInfo.ID, userID); // itemInfo.Name, itemInfo.ID, userID);
InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder);
if (null == folder) if (null == folder)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"Received item {0} {1} but its folder {2} does not exist", "Received item {0} {1} but its folder {2} does not exist",
itemInfo.Name, itemInfo.ID, itemInfo.Folder); itemInfo.Name, itemInfo.ID, itemInfo.Folder);
return; return;
} }
lock (folder.Items) lock (folder.Items)
{ {
folder.Items[itemInfo.ID] = itemInfo; folder.Items[itemInfo.ID] = itemInfo;
} }
} }
/// <summary> /// <summary>
/// Create a folder in this agent's inventory. /// Create a folder in this agent's inventory.
/// ///
/// If the inventory service has not yet delievered the inventory /// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued. /// for this user then the request will be queued.
/// </summary> /// </summary>
@ -299,20 +299,20 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId); // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId);
if (HasInventory) if (HasInventory)
{ {
InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID);
if (null == parentFolder) if (null == parentFolder)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Tried to create folder {0} {1} but the parent {2} does not exist", "[AGENT INVENTORY]: Tried to create folder {0} {1} but the parent {2} does not exist",
folderName, folderID, parentID); folderName, folderID, parentID);
return false; return false;
} }
InventoryFolderImpl createdFolder = parentFolder.CreateChildFolder(folderID, folderName, folderType); InventoryFolderImpl createdFolder = parentFolder.CreateChildFolder(folderID, folderName, folderType);
if (createdFolder != null) if (createdFolder != null)
@ -324,17 +324,17 @@ namespace OpenSim.Framework.Communications.Cache
createdBaseFolder.ParentID = createdFolder.ParentID; createdBaseFolder.ParentID = createdFolder.ParentID;
createdBaseFolder.Type = createdFolder.Type; createdBaseFolder.Type = createdFolder.Type;
createdBaseFolder.Version = createdFolder.Version; createdBaseFolder.Version = createdFolder.Version;
m_commsManager.InventoryService.AddFolder(createdBaseFolder); m_commsManager.InventoryService.AddFolder(createdBaseFolder);
return true; return true;
} }
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists", "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists",
folderName, folderID); folderName, folderID);
return false; return false;
} }
} }
@ -344,22 +344,22 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(CreateFolderDelegate), this, "CreateFolder"), Delegate.CreateDelegate(typeof(CreateFolderDelegate), this, "CreateFolder"),
new object[] { folderName, folderID, folderType, parentID })); new object[] { folderName, folderID, folderType, parentID }));
return true; return true;
} }
} }
/// <summary> /// <summary>
/// Handle a client request to update the inventory folder /// Handle a client request to update the inventory folder
/// ///
/// If the inventory service has not yet delievered the inventory /// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued. /// for this user then the request will be queued.
/// ///
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
/// and needs to be changed. /// and needs to be changed.
/// </summary> /// </summary>
/// ///
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="name"></param> /// <param name="name"></param>
@ -367,7 +367,7 @@ namespace OpenSim.Framework.Communications.Cache
public bool UpdateFolder(string name, LLUUID folderID, ushort type, LLUUID parentID) public bool UpdateFolder(string name, LLUUID folderID, ushort type, LLUUID parentID)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
if (HasInventory) if (HasInventory)
{ {
@ -378,7 +378,7 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.ParentID = parentID; baseFolder.ParentID = parentID;
baseFolder.Type = (short) type; baseFolder.Type = (short) type;
baseFolder.Version = RootFolder.Version; baseFolder.Version = RootFolder.Version;
m_commsManager.InventoryService.AddFolder(baseFolder); m_commsManager.InventoryService.AddFolder(baseFolder);
} }
else else
@ -387,18 +387,18 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(UpdateFolderDelegate), this, "UpdateFolder"), Delegate.CreateDelegate(typeof(UpdateFolderDelegate), this, "UpdateFolder"),
new object[] { name, folderID, type, parentID })); new object[] { name, folderID, type, parentID }));
} }
return true; return true;
} }
/// <summary> /// <summary>
/// Handle an inventory folder move request from the client. /// Handle an inventory folder move request from the client.
/// ///
/// If the inventory service has not yet delievered the inventory /// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued. /// for this user then the request will be queued.
/// </summary> /// </summary>
/// ///
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="parentID"></param> /// <param name="parentID"></param>
public bool MoveFolder(LLUUID folderID, LLUUID parentID) public bool MoveFolder(LLUUID folderID, LLUUID parentID)
@ -413,9 +413,9 @@ namespace OpenSim.Framework.Communications.Cache
baseFolder.Owner = m_userProfile.ID; baseFolder.Owner = m_userProfile.ID;
baseFolder.ID = folderID; baseFolder.ID = folderID;
baseFolder.ParentID = parentID; baseFolder.ParentID = parentID;
m_commsManager.InventoryService.MoveFolder(baseFolder); m_commsManager.InventoryService.MoveFolder(baseFolder);
return true; return true;
} }
else else
@ -424,30 +424,30 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(MoveFolderDelegate), this, "MoveFolder"), Delegate.CreateDelegate(typeof(MoveFolderDelegate), this, "MoveFolder"),
new object[] { folderID, parentID })); new object[] { folderID, parentID }));
return true; return true;
} }
} }
/// <summary> /// <summary>
/// This method will delete all the items and folders in the given folder. /// This method will delete all the items and folders in the given folder.
/// ///
/// If the inventory service has not yet delievered the inventory /// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued. /// for this user then the request will be queued.
/// </summary> /// </summary>
/// ///
/// <param name="folderID"></param> /// <param name="folderID"></param>
public bool PurgeFolder(LLUUID folderID) public bool PurgeFolder(LLUUID folderID)
{ {
// m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}", // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}",
// folderID, remoteClient.Name, remoteClient.AgentId); // folderID, remoteClient.Name, remoteClient.AgentId);
if (HasInventory) if (HasInventory)
{ {
InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID); InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID);
if (purgedFolder != null) if (purgedFolder != null)
{ {
// XXX Nasty - have to create a new object to hold details we already have // XXX Nasty - have to create a new object to hold details we already have
InventoryFolderBase purgedBaseFolder = new InventoryFolderBase(); InventoryFolderBase purgedBaseFolder = new InventoryFolderBase();
purgedBaseFolder.Owner = purgedFolder.Owner; purgedBaseFolder.Owner = purgedFolder.Owner;
@ -455,12 +455,12 @@ namespace OpenSim.Framework.Communications.Cache
purgedBaseFolder.Name = purgedFolder.Name; purgedBaseFolder.Name = purgedFolder.Name;
purgedBaseFolder.ParentID = purgedFolder.ParentID; purgedBaseFolder.ParentID = purgedFolder.ParentID;
purgedBaseFolder.Type = purgedFolder.Type; purgedBaseFolder.Type = purgedFolder.Type;
purgedBaseFolder.Version = purgedFolder.Version; purgedBaseFolder.Version = purgedFolder.Version;
m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder);
purgedFolder.Purge(); purgedFolder.Purge();
return true; return true;
} }
} }
@ -470,12 +470,12 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(PurgeFolderDelegate), this, "PurgeFolder"), Delegate.CreateDelegate(typeof(PurgeFolderDelegate), this, "PurgeFolder"),
new object[] { folderID })); new object[] { folderID }));
return true; return true;
} }
return false; return false;
} }
/// <summary> /// <summary>
/// Add an item to the user's inventory /// Add an item to the user's inventory
@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"), Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"),
new object[] { item })); new object[] { item }));
} }
} }
/// <summary> /// <summary>
@ -514,18 +514,18 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"), Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"),
new object[] { item })); new object[] { item }));
} }
} }
/// <summary> /// <summary>
/// Delete an item from the user's inventory /// Delete an item from the user's inventory
/// ///
/// If the inventory service has not yet delievered the inventory /// If the inventory service has not yet delievered the inventory
/// for this user then the request will be queued. /// for this user then the request will be queued.
/// </summary> /// </summary>
/// <param name="itemID"></param> /// <param name="itemID"></param>
/// <returns> /// <returns>
/// true on a successful delete or a if the request is queued. /// true on a successful delete or a if the request is queued.
/// Returns false on an immediate failure /// Returns false on an immediate failure
/// </returns> /// </returns>
public bool DeleteItem(LLUUID itemID) public bool DeleteItem(LLUUID itemID)
@ -535,14 +535,14 @@ namespace OpenSim.Framework.Communications.Cache
// XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though // XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though
// really only the item id is required. // really only the item id is required.
InventoryItemBase item = RootFolder.FindItem(itemID); InventoryItemBase item = RootFolder.FindItem(itemID);
if (null == item) if (null == item)
{ {
m_log.WarnFormat("[AGENT INVENTORY]: Tried to delete item {0} which does not exist", itemID); m_log.WarnFormat("[AGENT INVENTORY]: Tried to delete item {0} which does not exist", itemID);
return false; return false;
} }
if (RootFolder.DeleteItem(item.ID)) if (RootFolder.DeleteItem(item.ID))
{ {
return m_commsManager.InventoryService.DeleteItem(item); return m_commsManager.InventoryService.DeleteItem(item);
@ -554,13 +554,13 @@ namespace OpenSim.Framework.Communications.Cache
new InventoryRequest( new InventoryRequest(
Delegate.CreateDelegate(typeof(DeleteItemDelegate), this, "DeleteItem"), Delegate.CreateDelegate(typeof(DeleteItemDelegate), this, "DeleteItem"),
new object[] { itemID })); new object[] { itemID }));
return true; return true;
} }
return false; return false;
} }
/// <summary> /// <summary>
/// Send details of the inventory items and/or folders in a given folder to the client. /// Send details of the inventory items and/or folders in a given folder to the client.
/// </summary> /// </summary>
@ -574,13 +574,13 @@ namespace OpenSim.Framework.Communications.Cache
if (HasInventory) if (HasInventory)
{ {
InventoryFolderImpl folder; InventoryFolderImpl folder;
if ((folder = RootFolder.FindFolder(folderID)) != null) if ((folder = RootFolder.FindFolder(folderID)) != null)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Found folder {0} for client {1}", // "[AGENT INVENTORY]: Found folder {0} for client {1}",
// folderID, remoteClient.AgentId); // folderID, remoteClient.AgentId);
client.SendInventoryFolderDetails( client.SendInventoryFolderDetails(
client.AgentId, folderID, folder.RequestListOfItems(), client.AgentId, folderID, folder.RequestListOfItems(),
folder.RequestListOfFolders(), fetchFolders, fetchItems); folder.RequestListOfFolders(), fetchFolders, fetchItems);
@ -592,7 +592,7 @@ namespace OpenSim.Framework.Communications.Cache
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}",
folderID, client.Name, client.AgentId); folderID, client.Name, client.AgentId);
return false; return false;
} }
} }
@ -604,13 +604,13 @@ namespace OpenSim.Framework.Communications.Cache
new object[] { client, folderID, fetchFolders, fetchItems })); new object[] { client, folderID, fetchFolders, fetchItems }));
return true; return true;
} }
} }
} }
/// <summary> /// <summary>
/// Should be implemented by callers which require a callback when the user's inventory is received /// Should be implemented by callers which require a callback when the user's inventory is received
/// </summary> /// </summary>
public interface IInventoryRequest public interface IInventoryRequest
{ {
/// <summary> /// <summary>
@ -618,7 +618,7 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
void Execute(); void Execute();
} }
/// <summary> /// <summary>
/// Generic inventory request /// Generic inventory request
/// </summary> /// </summary>
@ -626,16 +626,16 @@ namespace OpenSim.Framework.Communications.Cache
{ {
private Delegate m_delegate; private Delegate m_delegate;
private Object[] m_args; private Object[] m_args;
internal InventoryRequest(Delegate delegat, Object[] args) internal InventoryRequest(Delegate delegat, Object[] args)
{ {
m_delegate = delegat; m_delegate = delegat;
m_args = args; m_args = args;
} }
public void Execute() public void Execute()
{ {
m_delegate.DynamicInvoke(m_args); m_delegate.DynamicInvoke(m_args);
} }
} }
} }

View File

@ -95,9 +95,9 @@ namespace OpenSim.Framework.Communications.Cache
// XmlSerializer xs = new XmlSerializer(typeof(AssetBase)); // XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
// xs.Serialize(s, asset); // xs.Serialize(s, asset);
// RestClient rc = new RestClient(_assetServerUrl); // RestClient rc = new RestClient(_assetServerUrl);
string assetUrl = _assetServerUrl + "/assets/"; string assetUrl = _assetServerUrl + "/assets/";
//rc.AddResourcePath("assets"); //rc.AddResourcePath("assets");
// rc.RequestMethod = "POST"; // rc.RequestMethod = "POST";
@ -105,7 +105,7 @@ namespace OpenSim.Framework.Communications.Cache
//m_log.InfoFormat("[ASSET]: Stored {0}", rc); //m_log.InfoFormat("[ASSET]: Stored {0}", rc);
m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID); m_log.InfoFormat("[GRID ASSET CLIENT]: Sending store request for asset {0}", asset.FullID);
RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset); RestObjectPoster.BeginPostObject<AssetBase>(assetUrl, asset);
} }
catch (Exception e) catch (Exception e)

View File

@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications.Cache
public class InventoryFolderImpl : InventoryFolderBase public class InventoryFolderImpl : InventoryFolderBase
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// Fields // Fields
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>(); public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
@ -82,14 +82,14 @@ namespace OpenSim.Framework.Communications.Cache
subFold.ParentID = this.ID; subFold.ParentID = this.ID;
subFold.Owner = Owner; subFold.Owner = Owner;
SubFolders.Add(subFold.ID, subFold); SubFolders.Add(subFold.ID, subFold);
return subFold; return subFold;
} }
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Delete all the folders and items in this folder. /// Delete all the folders and items in this folder.
/// </summary> /// </summary>
@ -97,9 +97,9 @@ namespace OpenSim.Framework.Communications.Cache
{ {
foreach (InventoryFolderImpl folder in SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
folder.Purge(); folder.Purge();
} }
SubFolders.Clear(); SubFolders.Clear();
Items.Clear(); Items.Clear();
} }
@ -118,20 +118,20 @@ namespace OpenSim.Framework.Communications.Cache
return Items[itemID]; return Items[itemID];
} }
} }
lock (SubFolders) lock (SubFolders)
{ {
foreach (InventoryFolderImpl folder in SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
InventoryItemBase item = folder.FindItem(itemID); InventoryItemBase item = folder.FindItem(itemID);
if (item != null) if (item != null)
{ {
return item; return item;
} }
} }
} }
return null; return null;
} }
@ -143,7 +143,7 @@ namespace OpenSim.Framework.Communications.Cache
public bool DeleteItem(LLUUID itemID) public bool DeleteItem(LLUUID itemID)
{ {
bool found = false; bool found = false;
lock (Items) lock (Items)
{ {
if (Items.ContainsKey(itemID)) if (Items.ContainsKey(itemID))
@ -152,20 +152,20 @@ namespace OpenSim.Framework.Communications.Cache
return true; return true;
} }
} }
lock (SubFolders) lock (SubFolders)
{ {
foreach (InventoryFolderImpl folder in SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
found = folder.DeleteItem(itemID); found = folder.DeleteItem(itemID);
if (found == true) if (found == true)
{ {
break; break;
} }
} }
} }
return found; return found;
} }
@ -175,25 +175,25 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
/// <returns>The requested folder if it exists, null if it does not.</returns> /// <returns>The requested folder if it exists, null if it does not.</returns>
public InventoryFolderImpl FindFolder(LLUUID folderID) public InventoryFolderImpl FindFolder(LLUUID folderID)
{ {
if (folderID == ID) if (folderID == ID)
{ {
return this; return this;
} }
lock (SubFolders) lock (SubFolders)
{ {
foreach (InventoryFolderImpl folder in SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
{ {
InventoryFolderImpl returnFolder = folder.FindFolder(folderID); InventoryFolderImpl returnFolder = folder.FindFolder(folderID);
if (returnFolder != null) if (returnFolder != null)
{ {
return returnFolder; return returnFolder;
} }
} }
} }
return null; return null;
} }
@ -203,7 +203,7 @@ namespace OpenSim.Framework.Communications.Cache
public List<InventoryItemBase> RequestListOfItems() public List<InventoryItemBase> RequestListOfItems()
{ {
List<InventoryItemBase> itemList = new List<InventoryItemBase>(); List<InventoryItemBase> itemList = new List<InventoryItemBase>();
lock (Items) lock (Items)
{ {
foreach (InventoryItemBase item in Items.Values) foreach (InventoryItemBase item in Items.Values)
@ -211,9 +211,9 @@ namespace OpenSim.Framework.Communications.Cache
itemList.Add(item); itemList.Add(item);
} }
} }
//m_log.DebugFormat("[INVENTORY FOLDER IMPL]: Found {0} items", itemList.Count); //m_log.DebugFormat("[INVENTORY FOLDER IMPL]: Found {0} items", itemList.Count);
return itemList; return itemList;
} }
@ -221,9 +221,9 @@ namespace OpenSim.Framework.Communications.Cache
/// Return the list of immediate child folders in this folder. /// Return the list of immediate child folders in this folder.
/// </summary> /// </summary>
public List<InventoryFolderBase> RequestListOfFolders() public List<InventoryFolderBase> RequestListOfFolders()
{ {
List<InventoryFolderBase> folderList = new List<InventoryFolderBase>(); List<InventoryFolderBase> folderList = new List<InventoryFolderBase>();
lock (SubFolders) lock (SubFolders)
{ {
foreach (InventoryFolderBase folder in SubFolders.Values) foreach (InventoryFolderBase folder in SubFolders.Values)
@ -231,7 +231,7 @@ namespace OpenSim.Framework.Communications.Cache
folderList.Add(folder); folderList.Add(folder);
} }
} }
return folderList; return folderList;
} }
} }

View File

@ -45,34 +45,34 @@ namespace OpenSim.Framework.Communications.Cache
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
/// <summary> /// <summary>
/// Holds the root library folder and all its descendents. This is really only used during inventory /// Holds the root library folder and all its descendents. This is really only used during inventory
/// setup so that we don't have to repeatedly search the tree of library folders. /// setup so that we don't have to repeatedly search the tree of library folders.
/// </summary> /// </summary>
protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders
= new Dictionary<LLUUID, InventoryFolderImpl>(); = new Dictionary<LLUUID, InventoryFolderImpl>();
public LibraryRootFolder() public LibraryRootFolder()
{ {
m_log.Info("[LIBRARY INVENTORY]: Loading library inventory"); m_log.Info("[LIBRARY INVENTORY]: Loading library inventory");
Owner = libOwner; Owner = libOwner;
ID = new LLUUID("00000112-000f-0000-0000-000100bba000"); ID = new LLUUID("00000112-000f-0000-0000-000100bba000");
Name = "OpenSim Library"; Name = "OpenSim Library";
ParentID = LLUUID.Zero; ParentID = LLUUID.Zero;
Type = (short) 8; Type = (short) 8;
Version = (ushort) 1; Version = (ushort) 1;
libraryFolders.Add(ID, this); libraryFolders.Add(ID, this);
LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml")); LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml"));
// CreateLibraryItems(); // CreateLibraryItems();
} }
/// <summary> /// <summary>
/// Hardcoded item creation. Please don't add any more items here - future items should be created /// Hardcoded item creation. Please don't add any more items here - future items should be created
/// in the xml in the bin/inventory folder. /// in the xml in the bin/inventory folder.
/// </summary> /// </summary>
/// ///
@ -132,7 +132,7 @@ namespace OpenSim.Framework.Communications.Cache
item.NextPermissions = 0x7FFFFFFF; item.NextPermissions = 0x7FFFFFFF;
return item; return item;
} }
/// <summary> /// <summary>
/// Use the asset set information at path to load assets /// Use the asset set information at path to load assets
/// </summary> /// </summary>
@ -142,49 +142,49 @@ namespace OpenSim.Framework.Communications.Cache
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath); "[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath);
LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig); LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig);
} }
/// <summary> /// <summary>
/// Read a library set from config /// Read a library set from config
/// </summary> /// </summary>
/// <param name="config"></param> /// <param name="config"></param>
protected void ReadLibraryFromConfig(IConfig config) protected void ReadLibraryFromConfig(IConfig config)
{ {
string foldersPath string foldersPath
= Path.Combine( = Path.Combine(
Util.inventoryDir(), config.GetString("foldersFile", String.Empty)); Util.inventoryDir(), config.GetString("foldersFile", String.Empty));
LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig); LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig);
string itemsPath string itemsPath
= Path.Combine( = Path.Combine(
Util.inventoryDir(), config.GetString("itemsFile", String.Empty)); Util.inventoryDir(), config.GetString("itemsFile", String.Empty));
LoadFromFile(itemsPath, "Library items", ReadItemFromConfig); LoadFromFile(itemsPath, "Library items", ReadItemFromConfig);
} }
/// <summary> /// <summary>
/// Read a library inventory folder from a loaded configuration /// Read a library inventory folder from a loaded configuration
/// </summary> /// </summary>
/// <param name="source"></param> /// <param name="source"></param>
private void ReadFolderFromConfig(IConfig config) private void ReadFolderFromConfig(IConfig config)
{ {
InventoryFolderImpl folderInfo = new InventoryFolderImpl(); InventoryFolderImpl folderInfo = new InventoryFolderImpl();
folderInfo.ID = new LLUUID(config.GetString("folderID", ID.ToString())); folderInfo.ID = new LLUUID(config.GetString("folderID", ID.ToString()));
folderInfo.Name = config.GetString("name", "unknown"); folderInfo.Name = config.GetString("name", "unknown");
folderInfo.ParentID = new LLUUID(config.GetString("parentFolderID", ID.ToString())); folderInfo.ParentID = new LLUUID(config.GetString("parentFolderID", ID.ToString()));
folderInfo.Type = (short)config.GetInt("type", 8); folderInfo.Type = (short)config.GetInt("type", 8);
folderInfo.Owner = libOwner; folderInfo.Owner = libOwner;
folderInfo.Version = 1; folderInfo.Version = 1;
if (libraryFolders.ContainsKey(folderInfo.ParentID)) if (libraryFolders.ContainsKey(folderInfo.ParentID))
{ {
InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID]; InventoryFolderImpl parentFolder = libraryFolders[folderInfo.ParentID];
libraryFolders.Add(folderInfo.ID, folderInfo); libraryFolders.Add(folderInfo.ID, folderInfo);
parentFolder.SubFolders.Add(folderInfo.ID, folderInfo); parentFolder.SubFolders.Add(folderInfo.ID, folderInfo);
@ -201,7 +201,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <summary> /// <summary>
/// Read a library inventory item metadata from a loaded configuration /// Read a library inventory item metadata from a loaded configuration
/// </summary> /// </summary>
/// <param name="source"></param> /// <param name="source"></param>
private void ReadItemFromConfig(IConfig config) private void ReadItemFromConfig(IConfig config)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
@ -218,11 +218,11 @@ namespace OpenSim.Framework.Communications.Cache
item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF); item.NextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF);
item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF); item.EveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF);
item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF); item.BasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF);
if (libraryFolders.ContainsKey(item.Folder)) if (libraryFolders.ContainsKey(item.Folder))
{ {
InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; InventoryFolderImpl parentFolder = libraryFolders[item.Folder];
parentFolder.Items.Add(item.ID, item); parentFolder.Items.Add(item.ID, item);
} }
else else
@ -230,11 +230,11 @@ namespace OpenSim.Framework.Communications.Cache
m_log.WarnFormat( m_log.WarnFormat(
"[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!", "[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!",
item.Name, item.ID, item.Folder); item.Name, item.ID, item.Folder);
} }
} }
private delegate void ConfigAction(IConfig config); private delegate void ConfigAction(IConfig config);
/// <summary> /// <summary>
/// Load the given configuration at a path and perform an action on each Config contained within it /// Load the given configuration at a path and perform an action on each Config contained within it
/// </summary> /// </summary>
@ -242,7 +242,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="fileDescription"></param> /// <param name="fileDescription"></param>
/// <param name="action"></param> /// <param name="action"></param>
private static void LoadFromFile(string path, string fileDescription, ConfigAction action) private static void LoadFromFile(string path, string fileDescription, ConfigAction action)
{ {
if (File.Exists(path)) if (File.Exists(path))
{ {
try try
@ -250,21 +250,21 @@ namespace OpenSim.Framework.Communications.Cache
XmlConfigSource source = new XmlConfigSource(path); XmlConfigSource source = new XmlConfigSource(path);
for (int i = 0; i < source.Configs.Count; i++) for (int i = 0; i < source.Configs.Count; i++)
{ {
action(source.Configs[i]); action(source.Configs[i]);
} }
} }
catch (XmlException e) catch (XmlException e)
{ {
m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e); m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e);
} }
} }
else else
{ {
m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path); m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path);
} }
} }
/// <summary> /// <summary>
/// Looks like a simple getter, but is written like this for some consistency with the other Request /// Looks like a simple getter, but is written like this for some consistency with the other Request
/// methods in the superclass /// methods in the superclass

View File

@ -33,7 +33,7 @@ using libsecondlife;
using log4net; using log4net;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
/// <summary> /// <summary>
/// Holds user profile information and retrieves it from backend services. /// Holds user profile information and retrieves it from backend services.
/// </summary> /// </summary>
@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications.Cache
/// The comms manager holds references to services (user, grid, inventory, etc.) /// The comms manager holds references to services (user, grid, inventory, etc.)
/// </summary> /// </summary>
private readonly CommunicationsManager m_commsManager; private readonly CommunicationsManager m_commsManager;
/// <summary> /// <summary>
/// Each user has a cached profile. /// Each user has a cached profile.
/// </summary> /// </summary>
@ -84,8 +84,8 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
} }
} }
/// <summary> /// <summary>
/// Remove this user's profile cache. /// Remove this user's profile cache.
/// </summary> /// </summary>
@ -103,9 +103,9 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
m_log.ErrorFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userID); m_log.ErrorFormat("[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userID);
} }
} }
return false; return false;
} }
@ -118,14 +118,14 @@ namespace OpenSim.Framework.Communications.Cache
{ {
CachedUserInfo userInfo = GetUserDetails(userID); CachedUserInfo userInfo = GetUserDetails(userID);
if (userInfo != null) if (userInfo != null)
{ {
m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive); m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
} }
else else
{ {
m_log.ErrorFormat("[USER CACHE]: RequestInventoryForUser() - user profile for user {0} not found", userID); m_log.ErrorFormat("[USER CACHE]: RequestInventoryForUser() - user profile for user {0} not found", userID);
} }
} }
/// <summary> /// <summary>
/// Get the details of the given user. A caller should try this method first if it isn't sure that /// Get the details of the given user. A caller should try this method first if it isn't sure that
@ -151,7 +151,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="parentID"></param> /// <param name="parentID"></param>
public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType, public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
string folderName, LLUUID parentID) string folderName, LLUUID parentID)
{ {
CachedUserInfo userProfile; CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
@ -159,21 +159,21 @@ namespace OpenSim.Framework.Communications.Cache
if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID))
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to create folder for user {0} {1}", "[AGENT INVENTORY]: Failed to create folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
/// <summary> /// <summary>
/// Handle a client request to update the inventory folder /// Handle a client request to update the inventory folder
/// ///
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
/// and needs to be changed. /// and needs to be changed.
@ -188,7 +188,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId);
CachedUserInfo userProfile; CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
@ -196,16 +196,16 @@ namespace OpenSim.Framework.Communications.Cache
if (!userProfile.UpdateFolder(name, folderID, type, parentID)) if (!userProfile.UpdateFolder(name, folderID, type, parentID))
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to update folder for user {0} {1}", "[AGENT INVENTORY]: Failed to update folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
/// <summary> /// <summary>
@ -223,16 +223,16 @@ namespace OpenSim.Framework.Communications.Cache
if (!userProfile.MoveFolder(folderID, parentID)) if (!userProfile.MoveFolder(folderID, parentID))
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to move folder for user {0} {1}", "[AGENT INVENTORY]: Failed to move folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
/// <summary> /// <summary>
@ -267,14 +267,14 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
/// <summary> /// <summary>
/// Handle the caps inventory descendents fetch. /// Handle the caps inventory descendents fetch.
/// ///
/// Since the folder structure is sent to the client on login, I believe we only need to handle items. /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
/// </summary> /// </summary>
/// <param name="agentID"></param> /// <param name="agentID"></param>
@ -288,20 +288,20 @@ namespace OpenSim.Framework.Communications.Cache
bool fetchFolders, bool fetchItems, int sortOrder) bool fetchFolders, bool fetchItems, int sortOrder)
{ {
// m_log.DebugFormat( // m_log.DebugFormat(
// "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}",
// fetchFolders, fetchItems, folderID, agentID); // fetchFolders, fetchItems, folderID, agentID);
// FIXME MAYBE: We're not handling sortOrder! // FIXME MAYBE: We're not handling sortOrder!
InventoryFolderImpl fold; InventoryFolderImpl fold;
if ((fold = libraryRoot.FindFolder(folderID)) != null) if ((fold = libraryRoot.FindFolder(folderID)) != null)
{ {
return fold.RequestListOfItems(); return fold.RequestListOfItems();
} }
CachedUserInfo userProfile; CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(agentID, out userProfile)) if (m_userProfiles.TryGetValue(agentID, out userProfile))
{ {
// XXX: When a client crosses into a scene, their entire inventory is fetched // XXX: When a client crosses into a scene, their entire inventory is fetched
// asynchronously. If the client makes a request before the inventory is received, we need // asynchronously. If the client makes a request before the inventory is received, we need
// to give the inventory a chance to come in. // to give the inventory a chance to come in.
@ -315,18 +315,18 @@ namespace OpenSim.Framework.Communications.Cache
while (attempts++ < 30) while (attempts++ < 30)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
attempts, folderID, agentID); attempts, folderID, agentID);
Thread.Sleep(2000); Thread.Sleep(2000);
if (userProfile.HasInventory) if (userProfile.HasInventory)
{ {
break; break;
} }
} }
} }
if (userProfile.HasInventory) if (userProfile.HasInventory)
{ {
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
@ -338,9 +338,9 @@ namespace OpenSim.Framework.Communications.Cache
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
folderID, agentID); folderID, agentID);
return null; return null;
} }
} }
else else
{ {
@ -352,7 +352,7 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID);
return null; return null;
} }
} }
@ -371,16 +371,16 @@ namespace OpenSim.Framework.Communications.Cache
if (!userProfile.PurgeFolder(folderID)) if (!userProfile.PurgeFolder(folderID))
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID) public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
@ -407,9 +407,9 @@ namespace OpenSim.Framework.Communications.Cache
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not find user profile for {0} {1}", "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }
} }
} }
} }

View File

@ -64,16 +64,16 @@ namespace OpenSim.Framework.Communications.Capabilities
public class Caps public class Caps
{ {
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_httpListenerHostName; private string m_httpListenerHostName;
private uint m_httpListenPort; private uint m_httpListenPort;
/// <summary> /// <summary>
/// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester. /// This is the uuid portion of every CAPS path. It is used to make capability urls private to the requester.
/// </summary> /// </summary>
private string m_capsObjectPath; private string m_capsObjectPath;
public string CapsObjectPath { get { return m_capsObjectPath; } } public string CapsObjectPath { get { return m_capsObjectPath; } }
private CapsHandlers m_capsHandlers; private CapsHandlers m_capsHandlers;
@ -88,7 +88,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// The following two entries are in a module, however, there also here so that we don't re-assign // The following two entries are in a module, however, there also here so that we don't re-assign
// the path to another cap by mistake. // the path to another cap by mistake.
private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; // This is in a module. private static readonly string m_parcelVoiceInfoRequestPath = "0007/"; // This is in a module.
private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module. private static readonly string m_provisionVoiceAccountRequestPath = "0008/";// This is in a module.
//private string eventQueue = "0100/"; //private string eventQueue = "0100/";
@ -100,7 +100,7 @@ namespace OpenSim.Framework.Communications.Capabilities
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
private string m_regionName; private string m_regionName;
// These are callbacks which will be setup by the scene so that we can update scene data when we // These are callbacks which will be setup by the scene so that we can update scene data when we
// receive capability calls // receive capability calls
public NewInventoryItem AddNewInventoryItem = null; public NewInventoryItem AddNewInventoryItem = null;
public ItemUpdatedCallback ItemUpdatedCall = null; public ItemUpdatedCallback ItemUpdatedCall = null;
@ -128,46 +128,46 @@ namespace OpenSim.Framework.Communications.Capabilities
public void RegisterHandlers() public void RegisterHandlers()
{ {
DeregisterHandlers(); DeregisterHandlers();
string capsBase = "/CAPS/" + m_capsObjectPath; string capsBase = "/CAPS/" + m_capsObjectPath;
try try
{ {
// the root of all evil // the root of all evil
m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest); m_capsHandlers["SEED"] = new RestStreamHandler("POST", capsBase + m_requestPath, CapsRequest);
m_capsHandlers["MapLayer"] = m_capsHandlers["MapLayer"] =
new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST", new LLSDStreamhandler<LLSDMapRequest, LLSDMapLayerResponse>("POST",
capsBase + m_mapLayerPath, capsBase + m_mapLayerPath,
GetMapLayer); GetMapLayer);
m_capsHandlers["NewFileAgentInventory"] = m_capsHandlers["NewFileAgentInventory"] =
new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST", new LLSDStreamhandler<LLSDAssetUploadRequest, LLSDAssetUploadResponse>("POST",
capsBase + m_newInventory, capsBase + m_newInventory,
NewAgentInventoryRequest); NewAgentInventoryRequest);
m_capsHandlers["UpdateNotecardAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"] =
new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory); new RestStreamHandler("POST", capsBase + m_notecardUpdatePath, NoteCardAgentInventory);
m_capsHandlers["UpdateScriptAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"]; m_capsHandlers["UpdateScriptAgentInventory"] = m_capsHandlers["UpdateNotecardAgentInventory"];
m_capsHandlers["UpdateScriptTaskInventory"] = m_capsHandlers["UpdateScriptTaskInventory"] =
new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory); new RestStreamHandler("POST", capsBase + m_notecardTaskUpdatePath, ScriptTaskInventory);
// justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
// subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
// enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service, // enhancements (probably filling out the folder part of the LLSD reply) to our CAPS service,
// but when I went on the Linden grid, the // but when I went on the Linden grid, the
// simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead, // simulators I visited (version 1.21) were, surprisingly, no longer supplying this capability. Instead,
// the 1.19.1.4 client appeared to be happily flowing inventory data over UDP // the 1.19.1.4 client appeared to be happily flowing inventory data over UDP
// //
// This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid // This is very probably just a temporary measure - once the CAPS service appears again on the Linden grid
// we will be // we will be
// able to get the data we need to implement the necessary part of the protocol to fix the issue above. // able to get the data we need to implement the necessary part of the protocol to fix the issue above.
// m_capsHandlers["FetchInventoryDescendents"] = // m_capsHandlers["FetchInventoryDescendents"] =
// new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest); // new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryRequest);
// m_capsHandlers["FetchInventoryDescendents"] = // m_capsHandlers["FetchInventoryDescendents"] =
// new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST", // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
// capsBase + m_fetchInventory, // capsBase + m_fetchInventory,
// FetchInventory)); // FetchInventory));
// m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST", // m_capsHandlers["RequestTextureDownload"] = new RestStreamHandler("POST",
// capsBase + m_requestTexture, // capsBase + m_requestTexture,
// RequestTexture); // RequestTexture);
} }
catch (Exception e) catch (Exception e)
@ -181,7 +181,7 @@ namespace OpenSim.Framework.Communications.Capabilities
/// </summary> /// </summary>
/// <param name="capName"></param> /// <param name="capName"></param>
/// <param name="handler"></param> /// <param name="handler"></param>
public void RegisterHandler(string capName, IRequestHandler handler) public void RegisterHandler(string capName, IRequestHandler handler)
{ {
m_capsHandlers[capName] = handler; m_capsHandlers[capName] = handler;
m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path); m_log.DebugFormat("[CAPS]: Registering handler for \"{0}\": path {1}", capName, handler.Path);
@ -189,14 +189,14 @@ namespace OpenSim.Framework.Communications.Capabilities
/// <summary> /// <summary>
/// Remove all CAPS service handlers. /// Remove all CAPS service handlers.
/// ///
/// </summary> /// </summary>
/// <param name="httpListener"></param> /// <param name="httpListener"></param>
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="restMethod"></param> /// <param name="restMethod"></param>
public void DeregisterHandlers() public void DeregisterHandlers()
{ {
foreach (string capsName in m_capsHandlers.Caps) foreach (string capsName in m_capsHandlers.Caps)
{ {
m_capsHandlers.Remove(capsName); m_capsHandlers.Remove(capsName);
} }
@ -220,7 +220,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// FIXME: these all should probably go into the respective region // FIXME: these all should probably go into the respective region
// modules // modules
/// <summary> /// <summary>
/// Processes a fetch inventory request and sends the reply /// Processes a fetch inventory request and sends the reply
@ -229,7 +229,7 @@ namespace OpenSim.Framework.Communications.Capabilities
/// <param name="path"></param> /// <param name="path"></param>
/// <param name="param"></param> /// <param name="param"></param>
/// <returns></returns> /// <returns></returns>
// Request is like: // Request is like:
//<llsd> //<llsd>
// <map><key>folders</key> // <map><key>folders</key>
// <array> // <array>
@ -240,14 +240,14 @@ namespace OpenSim.Framework.Communications.Capabilities
// </map> // </map>
//</llsd> //</llsd>
// //
// multiple fetch-folder maps are allowed within the larger folders map. // multiple fetch-folder maps are allowed within the larger folders map.
public string FetchInventoryRequest(string request, string path, string param) public string FetchInventoryRequest(string request, string path, string param)
{ {
string unmodifiedRequest = request.ToString(); string unmodifiedRequest = request.ToString();
//m_log.DebugFormat("[AGENT INVENTORY]: Received CAPS fetch inventory request {0}", unmodifiedRequest); //m_log.DebugFormat("[AGENT INVENTORY]: Received CAPS fetch inventory request {0}", unmodifiedRequest);
m_log.Debug("[CAPS]: Inventory Request in region: " + m_regionName); m_log.Debug("[CAPS]: Inventory Request in region: " + m_regionName);
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
try try
{ {
@ -258,7 +258,7 @@ namespace OpenSim.Framework.Communications.Capabilities
m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message); m_log.Error("[AGENT INVENTORY]: Fetch error: " + pe.Message);
m_log.Error("Request: " + request.ToString()); m_log.Error("Request: " + request.ToString());
} }
ArrayList foldersrequested = (ArrayList)hash["folders"]; ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = ""; string response = "";
@ -275,15 +275,15 @@ namespace OpenSim.Framework.Communications.Capabilities
inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply);
inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", "");
inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", "");
response += inventoryitemstr; response += inventoryitemstr;
} }
if (response.Length == 0) if (response.Length == 0)
{ {
// Ter-guess: If requests fail a lot, the client seems to stop requesting descendants. // Ter-guess: If requests fail a lot, the client seems to stop requesting descendants.
// Therefore, I'm concluding that the client only has so many threads available to do requests // Therefore, I'm concluding that the client only has so many threads available to do requests
// and when a thread stalls.. is stays stalled. // and when a thread stalls.. is stays stalled.
// Therefore we need to return something valid // Therefore we need to return something valid
response = "<llsd><map><key>folders</key><array /></map></llsd>"; response = "<llsd><map><key>folders</key><array /></map></llsd>";
} }
@ -291,7 +291,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>";
} }
//m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request with following xml"); //m_log.DebugFormat("[AGENT INVENTORY]: Replying to CAPS fetch inventory request with following xml");
//m_log.Debug(Util.GetFormattedXml(response)); //m_log.Debug(Util.GetFormattedXml(response));
@ -310,7 +310,7 @@ namespace OpenSim.Framework.Communications.Capabilities
contents.agent___id = m_agentID; contents.agent___id = m_agentID;
contents.owner___id = invFetch.owner_id; contents.owner___id = invFetch.owner_id;
contents.folder___id = invFetch.folder_id; contents.folder___id = invFetch.folder_id;
// The version number being sent back was originally 1. // The version number being sent back was originally 1.
// Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins
// without clearing client cache, objects in the root folder disappear until the cache is cleared, // without clearing client cache, objects in the root folder disappear until the cache is cleared,
@ -318,8 +318,8 @@ namespace OpenSim.Framework.Communications.Capabilities
// //
// Seeing the version to something other than 0 may be the right thing to do, but there is // Seeing the version to something other than 0 may be the right thing to do, but there is
// a greater subtlety of the second life protocol that needs to be understood first. // a greater subtlety of the second life protocol that needs to be understood first.
contents.version = 0; contents.version = 0;
contents.descendents = 0; contents.descendents = 0;
reply.folders.Array.Add(contents); reply.folders.Array.Add(contents);
List<InventoryItemBase> itemList = null; List<InventoryItemBase> itemList = null;
@ -327,7 +327,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order);
} }
if (itemList != null) if (itemList != null)
{ {
foreach (InventoryItemBase invItem in itemList) foreach (InventoryItemBase invItem in itemList)
@ -336,12 +336,12 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
} }
else else
{ {
IClientAPI client = GetClient(m_agentID); IClientAPI client = GetClient(m_agentID);
// We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response.
// If we don't send back the response, // If we don't send back the response,
// the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest())
if (client != null) if (client != null)
{ {
client.SendAgentAlertMessage( client.SendAgentAlertMessage(
@ -351,11 +351,11 @@ namespace OpenSim.Framework.Communications.Capabilities
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure", "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure",
m_agentID); m_agentID);
} }
} }
contents.descendents = contents.items.Array.Count; contents.descendents = contents.items.Array.Count;
return reply; return reply;
} }
@ -375,7 +375,7 @@ namespace OpenSim.Framework.Communications.Capabilities
llsdItem.item_id = invItem.ID; llsdItem.item_id = invItem.ID;
llsdItem.name = invItem.Name; llsdItem.name = invItem.Name;
llsdItem.parent_id = invItem.Folder; llsdItem.parent_id = invItem.Folder;
llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower(); llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower();
llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower(); llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower();
llsdItem.permissions = new LLSDPermissions(); llsdItem.permissions = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.Creator; llsdItem.permissions.creator_id = invItem.Creator;
@ -395,7 +395,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="mapReq"></param> /// <param name="mapReq"></param>
/// <returns></returns> /// <returns></returns>
@ -408,7 +408,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected static LLSDMapLayer GetLLSDMapLayerResponse() protected static LLSDMapLayer GetLLSDMapLayerResponse()
@ -421,7 +421,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -437,7 +437,7 @@ namespace OpenSim.Framework.Communications.Capabilities
#region EventQueue (Currently not enabled) #region EventQueue (Currently not enabled)
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -463,7 +463,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="caps"></param> /// <param name="caps"></param>
/// <param name="ipAddressPort"></param> /// <param name="ipAddressPort"></param>
@ -482,7 +482,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string CreateEmptyEventResponse() public string CreateEmptyEventResponse()
@ -590,7 +590,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="llsdRequest"></param> /// <param name="llsdRequest"></param>
/// <returns></returns> /// <returns></returns>
@ -622,7 +622,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="assetID"></param> /// <param name="assetID"></param>
/// <param name="inventoryItem"></param> /// <param name="inventoryItem"></param>
@ -708,7 +708,7 @@ namespace OpenSim.Framework.Communications.Capabilities
/// <param name="itemID">Item to update</param> /// <param name="itemID">Item to update</param>
/// <param name="primID">Prim containing item to update</param> /// <param name="primID">Prim containing item to update</param>
/// <param name="isScriptRunning">Signals whether the script to update is currently running</param> /// <param name="isScriptRunning">Signals whether the script to update is currently running</param>
/// <param name="data">New asset data</param> /// <param name="data">New asset data</param>
public void TaskScriptUpdated(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data) public void TaskScriptUpdated(LLUUID itemID, LLUUID primID, bool isScriptRunning, byte[] data)
{ {
if (TaskScriptUpdatedCall != null) if (TaskScriptUpdatedCall != null)
@ -751,7 +751,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -807,7 +807,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// This class is a callback invoked when a client sends asset data to /// This class is a callback invoked when a client sends asset data to
/// an agent inventory notecard update url /// an agent inventory notecard update url
/// </summary> /// </summary>
public class ItemUpdater public class ItemUpdater
@ -831,7 +831,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -889,7 +889,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// This class is a callback invoked when a client sends asset data to /// This class is a callback invoked when a client sends asset data to
/// a task inventory script update url /// a task inventory script update url
/// </summary> /// </summary>
public class TaskInventoryScriptUpdater public class TaskInventoryScriptUpdater
@ -921,7 +921,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="data"></param>
/// <param name="path"></param> /// <param name="path"></param>
@ -931,7 +931,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
try try
{ {
// m_log.InfoFormat("[CAPS]: " + // m_log.InfoFormat("[CAPS]: " +
// "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}", // "TaskInventoryScriptUpdater received data: {0}, path: {1}, param: {2}",
// data, path, param)); // data, path, param));

View File

@ -64,14 +64,14 @@ namespace OpenSim.Framework.Communications.Capabilities
/// </summary> /// </summary>
/// <param name="capsName">name of the capability of the cap /// <param name="capsName">name of the capability of the cap
/// handler to be removed</param> /// handler to be removed</param>
public void Remove(string capsName) public void Remove(string capsName)
{ {
// This line must be here, or caps will break! // This line must be here, or caps will break!
m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path); m_httpListener.RemoveStreamHandler("POST", m_capsHandlers[capsName].Path);
m_capsHandlers.Remove(capsName); m_capsHandlers.Remove(capsName);
} }
public bool ContainsCap(string cap) public bool ContainsCap(string cap)
{ {
return m_capsHandlers.ContainsKey(cap); return m_capsHandlers.ContainsKey(cap);
} }
@ -85,14 +85,14 @@ namespace OpenSim.Framework.Communications.Capabilities
/// retrieve a cap handler for a cap that is not contained in /// retrieve a cap handler for a cap that is not contained in
/// CapsHandlers. /// CapsHandlers.
/// </Remarks> /// </Remarks>
public IRequestHandler this[string idx] public IRequestHandler this[string idx]
{ {
get get
{ {
return m_capsHandlers[idx]; return m_capsHandlers[idx];
} }
set set
{ {
if (m_capsHandlers.ContainsKey(idx)) if (m_capsHandlers.ContainsKey(idx))
{ {
@ -111,9 +111,9 @@ namespace OpenSim.Framework.Communications.Capabilities
/// Return the list of cap names for which this CapsHandlers /// Return the list of cap names for which this CapsHandlers
/// object contains cap handlers. /// object contains cap handlers.
/// </summary> /// </summary>
public string[] Caps public string[] Caps
{ {
get get
{ {
string[] __keys = new string[m_capsHandlers.Keys.Count]; string[] __keys = new string[m_capsHandlers.Keys.Count];
m_capsHandlers.Keys.CopyTo(__keys, 0); m_capsHandlers.Keys.CopyTo(__keys, 0);
@ -125,7 +125,7 @@ namespace OpenSim.Framework.Communications.Capabilities
/// Return an LLSD-serializable Hashtable describing the /// Return an LLSD-serializable Hashtable describing the
/// capabilities and their handler details. /// capabilities and their handler details.
/// </summary> /// </summary>
public Hashtable CapsDetails public Hashtable CapsDetails
{ {
get get
{ {

View File

@ -37,12 +37,12 @@ using libsecondlife;
namespace OpenSim.Framework.Communications.Capabilities namespace OpenSim.Framework.Communications.Capabilities
{ {
/// <summary> /// <summary>
/// Borrowed from (a older version of) libsl for now, as their new llsd code doesn't work we our decoding code. /// Borrowed from (a older version of) libsl for now, as their new llsd code doesn't work we our decoding code.
/// </summary> /// </summary>
public static class LLSD public static class LLSD
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class LLSDParseException : Exception public class LLSDParseException : Exception
{ {
@ -52,7 +52,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class LLSDSerializeException : Exception public class LLSDSerializeException : Exception
{ {
@ -62,7 +62,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="b"></param> /// <param name="b"></param>
/// <returns></returns> /// <returns></returns>
@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="st"></param> /// <param name="st"></param>
/// <returns></returns> /// <returns></returns>
@ -96,7 +96,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="obj"></param> /// <param name="obj"></param>
/// <returns></returns> /// <returns></returns>
@ -116,7 +116,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="writer"></param> /// <param name="writer"></param>
/// <param name="obj"></param> /// <param name="obj"></param>
@ -217,7 +217,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
/// <returns></returns> /// <returns></returns>
@ -360,7 +360,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
/// <returns></returns> /// <returns></returns>
@ -405,7 +405,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
/// <returns></returns> /// <returns></returns>
@ -441,7 +441,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="count"></param> /// <param name="count"></param>
/// <returns></returns> /// <returns></returns>
@ -453,7 +453,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="obj"></param> /// <param name="obj"></param>
/// <param name="indent"></param> /// <param name="indent"></param>
@ -661,7 +661,7 @@ namespace OpenSim.Framework.Communications.Capabilities
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
private static void SkipWS(XmlTextReader reader) private static void SkipWS(XmlTextReader reader)

View File

@ -35,9 +35,9 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
public class LLSDHelpers public class LLSDHelpers
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public static string SerialiseLLSDReply(object obj) public static string SerialiseLLSDReply(object obj)
{ {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
@ -47,9 +47,9 @@ namespace OpenSim.Framework.Communications.Capabilities
SerializeLLSDType(writer, obj); SerializeLLSDType(writer, obj);
writer.WriteEndElement(); writer.WriteEndElement();
writer.Close(); writer.Close();
//m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString()); //m_log.DebugFormat("[LLSD Helpers]: Generated serialized LLSD reply {0}", sw.ToString());
return sw.ToString(); return sw.ToString();
} }
@ -146,7 +146,7 @@ namespace OpenSim.Framework.Communications.Capabilities
fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value); fieldValue.GetType().GetField("Array").SetValue(fieldValue, enumerator.Value);
//TODO //TODO
// the LLSD map/array types in the array need to be deserialised // the LLSD map/array types in the array need to be deserialised
// but first we need to know the right class to deserialise them into. // but first we need to know the right class to deserialise them into.
} }
else else
{ {

View File

@ -91,7 +91,7 @@ namespace OpenSim.Framework.Communications.Capabilities
public int descendents; public int descendents;
public LLUUID folder___id; //as LL can't decide if they are going to use "_" or "-" to separate words in the field names public LLUUID folder___id; //as LL can't decide if they are going to use "_" or "-" to separate words in the field names
public LLSDArray items = new LLSDArray(); public LLSDArray items = new LLSDArray();
public LLUUID owner___id; // and of course we can't have field names with "-" in public LLUUID owner___id; // and of course we can't have field names with "-" in
public int version; public int version;
} }
} }

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
using System.Collections; using System.Collections;
@ -41,7 +41,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
} }
public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds) public LLSDParcelVoiceInfoResponse(string region, int localID, Hashtable creds)
{ {
region_name = region; region_name = region;
parcel_local_id = localID; parcel_local_id = localID;

View File

@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications.Capabilities
//string requestBody = streamReader.ReadToEnd(); //string requestBody = streamReader.ReadToEnd();
//streamReader.Close(); //streamReader.Close();
// libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap) // libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
// libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request)); // libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request); Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);

View File

@ -34,7 +34,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
/// <summary> /// <summary>
/// The task inventory item that was updated /// The task inventory item that was updated
/// </summary> /// </summary>
public LLUUID item_id; public LLUUID item_id;
/// <summary> /// <summary>

View File

@ -34,17 +34,17 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
/// <summary> /// <summary>
/// The item containing the script to update /// The item containing the script to update
/// </summary> /// </summary>
public LLUUID item_id; public LLUUID item_id;
/// <summary> /// <summary>
/// The task containing the script /// The task containing the script
/// </summary> /// </summary>
public LLUUID task_id; public LLUUID task_id;
/// <summary> /// <summary>
/// Signals whether the script is currently active /// Signals whether the script is currently active
/// </summary> /// </summary>
public int is_script_running; public int is_script_running;
} }
} }

View File

@ -23,7 +23,7 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
namespace OpenSim.Framework.Communications.Capabilities namespace OpenSim.Framework.Communications.Capabilities
@ -38,7 +38,7 @@ namespace OpenSim.Framework.Communications.Capabilities
{ {
} }
public LLSDVoiceAccountResponse(string user, string pass) public LLSDVoiceAccountResponse(string user, string pass)
{ {
username = user; username = user;
password = pass; password = pass;

View File

@ -236,7 +236,7 @@ namespace OpenSim.Framework.Communications
public void UpdateAvatarPropertiesRequest(IClientAPI remote_client, UserProfileData UserProfile) public void UpdateAvatarPropertiesRequest(IClientAPI remote_client, UserProfileData UserProfile)
{ {
m_userService.UpdateUserProfileProperties(UserProfile); m_userService.UpdateUserProfileProperties(UserProfile);
return; return;
} }

View File

@ -112,7 +112,7 @@ namespace OpenSim.Framework.Communications
public void EndInvoke() public void EndInvoke()
{ {
// This method assumes that only 1 thread calls EndInvoke // This method assumes that only 1 thread calls EndInvoke
if (!IsCompleted) if (!IsCompleted)
{ {
// If the operation isn't done, wait for it // If the operation isn't done, wait for it
@ -142,7 +142,7 @@ namespace OpenSim.Framework.Communications
// Save the asynchronous operation's result // Save the asynchronous operation's result
m_result = result; m_result = result;
// Tell the base class that the operation completed // Tell the base class that the operation completed
// sucessfully (no exception) // sucessfully (no exception)
base.SetAsCompleted(completedSynchronously); base.SetAsCompleted(completedSynchronously);
} }

View File

@ -43,62 +43,62 @@ namespace OpenSim.Framework.Communications
public interface IInventoryServices public interface IInventoryServices
{ {
/// <summary> /// <summary>
/// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
/// inventory has been received /// inventory has been received
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <param name="callback"></param> /// <param name="callback"></param>
void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
/// <summary> /// <summary>
/// Add a new folder to the user's inventory /// Add a new folder to the user's inventory
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns>true if the folder was successfully added</returns> /// <returns>true if the folder was successfully added</returns>
bool AddFolder(InventoryFolderBase folder); bool AddFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Move an inventory folder to a new location /// Move an inventory folder to a new location
/// </summary> /// </summary>
/// <param name="folder">A folder containing the details of the new location</param> /// <param name="folder">A folder containing the details of the new location</param>
/// <returns>true if the folder was successfully moved</returns> /// <returns>true if the folder was successfully moved</returns>
bool MoveFolder(InventoryFolderBase folder); bool MoveFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Purge an inventory folder of all its items and subfolders. /// Purge an inventory folder of all its items and subfolders.
/// </summary> /// </summary>
/// <param name="folder"></param> /// <param name="folder"></param>
/// <returns>true if the folder was successfully purged</returns> /// <returns>true if the folder was successfully purged</returns>
bool PurgeFolder(InventoryFolderBase folder); bool PurgeFolder(InventoryFolderBase folder);
/// <summary> /// <summary>
/// Add a new item to the user's inventory /// Add a new item to the user's inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully added</returns> /// <returns>true if the item was successfully added</returns>
bool AddItem(InventoryItemBase item); bool AddItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Update an item in the user's inventory /// Update an item in the user's inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully updated</returns> /// <returns>true if the item was successfully updated</returns>
bool UpdateItem(InventoryItemBase item); bool UpdateItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Delete an item from the user's inventory /// Delete an item from the user's inventory
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
/// <returns>true if the item was successfully deleted</returns> /// <returns>true if the item was successfully deleted</returns>
bool DeleteItem(InventoryItemBase item); bool DeleteItem(InventoryItemBase item);
/// <summary> /// <summary>
/// Create a new inventory for the given user. /// Create a new inventory for the given user.
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
/// <returns>true if the inventory was successfully created, false otherwise</returns> /// <returns>true if the inventory was successfully created, false otherwise</returns>
bool CreateNewUserInventory(LLUUID user); bool CreateNewUserInventory(LLUUID user);
bool HasInventoryForUser(LLUUID userID); bool HasInventoryForUser(LLUUID userID);
/// <summary> /// <summary>
@ -107,12 +107,12 @@ namespace OpenSim.Framework.Communications
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns>null if no root folder was found</returns> /// <returns>null if no root folder was found</returns>
InventoryFolderBase RequestRootFolder(LLUUID userID); InventoryFolderBase RequestRootFolder(LLUUID userID);
/// <summary> /// <summary>
/// Returns a list of all the folders in a given user's inventory. /// Returns a list of all the folders in a given user's inventory.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <returns>A flat list of the user's inventory folder tree, /// <returns>A flat list of the user's inventory folder tree,
/// null if there is no inventory for this user</returns> /// null if there is no inventory for this user</returns>
List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId); List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId);
} }

View File

@ -37,7 +37,7 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
/// <param name="fname">First name</param> /// <param name="fname">First name</param>
/// <param name="lname">Last name</param> /// <param name="lname">Last name</param>
/// <returns>A user profile. Returns null if no profile is found</returns> /// <returns>A user profile. Returns null if no profile is found</returns>
UserProfileData GetUserProfile(string firstName, string lastName); UserProfileData GetUserProfile(string firstName, string lastName);
//UserProfileData GetUserProfile(string name); //UserProfileData GetUserProfile(string name);
@ -46,7 +46,7 @@ namespace OpenSim.Framework.Communications
/// Loads a user profile from a database by UUID /// Loads a user profile from a database by UUID
/// </summary> /// </summary>
/// <param name="uuid">The target UUID</param> /// <param name="uuid">The target UUID</param>
/// <returns>A user profile. Returns null if no user profile is found.</returns> /// <returns>A user profile. Returns null if no user profile is found.</returns>
UserProfileData GetUserProfile(LLUUID userId); UserProfileData GetUserProfile(LLUUID userId);
void clearUserAgent(LLUUID avatarID); void clearUserAgent(LLUUID avatarID);
@ -57,7 +57,7 @@ namespace OpenSim.Framework.Communications
UserProfileData SetupMasterUser(LLUUID userId); UserProfileData SetupMasterUser(LLUUID userId);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY); LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY);
@ -110,7 +110,7 @@ namespace OpenSim.Framework.Communications
List<FriendListItem> GetUserFriendList(LLUUID friendlistowner); List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
/// <summary> /// <summary>
/// Get's the User Appearance /// Get's the User Appearance
AvatarAppearance GetUserAppearance(LLUUID user); AvatarAppearance GetUserAppearance(LLUUID user);
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);

View File

@ -40,13 +40,13 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
public abstract class InventoryServiceBase : IInventoryServices public abstract class InventoryServiceBase : IInventoryServices
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>(); protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
#region Plugin methods #region Plugin methods
/// <summary> /// <summary>
/// Adds a new user server plugin - plugins will be requested in the order they were loaded. /// Adds a new user server plugin - plugins will be requested in the order they were loaded.
/// </summary> /// </summary>
@ -76,42 +76,42 @@ namespace OpenSim.Framework.Communications
} }
} }
} }
#endregion #endregion
#region IInventoryServices methods #region IInventoryServices methods
// See IInventoryServices // See IInventoryServices
public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId) public List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId)
{ {
// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId); // m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId);
InventoryFolderBase rootFolder = RequestRootFolder(userId); InventoryFolderBase rootFolder = RequestRootFolder(userId);
// Agent has no inventory structure yet. // Agent has no inventory structure yet.
if (null == rootFolder) if (null == rootFolder)
{ {
return null; return null;
} }
List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>(); List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>();
userFolders.Add(rootFolder); userFolders.Add(rootFolder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
IList<InventoryFolderBase> folders = plugin.Value.getFolderHierarchy(rootFolder.ID); IList<InventoryFolderBase> folders = plugin.Value.getFolderHierarchy(rootFolder.ID);
userFolders.AddRange(folders); userFolders.AddRange(folders);
} }
// foreach (InventoryFolderBase folder in userFolders) // foreach (InventoryFolderBase folder in userFolders)
// { // {
// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID); // m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID);
// } // }
return userFolders; return userFolders;
} }
// See IInventoryServices // See IInventoryServices
public virtual bool HasInventoryForUser(LLUUID userID) public virtual bool HasInventoryForUser(LLUUID userID)
{ {
@ -133,31 +133,31 @@ namespace OpenSim.Framework.Communications
public bool CreateNewUserInventory(LLUUID user) public bool CreateNewUserInventory(LLUUID user)
{ {
InventoryFolderBase existingRootFolder = RequestRootFolder(user); InventoryFolderBase existingRootFolder = RequestRootFolder(user);
if (null != existingRootFolder) if (null != existingRootFolder)
{ {
m_log.WarnFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have " "[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have "
+ "a root inventory folder with id {1}", + "a root inventory folder with id {1}",
user, existingRootFolder.ID); user, existingRootFolder.ID);
} }
else else
{ {
UsersInventory inven = new UsersInventory(); UsersInventory inven = new UsersInventory();
inven.CreateNewInventorySet(user); inven.CreateNewInventorySet(user);
AddNewInventorySet(inven); AddNewInventorySet(inven);
return true; return true;
} }
return false; return false;
} }
// See IInventoryServices // See IInventoryServices
public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback); public abstract void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
#endregion #endregion
#region Methods used by GridInventoryService #region Methods used by GridInventoryService
public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID) public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
@ -180,21 +180,21 @@ namespace OpenSim.Framework.Communications
} }
return itemsList; return itemsList;
} }
#endregion #endregion
// See IInventoryServices // See IInventoryServices
public bool AddFolder(InventoryFolderBase folder) public bool AddFolder(InventoryFolderBase folder)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); "[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.addInventoryFolder(folder); plugin.Value.addInventoryFolder(folder);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
@ -203,14 +203,14 @@ namespace OpenSim.Framework.Communications
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID); "[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.moveInventoryFolder(folder); plugin.Value.moveInventoryFolder(folder);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
// See IInventoryServices // See IInventoryServices
@ -218,14 +218,14 @@ namespace OpenSim.Framework.Communications
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder); "[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.addInventoryItem(item); plugin.Value.addInventoryItem(item);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
// See IInventoryServices // See IInventoryServices
@ -233,14 +233,14 @@ namespace OpenSim.Framework.Communications
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder); "[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.updateInventoryItem(item); plugin.Value.updateInventoryItem(item);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
// See IInventoryServices // See IInventoryServices
@ -248,19 +248,19 @@ namespace OpenSim.Framework.Communications
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder); "[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.deleteInventoryItem(item.ID); plugin.Value.deleteInventoryItem(item.ID);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
/// <summary> /// <summary>
/// Purge a folder of all items items and subfolders. /// Purge a folder of all items items and subfolders.
/// ///
/// FIXME: Really nasty in a sense, because we have to query the database to get information we may /// FIXME: Really nasty in a sense, because we have to query the database to get information we may
/// already know... Needs heavy refactoring. /// already know... Needs heavy refactoring.
/// </summary> /// </summary>
@ -269,13 +269,13 @@ namespace OpenSim.Framework.Communications
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID); "[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID); List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
foreach (InventoryFolderBase subFolder in subFolders) foreach (InventoryFolderBase subFolder in subFolders)
{ {
// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID); // m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins) foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
{ {
plugin.Value.deleteInventoryFolder(subFolder.ID); plugin.Value.deleteInventoryFolder(subFolder.ID);
@ -288,17 +288,17 @@ namespace OpenSim.Framework.Communications
{ {
DeleteItem(item); DeleteItem(item);
} }
// FIXME: Should return false on failure // FIXME: Should return false on failure
return true; return true;
} }
private void AddNewInventorySet(UsersInventory inventory) private void AddNewInventorySet(UsersInventory inventory)
{ {
foreach (InventoryFolderBase folder in inventory.Folders.Values) foreach (InventoryFolderBase folder in inventory.Folders.Values)
{ {
AddFolder(folder); AddFolder(folder);
} }
} }
/// <summary> /// <summary>
@ -340,7 +340,7 @@ namespace OpenSim.Framework.Communications
folder.Type = (short)AssetType.Bodypart; folder.Type = (short)AssetType.Bodypart;
folder.Version = 1; folder.Version = 1;
Folders.Add(folder.ID, folder); Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase(); folder = new InventoryFolderBase();
folder.ParentID = rootFolder; folder.ParentID = rootFolder;
folder.Owner = user; folder.Owner = user;
@ -348,7 +348,7 @@ namespace OpenSim.Framework.Communications
folder.Name = "Calling Cards"; folder.Name = "Calling Cards";
folder.Type = (short)AssetType.CallingCard; folder.Type = (short)AssetType.CallingCard;
folder.Version = 1; folder.Version = 1;
Folders.Add(folder.ID, folder); Folders.Add(folder.ID, folder);
folder = new InventoryFolderBase(); folder = new InventoryFolderBase();
folder.ParentID = rootFolder; folder.ParentID = rootFolder;

View File

@ -31,9 +31,9 @@ namespace OpenSim.Framework.Communications.Limit
/// Interface for strategies that can limit requests from the client. Currently only used in the /// Interface for strategies that can limit requests from the client. Currently only used in the
/// texture modules to deal with repeated requests for certain textures. However, limiting strategies /// texture modules to deal with repeated requests for certain textures. However, limiting strategies
/// could be used with other requests. /// could be used with other requests.
/// </summary> /// </summary>
public interface IRequestLimitStrategy<TId> public interface IRequestLimitStrategy<TId>
{ {
/// <summary> /// <summary>
/// Should the request be allowed? If the id is not monitored, then the request is always allowed. /// Should the request be allowed? If the id is not monitored, then the request is always allowed.
/// Otherwise, the strategy criteria will be applied. /// Otherwise, the strategy criteria will be applied.
@ -41,21 +41,21 @@ namespace OpenSim.Framework.Communications.Limit
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
bool AllowRequest(TId id); bool AllowRequest(TId id);
/// <summary> /// <summary>
/// Has the request been refused just once? /// Has the request been refused just once?
/// </summary> /// </summary>
/// <returns>False if the request has not yet been refused, or if the request has been refused more /// <returns>False if the request has not yet been refused, or if the request has been refused more
/// than once.</returns> /// than once.</returns>
bool IsFirstRefusal(TId id); bool IsFirstRefusal(TId id);
/// <summary> /// <summary>
/// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring /// Start monitoring for future AllowRequest calls. If the id is already monitored, then monitoring
/// continues. /// continues.
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
void MonitorRequests(TId id); void MonitorRequests(TId id);
/// <summary> /// <summary>
/// Is the id being monitored? /// Is the id being monitored?
/// </summary> /// </summary>

View File

@ -26,15 +26,15 @@
*/ */
namespace OpenSim.Framework.Communications.Limit namespace OpenSim.Framework.Communications.Limit
{ {
/// <summary> /// <summary>
/// Strategy which polices no limits /// Strategy which polices no limits
/// </summary> /// </summary>
public class NullLimitStrategy<TId> : IRequestLimitStrategy<TId> public class NullLimitStrategy<TId> : IRequestLimitStrategy<TId>
{ {
public bool AllowRequest(TId id) { return true; } public bool AllowRequest(TId id) { return true; }
public bool IsFirstRefusal(TId id) { return false; } public bool IsFirstRefusal(TId id) { return false; }
public void MonitorRequests(TId id) { /* intentionally blank */ } public void MonitorRequests(TId id) { /* intentionally blank */ }
public bool IsMonitoringRequests(TId id) { return false; } public bool IsMonitoringRequests(TId id) { return false; }
} }
} }

View File

@ -31,14 +31,14 @@ namespace OpenSim.Framework.Communications.Limit
{ {
/// <summary> /// <summary>
/// Limit requests by discarding them after they've been repeated a certain number of times. /// Limit requests by discarding them after they've been repeated a certain number of times.
/// </summary> /// </summary>
public class RepeatLimitStrategy<TId> : IRequestLimitStrategy<TId> public class RepeatLimitStrategy<TId> : IRequestLimitStrategy<TId>
{ {
/// <summary> /// <summary>
/// Record each asset request that we're notified about. /// Record each asset request that we're notified about.
/// </summary> /// </summary>
private readonly Dictionary<TId, int> requestCounts = new Dictionary<TId, int>(); private readonly Dictionary<TId, int> requestCounts = new Dictionary<TId, int>();
/// <summary> /// <summary>
/// The maximum number of requests that can be made before we drop subsequent requests. /// The maximum number of requests that can be made before we drop subsequent requests.
/// </summary> /// </summary>
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Limit
{ {
get { return m_maxRequests; } get { return m_maxRequests; }
} }
/// <summary></summary> /// <summary></summary>
/// <param name="maxRequests">The maximum number of requests that may be served before all further /// <param name="maxRequests">The maximum number of requests that may be served before all further
/// requests are dropped.</param> /// requests are dropped.</param>
@ -55,52 +55,52 @@ namespace OpenSim.Framework.Communications.Limit
{ {
m_maxRequests = maxRequests; m_maxRequests = maxRequests;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool AllowRequest(TId id) public bool AllowRequest(TId id)
{ {
if (requestCounts.ContainsKey(id)) if (requestCounts.ContainsKey(id))
{ {
requestCounts[id] += 1; requestCounts[id] += 1;
if (requestCounts[id] > m_maxRequests) if (requestCounts[id] > m_maxRequests)
{ {
return false; return false;
} }
} }
return true; return true;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool IsFirstRefusal(TId id) public bool IsFirstRefusal(TId id)
{ {
if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id]) if (requestCounts.ContainsKey(id) && m_maxRequests + 1 == requestCounts[id])
{ {
return true; return true;
} }
return false; return false;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public void MonitorRequests(TId id) public void MonitorRequests(TId id)
{ {
if (!IsMonitoringRequests(id)) if (!IsMonitoringRequests(id))
{ {
requestCounts.Add(id, 1); requestCounts.Add(id, 1);
} }
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool IsMonitoringRequests(TId id) public bool IsMonitoringRequests(TId id)
{ {
return requestCounts.ContainsKey(id); return requestCounts.ContainsKey(id);

View File

@ -32,17 +32,17 @@ namespace OpenSim.Framework.Communications.Limit
{ {
/// <summary> /// <summary>
/// Limit requests by discarding repeat attempts that occur within a given time period /// Limit requests by discarding repeat attempts that occur within a given time period
/// ///
/// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests /// XXX Don't use this for limiting texture downloading, at least not until we better handle multiple requests
/// for the same texture at different resolutions. /// for the same texture at different resolutions.
/// </summary> /// </summary>
public class TimeLimitStrategy<TId> : IRequestLimitStrategy<TId> public class TimeLimitStrategy<TId> : IRequestLimitStrategy<TId>
{ {
/// <summary> /// <summary>
/// Record the time at which an asset request occurs. /// Record the time at which an asset request occurs.
/// </summary> /// </summary>
private readonly Dictionary<TId, Request> requests = new Dictionary<TId, Request>(); private readonly Dictionary<TId, Request> requests = new Dictionary<TId, Request>();
/// <summary> /// <summary>
/// The minimum time period between which requests for the same data will be serviced. /// The minimum time period between which requests for the same data will be serviced.
/// </summary> /// </summary>
@ -53,37 +53,37 @@ namespace OpenSim.Framework.Communications.Limit
} }
/// <summary></summary> /// <summary></summary>
/// <param name="repeatPeriod"></param> /// <param name="repeatPeriod"></param>
public TimeLimitStrategy(TimeSpan repeatPeriod) public TimeLimitStrategy(TimeSpan repeatPeriod)
{ {
m_repeatPeriod = repeatPeriod; m_repeatPeriod = repeatPeriod;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool AllowRequest(TId id) public bool AllowRequest(TId id)
{ {
if (IsMonitoringRequests(id)) if (IsMonitoringRequests(id))
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
TimeSpan elapsed = now - requests[id].Time; TimeSpan elapsed = now - requests[id].Time;
if (elapsed < RepeatPeriod) if (elapsed < RepeatPeriod)
{ {
requests[id].Refusals += 1; requests[id].Refusals += 1;
return false; return false;
} }
requests[id].Time = now; requests[id].Time = now;
} }
return true; return true;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool IsFirstRefusal(TId id) public bool IsFirstRefusal(TId id)
{ {
if (IsMonitoringRequests(id)) if (IsMonitoringRequests(id))
@ -92,31 +92,31 @@ namespace OpenSim.Framework.Communications.Limit
{ {
return true; return true;
} }
} }
return false; return false;
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public void MonitorRequests(TId id) public void MonitorRequests(TId id)
{ {
if (!IsMonitoringRequests(id)) if (!IsMonitoringRequests(id))
{ {
requests.Add(id, new Request(DateTime.Now)); requests.Add(id, new Request(DateTime.Now));
} }
} }
/// <summary> /// <summary>
/// <see cref="IRequestLimitStrategy"/> /// <see cref="IRequestLimitStrategy"/>
/// </summary> /// </summary>
public bool IsMonitoringRequests(TId id) public bool IsMonitoringRequests(TId id)
{ {
return requests.ContainsKey(id); return requests.ContainsKey(id);
} }
} }
/// <summary> /// <summary>
/// Private request details. /// Private request details.
/// </summary> /// </summary>
@ -126,12 +126,12 @@ namespace OpenSim.Framework.Communications.Limit
/// Time of last request /// Time of last request
/// </summary> /// </summary>
public DateTime Time; public DateTime Time;
/// <summary> /// <summary>
/// Number of refusals associated with this request /// Number of refusals associated with this request
/// </summary> /// </summary>
public int Refusals; public int Refusals;
public Request(DateTime time) public Request(DateTime time)
{ {
Time = time; Time = time;

View File

@ -239,7 +239,7 @@ namespace OpenSim.Framework.Communications
"Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.", "Could not authenticate your avatar. Please check your username and password, and check the grid if problems persist.",
"false"); "false");
} }
/// <summary> /// <summary>
/// Response to indicate that login failed because the agent's inventory was not available. /// Response to indicate that login failed because the agent's inventory was not available.
/// </summary> /// </summary>
@ -249,7 +249,7 @@ namespace OpenSim.Framework.Communications
return GenerateFailureResponse( return GenerateFailureResponse(
"key", "key",
"The avatar inventory service is not responding. Please notify your login region operator.", "The avatar inventory service is not responding. Please notify your login region operator.",
"false"); "false");
} }
public XmlRpcResponse CreateAlreadyLoggedInResponse() public XmlRpcResponse CreateAlreadyLoggedInResponse()

View File

@ -48,8 +48,8 @@ namespace OpenSim.Framework.Communications
protected string m_welcomeMessage = "Welcome to OpenSim"; protected string m_welcomeMessage = "Welcome to OpenSim";
protected UserManagerBase m_userManager = null; protected UserManagerBase m_userManager = null;
protected Mutex m_loginMutex = new Mutex(false); protected Mutex m_loginMutex = new Mutex(false);
/// <summary> /// <summary>
/// Used during login to send the skeleton of the OpenSim Library to the client. /// Used during login to send the skeleton of the OpenSim Library to the client.
/// </summary> /// </summary>
@ -61,12 +61,12 @@ namespace OpenSim.Framework.Communications
/// <param name="userManager"></param> /// <param name="userManager"></param>
/// <param name="libraryRootFolder"></param> /// <param name="libraryRootFolder"></param>
/// <param name="welcomeMess"></param> /// <param name="welcomeMess"></param>
public LoginService(UserManagerBase userManager, LibraryRootFolder libraryRootFolder, public LoginService(UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
string welcomeMess) string welcomeMess)
{ {
m_userManager = userManager; m_userManager = userManager;
m_libraryRootFolder = libraryRootFolder; m_libraryRootFolder = libraryRootFolder;
if (welcomeMess != String.Empty) if (welcomeMess != String.Empty)
{ {
m_welcomeMessage = welcomeMess; m_welcomeMessage = welcomeMess;
@ -79,15 +79,15 @@ namespace OpenSim.Framework.Communications
/// <param name="response">The existing response</param> /// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param> /// <param name="theUser">The user profile</param>
public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest); public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
/// <summary> /// <summary>
/// Get the initial login inventory skeleton (in other words, the folder structure) for the given user. /// Get the initial login inventory skeleton (in other words, the folder structure) for the given user.
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception> /// <exception cref='System.Exception'>This will be thrown if there is a problem with the inventory service</exception>
protected abstract InventoryData GetInventorySkeleton(LLUUID userID); protected abstract InventoryData GetInventorySkeleton(LLUUID userID);
/// <summary> /// <summary>
/// Called when we receive the client's initial XMLRPC login_to_simulator request message /// Called when we receive the client's initial XMLRPC login_to_simulator request message
/// </summary> /// </summary>
@ -112,7 +112,7 @@ namespace OpenSim.Framework.Communications
UserProfileData userProfile; UserProfileData userProfile;
LoginResponse logResponse = new LoginResponse(); LoginResponse logResponse = new LoginResponse();
string firstname = String.Empty; string firstname = String.Empty;
string lastname = String.Empty; string lastname = String.Empty;
@ -120,23 +120,23 @@ namespace OpenSim.Framework.Communications
{ {
firstname = (string) requestData["first"]; firstname = (string) requestData["first"];
lastname = (string) requestData["last"]; lastname = (string) requestData["last"];
m_log.InfoFormat( m_log.InfoFormat(
"[LOGIN BEGIN]: Received login request message from user {0} {1}", "[LOGIN BEGIN]: Received login request message from user {0} {1}",
firstname, lastname); firstname, lastname);
string clientVersion = "Unknown"; string clientVersion = "Unknown";
if (requestData.Contains("version")) if (requestData.Contains("version"))
{ {
clientVersion = (string)requestData["version"]; clientVersion = (string)requestData["version"];
} }
if (requestData.Contains("start")) if (requestData.Contains("start"))
{ {
startLocationRequest = (string)requestData["start"]; startLocationRequest = (string)requestData["start"];
} }
m_log.DebugFormat( m_log.DebugFormat(
"[LOGIN]: Client is {0}, start location is {1}", clientVersion, startLocationRequest); "[LOGIN]: Client is {0}, start location is {1}", clientVersion, startLocationRequest);
@ -163,9 +163,9 @@ namespace OpenSim.Framework.Communications
catch (Exception e) catch (Exception e)
{ {
m_log.InfoFormat( m_log.InfoFormat(
"[LOGIN END]: Bad web_login_key: {0} for user {1} {2}, exception {3}", "[LOGIN END]: Bad web_login_key: {0} for user {1} {2}, exception {3}",
requestData["web_login_key"], firstname, lastname, e); requestData["web_login_key"], firstname, lastname, e);
return logResponse.CreateFailedResponse(); return logResponse.CreateFailedResponse();
} }
GoodLogin = AuthenticateUser(userProfile, webloginkey); GoodLogin = AuthenticateUser(userProfile, webloginkey);
@ -176,14 +176,14 @@ namespace OpenSim.Framework.Communications
{ {
m_log.Info( m_log.Info(
"[LOGIN END]: login_to_simulator login message did not contain all the required data"); "[LOGIN END]: login_to_simulator login message did not contain all the required data");
return logResponse.CreateGridErrorResponse(); return logResponse.CreateGridErrorResponse();
} }
if (!GoodLogin) if (!GoodLogin)
{ {
m_log.InfoFormat("[LOGIN END]: User {0} {1} failed authentication", firstname, lastname); m_log.InfoFormat("[LOGIN END]: User {0} {1} failed authentication", firstname, lastname);
return logResponse.CreateLoginFailedResponse(); return logResponse.CreateLoginFailedResponse();
} }
else else
@ -199,11 +199,11 @@ namespace OpenSim.Framework.Communications
m_userManager.CommitAgent(ref userProfile); m_userManager.CommitAgent(ref userProfile);
// Reject the login // Reject the login
m_log.InfoFormat( m_log.InfoFormat(
"[LOGIN END]: Notifying user {0} {1} that they are already logged in", "[LOGIN END]: Notifying user {0} {1} that they are already logged in",
firstname, lastname); firstname, lastname);
return logResponse.CreateAlreadyLoggedInResponse(); return logResponse.CreateAlreadyLoggedInResponse();
} }
// Otherwise... // Otherwise...
@ -214,9 +214,9 @@ namespace OpenSim.Framework.Communications
{ {
LLUUID agentID = userProfile.ID; LLUUID agentID = userProfile.ID;
InventoryData inventData = null; InventoryData inventData = null;
try try
{ {
inventData = GetInventorySkeleton(agentID); inventData = GetInventorySkeleton(agentID);
} }
catch (Exception e) catch (Exception e)
@ -224,10 +224,10 @@ namespace OpenSim.Framework.Communications
m_log.ErrorFormat( m_log.ErrorFormat(
"[LOGIN END]: Error retrieving inventory skeleton of agent {0}, {1} - {2}", "[LOGIN END]: Error retrieving inventory skeleton of agent {0}, {1} - {2}",
agentID, e.GetType(), e.Message); agentID, e.GetType(), e.Message);
return logResponse.CreateLoginInventoryFailedResponse(); return logResponse.CreateLoginInventoryFailedResponse();
} }
ArrayList AgentInventoryArray = inventData.InventoryArray; ArrayList AgentInventoryArray = inventData.InventoryArray;
Hashtable InventoryRootHash = new Hashtable(); Hashtable InventoryRootHash = new Hashtable();
@ -235,7 +235,7 @@ namespace OpenSim.Framework.Communications
ArrayList InventoryRoot = new ArrayList(); ArrayList InventoryRoot = new ArrayList();
InventoryRoot.Add(InventoryRootHash); InventoryRoot.Add(InventoryRootHash);
userProfile.RootInventoryFolderID = inventData.RootFolderID; userProfile.RootInventoryFolderID = inventData.RootFolderID;
// Inventory Library Section // Inventory Library Section
Hashtable InventoryLibRootHash = new Hashtable(); Hashtable InventoryLibRootHash = new Hashtable();
InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000"; InventoryLibRootHash["folder_id"] = "00000112-000f-0000-0000-000100bba000";
@ -244,10 +244,10 @@ namespace OpenSim.Framework.Communications
logResponse.InventoryLibRoot = InventoryLibRoot; logResponse.InventoryLibRoot = InventoryLibRoot;
logResponse.InventoryLibraryOwner = GetLibraryOwner(); logResponse.InventoryLibraryOwner = GetLibraryOwner();
logResponse.InventoryRoot = InventoryRoot; logResponse.InventoryRoot = InventoryRoot;
logResponse.InventorySkeleton = AgentInventoryArray; logResponse.InventorySkeleton = AgentInventoryArray;
logResponse.InventoryLibrary = GetInventoryLibrary(); logResponse.InventoryLibrary = GetInventoryLibrary();
// Circuit Code // Circuit Code
uint circode = (uint) (Util.RandomClass.Next()); uint circode = (uint) (Util.RandomClass.Next());
@ -280,15 +280,15 @@ namespace OpenSim.Framework.Communications
//return logResponse.ToXmlRpcResponse(); //return logResponse.ToXmlRpcResponse();
} }
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
// If we reach this point, then the login has successfully logged onto the grid // If we reach this point, then the login has successfully logged onto the grid
if (StatsManager.UserStats != null) if (StatsManager.UserStats != null)
StatsManager.UserStats.AddSuccessfulLogin(); StatsManager.UserStats.AddSuccessfulLogin();
m_log.DebugFormat( m_log.DebugFormat(
"[LOGIN END]: Authentication of user {0} {1} successful. Sending response to client.", "[LOGIN END]: Authentication of user {0} {1} successful. Sending response to client.",
firstname, lastname); firstname, lastname);
return logResponse.ToXmlRpcResponse(); return logResponse.ToXmlRpcResponse();
} }
catch (Exception e) catch (Exception e)
@ -422,10 +422,10 @@ namespace OpenSim.Framework.Communications
} }
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
// If we reach this point, then the login has successfully logged onto the grid // If we reach this point, then the login has successfully logged onto the grid
if (StatsManager.UserStats != null) if (StatsManager.UserStats != null)
StatsManager.UserStats.AddSuccessfulLogin(); StatsManager.UserStats.AddSuccessfulLogin();
return logResponse.ToLLSDResponse(); return logResponse.ToLLSDResponse();
} }
@ -449,7 +449,7 @@ namespace OpenSim.Framework.Communications
// period, space, parens, and dash. // period, space, parens, and dash.
Regex wfcut = new Regex("[^a-zA-Z0-9_\\.\\$ \\(\\)\\-]"); Regex wfcut = new Regex("[^a-zA-Z0-9_\\.\\$ \\(\\)\\-]");
Hashtable returnactions = new Hashtable(); Hashtable returnactions = new Hashtable();
int statuscode = 200; int statuscode = 200;
@ -467,7 +467,7 @@ namespace OpenSim.Framework.Communications
// the client requires the HTML form field be named 'username' // the client requires the HTML form field be named 'username'
// however, the data it sends when it loads the first time is 'firstname' // however, the data it sends when it loads the first time is 'firstname'
// another one of those little nuances. // another one of those little nuances.
if (keysvals.Contains("firstname")) if (keysvals.Contains("firstname"))
firstname = wfcut.Replace((string)keysvals["firstname"], String.Empty, 99999); firstname = wfcut.Replace((string)keysvals["firstname"], String.Empty, 99999);
@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications
if (keysvals.Contains("lang")) if (keysvals.Contains("lang"))
lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999); lang = wfcut.Replace((string)keysvals["lang"], String.Empty, 99999);
if (keysvals.Contains("password")) if (keysvals.Contains("password"))
password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999); password = wfcut.Replace((string)keysvals["password"], String.Empty, 99999);
@ -541,8 +541,8 @@ namespace OpenSim.Framework.Communications
return returnactions; return returnactions;
} }
public string GetLoginForm(string firstname, string lastname, string location, string region, public string GetLoginForm(string firstname, string lastname, string location, string region,
string grid, string channel, string version, string lang, string grid, string channel, string version, string lang,
string password, string errormessages) string password, string errormessages)
{ {
// inject our values in the form at the markers // inject our values in the form at the markers
@ -559,7 +559,7 @@ namespace OpenSim.Framework.Communications
loginform = sr.ReadToEnd(); loginform = sr.ReadToEnd();
sr.Close(); sr.Close();
} }
loginform = loginform.Replace("[$firstname]", firstname); loginform = loginform.Replace("[$firstname]", firstname);
loginform = loginform.Replace("[$lastname]", lastname); loginform = loginform.Replace("[$lastname]", lastname);
loginform = loginform.Replace("[$location]", location); loginform = loginform.Replace("[$location]", location);
@ -586,7 +586,7 @@ namespace OpenSim.Framework.Communications
responseString += "<title>OpenSim Login</title>"; responseString += "<title>OpenSim Login</title>";
responseString += "<body><br />"; responseString += "<body><br />";
responseString += "<div id=\"login_box\">"; responseString += "<div id=\"login_box\">";
responseString += "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">"; responseString += "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">";
responseString += "<div id=\"message\">[$errors]</div>"; responseString += "<div id=\"message\">[$errors]</div>";
@ -670,13 +670,13 @@ namespace OpenSim.Framework.Communications
password = "$1$" + Util.Md5Hash(password); password = "$1$" + Util.Md5Hash(password);
password = password.Remove(0, 3); //remove $1$ password = password.Remove(0, 3); //remove $1$
string s = Util.Md5Hash(password + ":" + profile.PasswordSalt); string s = Util.Md5Hash(password + ":" + profile.PasswordSalt);
// Testing... // Testing...
//m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash); //m_log.Info("[LOGIN]: SubHash:" + s + " userprofile:" + profile.passwordHash);
//m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password); //m_log.Info("[LOGIN]: userprofile:" + profile.passwordHash + " SubCT:" + password);
passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase) passwordSuccess = (profile.PasswordHash.Equals(s.ToString(), StringComparison.InvariantCultureIgnoreCase)
|| profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase)); || profile.PasswordHash.Equals(password, StringComparison.InvariantCultureIgnoreCase));
return passwordSuccess; return passwordSuccess;
@ -694,7 +694,7 @@ namespace OpenSim.Framework.Communications
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="profile"></param> /// <param name="profile"></param>
/// <param name="request"></param> /// <param name="request"></param>
@ -709,7 +709,7 @@ namespace OpenSim.Framework.Communications
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="firstname"></param> /// <param name="firstname"></param>
/// <param name="lastname"></param> /// <param name="lastname"></param>
@ -720,7 +720,7 @@ namespace OpenSim.Framework.Communications
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public virtual string GetMessage() public virtual string GetMessage()
@ -741,17 +741,17 @@ namespace OpenSim.Framework.Communications
} }
return buddylistreturn; return buddylistreturn;
} }
/// <summary> /// <summary>
/// Converts the inventory library skeleton into the form required by the rpc request. /// Converts the inventory library skeleton into the form required by the rpc request.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual ArrayList GetInventoryLibrary() protected virtual ArrayList GetInventoryLibrary()
{ {
Dictionary<LLUUID, InventoryFolderImpl> rootFolders Dictionary<LLUUID, InventoryFolderImpl> rootFolders
= m_libraryRootFolder.RequestSelfAndDescendentFolders(); = m_libraryRootFolder.RequestSelfAndDescendentFolders();
ArrayList folderHashes = new ArrayList(); ArrayList folderHashes = new ArrayList();
foreach (InventoryFolderBase folder in rootFolders.Values) foreach (InventoryFolderBase folder in rootFolders.Values)
{ {
Hashtable TempHash = new Hashtable(); Hashtable TempHash = new Hashtable();
@ -762,12 +762,12 @@ namespace OpenSim.Framework.Communications
TempHash["folder_id"] = folder.ID.ToString(); TempHash["folder_id"] = folder.ID.ToString();
folderHashes.Add(TempHash); folderHashes.Add(TempHash);
} }
return folderHashes; return folderHashes;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected virtual ArrayList GetLibraryOwner() protected virtual ArrayList GetLibraryOwner()

View File

@ -28,7 +28,7 @@
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
@ -41,8 +41,8 @@ using System.Runtime.InteropServices;
[assembly : AssemblyTrademark("")] [assembly : AssemblyTrademark("")]
[assembly : AssemblyCulture("")] [assembly : AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible // Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from // to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type. // COM, set the ComVisible attribute to true on that type.
[assembly : ComVisible(false)] [assembly : ComVisible(false)]
@ -54,11 +54,11 @@ using System.Runtime.InteropServices;
// Version information for an assembly consists of the following four values: // Version information for an assembly consists of the following four values:
// //
// Major Version // Major Version
// Minor Version // Minor Version
// Build Number // Build Number
// Revision // Revision
// //
// You can specify all the values or you can default the Revision and Build Numbers // You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly : AssemblyVersion("1.0.0.0")] [assembly : AssemblyVersion("1.0.0.0")]

View File

@ -16,14 +16,14 @@ namespace OpenSim.Framework.Communications
/// <remarks> /// <remarks>
/// This class is a generic implementation of a REST (Representational State Transfer) web service. This /// This class is a generic implementation of a REST (Representational State Transfer) web service. This
/// class is designed to execute both synchronously and asynchronously. /// class is designed to execute both synchronously and asynchronously.
/// ///
/// Internally the implementation works as a two stage asynchronous web-client. /// Internally the implementation works as a two stage asynchronous web-client.
/// When the request is initiated, RestClient will query asynchronously for for a web-response, /// When the request is initiated, RestClient will query asynchronously for for a web-response,
/// sleeping until the initial response is returned by the server. Once the initial response is retrieved /// sleeping until the initial response is returned by the server. Once the initial response is retrieved
/// the second stage of asynchronous requests will be triggered, in an attempt to read of the response /// the second stage of asynchronous requests will be triggered, in an attempt to read of the response
/// object into a memorystream as a sequence of asynchronous reads. /// object into a memorystream as a sequence of asynchronous reads.
/// ///
/// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing /// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing
/// other threads to execute, while it waits for a response from the web-service. RestClient itself can be /// other threads to execute, while it waits for a response from the web-service. RestClient itself can be
/// invoked by the caller in either synchronous mode or asynchronous modes. /// invoked by the caller in either synchronous mode or asynchronous modes.
/// </remarks> /// </remarks>
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Communications
#region member variables #region member variables
/// <summary> /// <summary>
/// The base Uri of the web-service e.g. http://www.google.com /// The base Uri of the web-service e.g. http://www.google.com
/// </summary> /// </summary>
private string _url; private string _url;
@ -92,7 +92,7 @@ namespace OpenSim.Framework.Communications
/// <summary> /// <summary>
/// if an exception occours during async processing, we need to save it, so it can be /// if an exception occours during async processing, we need to save it, so it can be
/// rethrown on the primary thread; /// rethrown on the primary thread;
/// </summary> /// </summary>
private Exception _asyncException; private Exception _asyncException;
@ -341,7 +341,7 @@ namespace OpenSim.Framework.Communications
{ {
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult; AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
// Wait for operation to complete, then return result or // Wait for operation to complete, then return result or
// throw exception // throw exception
return ar.EndInvoke(); return ar.EndInvoke();
} }

View File

@ -43,12 +43,12 @@ namespace OpenSim.Framework.Communications
/// </summary> /// </summary>
public abstract class UserManagerBase : IUserService public abstract class UserManagerBase : IUserService
{ {
private static readonly ILog m_log private static readonly ILog m_log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public UserConfig _config; public UserConfig _config;
private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
/// <summary> /// <summary>
/// Adds a new user server plugin - user servers will be requested in the order they were loaded. /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
/// </summary> /// </summary>
@ -85,7 +85,7 @@ namespace OpenSim.Framework.Communications
m_log.Info("[USERSTORAGE]: Added IUserData Interface"); m_log.Info("[USERSTORAGE]: Added IUserData Interface");
} }
#region Get UserProfile #region Get UserProfile
// see IUserService // see IUserService
public UserProfileData GetUserProfile(string fname, string lname) public UserProfileData GetUserProfile(string fname, string lname)
@ -103,8 +103,8 @@ namespace OpenSim.Framework.Communications
return null; return null;
} }
// see IUserService // see IUserService
public UserProfileData GetUserProfile(LLUUID uuid) public UserProfileData GetUserProfile(LLUUID uuid)
{ {
foreach (KeyValuePair<string, IUserData> plugin in _plugins) foreach (KeyValuePair<string, IUserData> plugin in _plugins)
@ -408,7 +408,7 @@ namespace OpenSim.Framework.Communications
profile.CurrentAgent = agent; profile.CurrentAgent = agent;
} }
/// <summary> /// <summary>
/// Process a user logoff from OpenSim. /// Process a user logoff from OpenSim.
/// </summary> /// </summary>
@ -422,7 +422,7 @@ namespace OpenSim.Framework.Communications
{ {
if (StatsManager.UserStats != null) if (StatsManager.UserStats != null)
StatsManager.UserStats.AddLogout(); StatsManager.UserStats.AddLogout();
UserProfileData userProfile; UserProfileData userProfile;
UserAgentData userAgent; UserAgentData userAgent;
LLVector3 currentPos = new LLVector3(posx, posy, posz); LLVector3 currentPos = new LLVector3(posx, posy, posz);
@ -433,7 +433,7 @@ namespace OpenSim.Framework.Communications
{ {
// This line needs to be in side the above if statement or the UserServer will crash on some logouts. // This line needs to be in side the above if statement or the UserServer will crash on some logouts.
m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")"); m_log.Info("[LOGOUT]: " + userProfile.FirstName + " " + userProfile.SurName + " from " + regionhandle + "(" + posx + "," + posy + "," + posz + ")");
userAgent = userProfile.CurrentAgent; userAgent = userProfile.CurrentAgent;
if (userAgent != null) if (userAgent != null)
{ {
@ -462,7 +462,7 @@ namespace OpenSim.Framework.Communications
m_log.Warn("[LOGOUT]: Unknown User logged out"); m_log.Warn("[LOGOUT]: Unknown User logged out");
} }
} }
public void CreateAgent(UserProfileData profile, LLSD request) public void CreateAgent(UserProfileData profile, LLSD request)
{ {
UserAgentData agent = new UserAgentData(); UserAgentData agent = new UserAgentData();
@ -516,7 +516,7 @@ namespace OpenSim.Framework.Communications
#endregion #endregion
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY) public LLUUID AddUserProfile(string firstName, string lastName, string pass, uint regX, uint regY)
@ -598,7 +598,7 @@ namespace OpenSim.Framework.Communications
/// Appearance /// Appearance
/// TODO: stubs for now to get us to a compiling state gently /// TODO: stubs for now to get us to a compiling state gently
public AvatarAppearance GetUserAppearance(LLUUID user) public AvatarAppearance GetUserAppearance(LLUUID user)
{ {
foreach (KeyValuePair<string, IUserData> plugin in _plugins) foreach (KeyValuePair<string, IUserData> plugin in _plugins)
{ {
@ -643,7 +643,7 @@ namespace OpenSim.Framework.Communications
} }
} }
} }
public void RemoveAttachment(LLUUID user, LLUUID item) public void RemoveAttachment(LLUUID user, LLUUID item)
{ {
foreach (KeyValuePair<string, IUserData> plugin in _plugins) foreach (KeyValuePair<string, IUserData> plugin in _plugins)
@ -658,7 +658,7 @@ namespace OpenSim.Framework.Communications
} }
} }
} }
public List<LLUUID> GetAttachments(LLUUID user) public List<LLUUID> GetAttachments(LLUUID user)
{ {
foreach (KeyValuePair<string, IUserData> plugin in _plugins) foreach (KeyValuePair<string, IUserData> plugin in _plugins)

View File

@ -58,7 +58,7 @@ namespace OpenSim.Framework.Console
} }
/// <summary> /// <summary>
/// derive an ansi color from a string, ignoring the darker colors. /// derive an ansi color from a string, ignoring the darker colors.
/// This is used to help automatically bin component tags with colors /// This is used to help automatically bin component tags with colors
/// in various print functions. /// in various print functions.
/// </summary> /// </summary>
@ -195,7 +195,7 @@ namespace OpenSim.Framework.Console
System.Console.WriteLine(args); System.Console.WriteLine(args);
} }
} }
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
} }
@ -232,7 +232,7 @@ namespace OpenSim.Framework.Console
{ {
} }
} }
public string ReadLine() public string ReadLine()
{ {
try try
@ -245,7 +245,7 @@ namespace OpenSim.Framework.Console
return String.Empty; return String.Empty;
} }
} }
public int Read() public int Read()
{ {
return System.Console.Read(); return System.Console.Read();

View File

@ -40,32 +40,32 @@ namespace OpenSim.Framework.Console
string loggingMessage = RenderLoggingEvent(le); string loggingMessage = RenderLoggingEvent(le);
string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)"; string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)";
Regex RE = new Regex(regex, RegexOptions.Multiline); Regex RE = new Regex(regex, RegexOptions.Multiline);
MatchCollection matches = RE.Matches(loggingMessage); MatchCollection matches = RE.Matches(loggingMessage);
// Get some direct matches $1 $4 is a // Get some direct matches $1 $4 is a
if (matches.Count == 1) if (matches.Count == 1)
{ {
System.Console.Write(matches[0].Groups["Front"].Value); System.Console.Write(matches[0].Groups["Front"].Value);
System.Console.Write("["); System.Console.Write("[");
WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), matches[0].Groups["Category"].Value); WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), matches[0].Groups["Category"].Value);
System.Console.Write("]:"); System.Console.Write("]:");
if (le.Level == Level.Error) if (le.Level == Level.Error)
{ {
WriteColorText(ConsoleColor.Red, matches[0].Groups["End"].Value); WriteColorText(ConsoleColor.Red, matches[0].Groups["End"].Value);
} }
else if (le.Level == Level.Warn) else if (le.Level == Level.Warn)
{ {
WriteColorText(ConsoleColor.Yellow, matches[0].Groups["End"].Value); WriteColorText(ConsoleColor.Yellow, matches[0].Groups["End"].Value);
} }
else else
{ {
System.Console.Write(matches[0].Groups["End"].Value); System.Console.Write(matches[0].Groups["End"].Value);
} }
System.Console.WriteLine(); System.Console.WriteLine();
} }
else else
{ {
System.Console.Write(loggingMessage); System.Console.Write(loggingMessage);

View File

@ -156,7 +156,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public IScene Scene public IScene Scene
{ {
@ -181,7 +181,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public uint PacketNumber public uint PacketNumber
{ {
@ -190,7 +190,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public sbyte DiscardLevel public sbyte DiscardLevel
{ {
@ -199,7 +199,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public LLUUID RequestedAssetID public LLUUID RequestedAssetID
{ {
@ -213,7 +213,7 @@ namespace OpenSim.Framework
private List<Wearable> m_nowWearing = new List<Wearable>(); private List<Wearable> m_nowWearing = new List<Wearable>();
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public List<Wearable> NowWearing public List<Wearable> NowWearing
{ {
@ -381,7 +381,7 @@ namespace OpenSim.Framework
public delegate void ImprovedInstantMessage(IClientAPI remoteclient, public delegate void ImprovedInstantMessage(IClientAPI remoteclient,
LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp, LLUUID fromAgentID, LLUUID fromAgentSession, LLUUID toAgentID, LLUUID imSessionID, uint timestamp,
string fromAgentName, string message, byte dialog, bool fromGroup, byte offline, uint ParentEstateID, string fromAgentName, string message, byte dialog, bool fromGroup, byte offline, uint ParentEstateID,
LLVector3 Position, LLUUID RegionID, byte[] binaryBucket); // This shouldn't be cut down... LLVector3 Position, LLUUID RegionID, byte[] binaryBucket); // This shouldn't be cut down...
// especially if we're ever going to implement groups, presence, estate message dialogs... // especially if we're ever going to implement groups, presence, estate message dialogs...
public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart, public delegate void RezObject(IClientAPI remoteClient, LLUUID itemID, LLVector3 RayEnd, LLVector3 RayStart,
@ -607,7 +607,7 @@ namespace OpenSim.Framework
public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID); public delegate void RequestPayPrice(IClientAPI remoteClient, LLUUID objectID);
public delegate void ForceReleaseControls(IClientAPI remoteClient, LLUUID agentID); public delegate void ForceReleaseControls(IClientAPI remoteClient, LLUUID agentID);
//Estate Requests //Estate Requests
public delegate void DetailedEstateDataRequest(IClientAPI remoteClient, LLUUID invoice); public delegate void DetailedEstateDataRequest(IClientAPI remoteClient, LLUUID invoice);
public delegate void SetEstateFlagsRequest(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges); public delegate void SetEstateFlagsRequest(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges);
@ -764,7 +764,7 @@ namespace OpenSim.Framework
event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest; event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
event ParcelSelectObjects OnParcelSelectObjects; event ParcelSelectObjects OnParcelSelectObjects;
event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest; event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
event ParcelAbandonRequest OnParcelAbandonRequest; event ParcelAbandonRequest OnParcelAbandonRequest;
event RegionInfoRequest OnRegionInfoRequest; event RegionInfoRequest OnRegionInfoRequest;
event EstateCovenantRequest OnEstateCovenantRequest; event EstateCovenantRequest OnEstateCovenantRequest;
@ -808,7 +808,7 @@ namespace OpenSim.Framework
event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
[Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")] [Obsolete("IClientAPI.OutPacket SHOULD NOT EXIST outside of LLClientView please refactor appropriately.")]
void OutPacket(Packet newPack, ThrottleOutPacketType packType); void OutPacket(Packet newPack, ThrottleOutPacketType packType);
void SendWearables(AvatarWearable[] wearables, int serial); void SendWearables(AvatarWearable[] wearables, int serial);
@ -858,16 +858,16 @@ namespace OpenSim.Framework
void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint); void AttachObject(uint localID, LLQuaternion rotation, byte attachPoint);
void SetChildAgentThrottle(byte[] throttle); void SetChildAgentThrottle(byte[] throttle);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape, void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel,
uint flags, uint flags,
LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint parentID, byte[] particleSystem,
byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId); byte clickAction, byte[] textureanim, bool attachment, uint AttachPoint, LLUUID AssetId);
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
void SendPrimitiveToClient(ulong regionHandle, ushort timeDilation, uint localID, PrimitiveBaseShape primShape,
LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel, LLVector3 pos, LLVector3 vel, LLVector3 acc, LLQuaternion rotation, LLVector3 rvel,
uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color, uint flags, LLUUID objectID, LLUUID ownerID, string text, byte[] color,
uint parentID, byte[] particleSystem, byte clickAction); uint parentID, byte[] particleSystem, byte clickAction);
void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position,
@ -889,7 +889,7 @@ namespace OpenSim.Framework
void SendInventoryItemCreateUpdate(InventoryItemBase Item); void SendInventoryItemCreateUpdate(InventoryItemBase Item);
void SendRemoveInventoryItem(LLUUID itemID); void SendRemoveInventoryItem(LLUUID itemID);
void SendTakeControls(int controls, bool passToAgent, bool TakeControls); void SendTakeControls(int controls, bool passToAgent, bool TakeControls);
void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName); void SendTaskInventory(LLUUID taskID, short serial, byte[] fileName);
@ -950,7 +950,7 @@ namespace OpenSim.Framework
void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, LLUUID AssetFullID); void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, LLUUID AssetFullID);
void SendConfirmXfer(ulong xferID, uint PacketID); void SendConfirmXfer(ulong xferID, uint PacketID);
void SendXferRequest(ulong XferID, short AssetType, LLUUID vFileID, byte FilePath, byte[] FileName); void SendXferRequest(ulong XferID, short AssetType, LLUUID vFileID, byte FilePath, byte[] FileName);
void SendImagePart(ushort numParts, LLUUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec); void SendImagePart(ushort numParts, LLUUID ImageUUID, uint ImageSize, byte[] ImageData, byte imageCodec);
void SendShutdownConnectionNotice(); void SendShutdownConnectionNotice();
@ -973,9 +973,9 @@ namespace OpenSim.Framework
LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook); LLVector3 CameraAtOffset, LLVector3 CameraEyeOffset, bool ForceMouseLook);
void SendAdminResponse(LLUUID Token, uint AdminLevel); void SendAdminResponse(LLUUID Token, uint AdminLevel);
void SendGroupMembership(GroupData[] GroupMembership); void SendGroupMembership(GroupData[] GroupMembership);
byte[] GetThrottlesPacked(float multiplier); byte[] GetThrottlesPacked(float multiplier);

View File

@ -5,14 +5,14 @@ namespace OpenSim.Framework
#region Args Classes #region Args Classes
public class ICA2_ConnectionArgs : EventArgs public class ICA2_ConnectionArgs : EventArgs
{ {
} }
public class ICA2_DisconnectionArgs : EventArgs public class ICA2_DisconnectionArgs : EventArgs
{ {
public bool Forced; public bool Forced;
// Static Constructor // Static Constructor
// Allows us to recycle these classes later more easily from a pool. // Allows us to recycle these classes later more easily from a pool.
public static ICA2_DisconnectionArgs Create(bool forced) public static ICA2_DisconnectionArgs Create(bool forced)
{ {

View File

@ -120,7 +120,7 @@ namespace OpenSim.Framework
void updateInventoryItem(InventoryItemBase item); void updateInventoryItem(InventoryItemBase item);
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
void deleteInventoryItem(LLUUID item); void deleteInventoryItem(LLUUID item);

View File

@ -87,7 +87,7 @@ namespace OpenSim.Framework
void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey); void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey);
/// <summary> /// <summary>
/// Adds a new User profile to the database /// Adds a new User profile to the database
/// </summary> /// </summary>
/// <param name="user">UserProfile to add</param> /// <param name="user">UserProfile to add</param>
void AddNewUserProfile(UserProfileData user); void AddNewUserProfile(UserProfileData user);
@ -181,8 +181,8 @@ namespace OpenSim.Framework
AvatarAppearance GetUserAppearance(LLUUID user); AvatarAppearance GetUserAppearance(LLUUID user);
void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance); void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance);
void AddAttachment(LLUUID user, LLUUID item); void AddAttachment(LLUUID user, LLUUID item);
void RemoveAttachment(LLUUID user, LLUUID item); void RemoveAttachment(LLUUID user, LLUUID item);
List<LLUUID> GetAttachments(LLUUID user); List<LLUUID> GetAttachments(LLUUID user);

View File

@ -50,7 +50,7 @@ namespace OpenSim.Framework
private LLUUID _owner; private LLUUID _owner;
/// <summary> /// <summary>
/// The folder this folder is contained in /// The folder this folder is contained in
/// </summary> /// </summary>
private LLUUID _parentID; private LLUUID _parentID;

View File

@ -45,7 +45,7 @@ namespace OpenSim.Framework
private int _assetType; private int _assetType;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private uint _basePermissions; private uint _basePermissions;
@ -69,12 +69,12 @@ namespace OpenSim.Framework
private string _description; private string _description;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private uint _everyOnePermissions; private uint _everyOnePermissions;
/// <summary> /// <summary>
/// The folder this item is contained in /// The folder this item is contained in
/// </summary> /// </summary>
private LLUUID _folder; private LLUUID _folder;
@ -93,34 +93,34 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
private string _name; private string _name;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private LLUUID _groupID; private LLUUID _groupID;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private bool _groupOwned; private bool _groupOwned;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private int _salePrice; private int _salePrice;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private byte _saleType; private byte _saleType;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private uint _flags; private uint _flags;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public int _creationDate; public int _creationDate;

View File

@ -63,7 +63,7 @@ namespace OpenSim.Framework
#endregion #endregion
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="agent"></param> /// <param name="agent"></param>
/// <returns></returns> /// <returns></returns>
@ -171,7 +171,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <remarks>TODO: Doesnt take any args??</remarks> /// <remarks>TODO: Doesnt take any args??</remarks>
/// <returns></returns> /// <returns></returns>
@ -188,7 +188,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <remarks>Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me</remarks> /// <remarks>Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me</remarks>
/// <param name="neighbours"></param> /// <param name="neighbours"></param>

View File

@ -37,7 +37,7 @@ namespace OpenSim.Framework
[Serializable] [Serializable]
public class SimpleRegionInfo public class SimpleRegionInfo
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected bool Allow_Alternate_Ports; protected bool Allow_Alternate_Ports;
@ -114,7 +114,7 @@ namespace OpenSim.Framework
/// <value> /// <value>
/// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw.
/// ///
/// XXX Isn't this really doing too much to be a simple getter, rather than an explict method? /// XXX Isn't this really doing too much to be a simple getter, rather than an explict method?
/// </value> /// </value>
public IPEndPoint ExternalEndPoint public IPEndPoint ExternalEndPoint
@ -187,7 +187,7 @@ namespace OpenSim.Framework
public class RegionInfo : SimpleRegionInfo public class RegionInfo : SimpleRegionInfo
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public bool commFailTF = false; public bool commFailTF = false;
@ -327,7 +327,7 @@ namespace OpenSim.Framework
if (errorMessage != String.Empty) if (errorMessage != String.Empty)
{ {
// a error // a error
} }
} }

View File

@ -87,7 +87,7 @@ namespace OpenSim.Framework
/// <summary> /// <summary>
/// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message. /// Signs a new bit of data with the current hash. Returns a byte array which should be affixed to the message.
/// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the /// Signing a piece of data will automatically increment the hash - if you sign data and do not send it, the
/// hashes will get out of sync and throw an exception when validation is attempted. /// hashes will get out of sync and throw an exception when validation is attempted.
/// </summary> /// </summary>
/// <param name="data">The outgoing data</param> /// <param name="data">The outgoing data</param>

View File

@ -30,7 +30,7 @@ using System.Xml.Serialization;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
/* /*
* .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder * .Net has some issues, serializing a dictionary, so we cannot reuse the InventoryFolder
* class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize * class defined in Communications.Framework.Communications.Caches. So we serialize/deserialize
* into this simpler class, and then use that. * into this simpler class, and then use that.

View File

@ -40,8 +40,8 @@ namespace OpenSim.Framework
/// <value> /// <value>
/// The port by which http communication occurs with the region (most noticeably, CAPS communication) /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
/// ///
/// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region /// FIXME: Defaulting to 9000 temporarily (on the basis that this is the http port most region
/// servers are running) until the revision in which this change is made propogates around grids. /// servers are running) until the revision in which this change is made propogates around grids.
/// </value> /// </value>
protected uint m_httpPort = 9000; protected uint m_httpPort = 9000;

View File

@ -82,10 +82,10 @@ namespace OpenSim.Framework.Servers
string path = handler.Path; string path = handler.Path;
string handlerKey = GetHandlerKey(httpMethod, path); string handlerKey = GetHandlerKey(httpMethod, path);
if (!m_streamHandlers.ContainsKey(handlerKey)) if (!m_streamHandlers.ContainsKey(handlerKey))
{ {
//m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
m_streamHandlers.Add(handlerKey, handler); m_streamHandlers.Add(handlerKey, handler);
} }
} }
@ -135,20 +135,20 @@ namespace OpenSim.Framework.Servers
try try
{ {
HttpListenerContext context = (HttpListenerContext) stateinfo; HttpListenerContext context = (HttpListenerContext) stateinfo;
HttpListenerRequest request = context.Request; HttpListenerRequest request = context.Request;
HttpListenerResponse response = context.Response; HttpListenerResponse response = context.Response;
response.KeepAlive = false; response.KeepAlive = false;
response.SendChunked = false; response.SendChunked = false;
string path = request.RawUrl; string path = request.RawUrl;
string handlerKey = GetHandlerKey(request.HttpMethod, path); string handlerKey = GetHandlerKey(request.HttpMethod, path);
//m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
IRequestHandler requestHandler; IRequestHandler requestHandler;
if (TryGetStreamHandler(handlerKey, out requestHandler)) if (TryGetStreamHandler(handlerKey, out requestHandler))
{ {
// Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
@ -156,13 +156,13 @@ namespace OpenSim.Framework.Servers
if (requestHandler is IStreamedRequestHandler) if (requestHandler is IStreamedRequestHandler)
{ {
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
buffer = streamedRequestHandler.Handle(path, request.InputStream); buffer = streamedRequestHandler.Handle(path, request.InputStream);
} }
else else
{ {
IStreamHandler streamHandler = (IStreamHandler) requestHandler; IStreamHandler streamHandler = (IStreamHandler) requestHandler;
using (MemoryStream memoryStream = new MemoryStream()) using (MemoryStream memoryStream = new MemoryStream())
{ {
streamHandler.Handle(path, request.InputStream, memoryStream); streamHandler.Handle(path, request.InputStream, memoryStream);
@ -170,11 +170,11 @@ namespace OpenSim.Framework.Servers
buffer = memoryStream.ToArray(); buffer = memoryStream.ToArray();
} }
} }
request.InputStream.Close(); request.InputStream.Close();
response.ContentType = requestHandler.ContentType; response.ContentType = requestHandler.ContentType;
response.ContentLength64 = buffer.LongLength; response.ContentLength64 = buffer.LongLength;
try try
{ {
response.OutputStream.Write(buffer, 0, buffer.Length); response.OutputStream.Write(buffer, 0, buffer.Length);
@ -273,7 +273,7 @@ namespace OpenSim.Framework.Servers
return true; return true;
} }
} }
/// <summary> /// <summary>
/// Try all the registered xmlrpc handlers when an xmlrpc request is received. /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
/// Sends back an XMLRPC unknown request response if no handler is registered for the requested method. /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method.
@ -434,7 +434,7 @@ namespace OpenSim.Framework.Servers
{ {
// This is a test. There's a workable alternative.. as this way sucks. // This is a test. There's a workable alternative.. as this way sucks.
// We'd like to put this into a text file parhaps that's easily editable. // We'd like to put this into a text file parhaps that's easily editable.
// //
// For this test to work, I used the following secondlife.exe parameters // For this test to work, I used the following secondlife.exe parameters
// "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2 // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2
// //
@ -461,7 +461,7 @@ namespace OpenSim.Framework.Servers
string[] querystringkeys = request.QueryString.AllKeys; string[] querystringkeys = request.QueryString.AllKeys;
string[] rHeaders = request.Headers.AllKeys; string[] rHeaders = request.Headers.AllKeys;
foreach (string queryname in querystringkeys) foreach (string queryname in querystringkeys)
{ {
keysvals.Add(queryname, request.QueryString[queryname]); keysvals.Add(queryname, request.QueryString[queryname]);
@ -489,7 +489,7 @@ namespace OpenSim.Framework.Servers
{ {
Hashtable responsedata = requestprocessor(keysvals); Hashtable responsedata = requestprocessor(keysvals);
DoHTTPGruntWork(responsedata,response); DoHTTPGruntWork(responsedata,response);
//SendHTML500(response); //SendHTML500(response);
} }
else else
@ -519,7 +519,7 @@ namespace OpenSim.Framework.Servers
contentType = "text/html"; contentType = "text/html";
} }
// We're forgoing the usual error status codes here because the client // We're forgoing the usual error status codes here because the client
// ignores anything but 200 and 301 // ignores anything but 200 and 301
response.StatusCode = 200; response.StatusCode = 200;
@ -649,10 +649,10 @@ namespace OpenSim.Framework.Servers
public void RemoveStreamHandler(string httpMethod, string path) public void RemoveStreamHandler(string httpMethod, string path)
{ {
string handlerKey = GetHandlerKey(httpMethod, path); string handlerKey = GetHandlerKey(httpMethod, path);
//m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
m_streamHandlers.Remove(handlerKey); m_streamHandlers.Remove(handlerKey);
} }
@ -660,7 +660,7 @@ namespace OpenSim.Framework.Servers
{ {
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
} }
public string GetHTTP404(string host) public string GetHTTP404(string host)
{ {
string file = Path.Combine(Util.configDir(), "http_404.html"); string file = Path.Combine(Util.configDir(), "http_404.html");

View File

@ -44,16 +44,16 @@ namespace OpenSim.Framework.Servers
{ {
get { return m_httpServer; } get { return m_httpServer; }
} }
/// <summary> /// <summary>
/// Holds the non-viewer statistics collection object for this service/server /// Holds the non-viewer statistics collection object for this service/server
/// </summary> /// </summary>
protected IStatsCollector m_stats; protected IStatsCollector m_stats;
public BaseOpenSimServer() public BaseOpenSimServer()
{ {
m_startuptime = DateTime.Now; m_startuptime = DateTime.Now;
} }
/// <summary> /// <summary>
/// Should be overriden by descendents if they need to perform extra shutdown processing /// Should be overriden by descendents if they need to perform extra shutdown processing
@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers
} }
Environment.Exit(0); Environment.Exit(0);
} }
/// <summary> /// <summary>
/// Runs commands issued by the server console from the operator /// Runs commands issued by the server console from the operator
/// </summary> /// </summary>
@ -75,17 +75,17 @@ namespace OpenSim.Framework.Servers
public virtual void RunCmd(string command, string[] cmdparams) public virtual void RunCmd(string command, string[] cmdparams)
{ {
switch (command) switch (command)
{ {
case "help": case "help":
Notice("quit - equivalent to shutdown."); Notice("quit - equivalent to shutdown.");
if (m_stats != null) if (m_stats != null)
Notice("show stats - statistical information for this server"); Notice("show stats - statistical information for this server");
Notice("show uptime - show server startup and uptime."); Notice("show uptime - show server startup and uptime.");
Notice("shutdown - shutdown the server.\n"); Notice("shutdown - shutdown the server.\n");
break; break;
case "show": case "show":
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
@ -96,10 +96,10 @@ namespace OpenSim.Framework.Servers
case "quit": case "quit":
case "shutdown": case "shutdown":
Shutdown(); Shutdown();
break; break;
} }
} }
/// <summary> /// <summary>
/// Outputs to the console information about the region /// Outputs to the console information about the region
/// </summary> /// </summary>
@ -107,18 +107,18 @@ namespace OpenSim.Framework.Servers
public virtual void Show(string ShowWhat) public virtual void Show(string ShowWhat)
{ {
switch (ShowWhat) switch (ShowWhat)
{ {
case "stats": case "stats":
if (m_stats != null) if (m_stats != null)
{ {
Notice(m_stats.Report()); Notice(m_stats.Report());
} }
break; break;
case "uptime": case "uptime":
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
break; break;
} }
} }

View File

@ -38,12 +38,12 @@ namespace OpenSim.Framework.Servers
/// <summary> /// <summary>
/// Makes an asynchronous REST request with a callback to invoke with the response. /// Makes an asynchronous REST request with a callback to invoke with the response.
/// </summary> /// </summary>
public class RestObjectPosterResponse<TResponse> public class RestObjectPosterResponse<TResponse>
{ {
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public ReturnResponse<TResponse> ResponseCallback; public ReturnResponse<TResponse> ResponseCallback;
public void BeginPostObject<TRequest>(string requestUrl, TRequest obj) public void BeginPostObject<TRequest>(string requestUrl, TRequest obj)
@ -87,11 +87,11 @@ namespace OpenSim.Framework.Servers
TResponse deserial; TResponse deserial;
XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
Stream stream = resp.GetResponseStream(); Stream stream = resp.GetResponseStream();
// This is currently a bad debug stanza since it gobbles us the response... // This is currently a bad debug stanza since it gobbles us the response...
// StreamReader reader = new StreamReader(stream); // StreamReader reader = new StreamReader(stream);
// m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd()); // m_log.DebugFormat("[REST OBJECT POSTER RESPONSE]: Received {0}", reader.ReadToEnd());
deserial = (TResponse) deserializer.Deserialize(stream); deserial = (TResponse) deserializer.Deserialize(stream);
if (deserial != null && ResponseCallback != null) if (deserial != null && ResponseCallback != null)

View File

@ -34,7 +34,7 @@ namespace OpenSim.Framework.Servers
{ {
private RestMethod m_restMethod; private RestMethod m_restMethod;
public RestMethod Method public RestMethod Method
{ {
get { return m_restMethod; } get { return m_restMethod; }
} }

View File

@ -75,7 +75,7 @@ namespace OpenSim.Framework.Servers
using (WebResponse resp = request.GetResponse()) using (WebResponse resp = request.GetResponse())
{ {
XmlSerializer deserializer = new XmlSerializer(typeof (TResponse)); XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream()); deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
} }
return deserial; return deserial;
} }

View File

@ -37,35 +37,35 @@ namespace OpenSim.Framework.Statistics
{ {
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
private DateTime startTime = DateTime.Now; private DateTime startTime = DateTime.Now;
private long assetRequestsToday; private long assetRequestsToday;
private long assetRequestsNotFoundToday; private long assetRequestsNotFoundToday;
private long assetRequestsYesterday; private long assetRequestsYesterday;
private long assetRequestsNotFoundYesterday; private long assetRequestsNotFoundYesterday;
public long AssetRequestsToday { get { return assetRequestsToday; } } public long AssetRequestsToday { get { return assetRequestsToday; } }
public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } } public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } }
public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } } public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } }
public AssetStatsCollector() public AssetStatsCollector()
{ {
ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing);
ageStatsTimer.Enabled = true; ageStatsTimer.Enabled = true;
} }
private void OnAgeing(object source, ElapsedEventArgs e) private void OnAgeing(object source, ElapsedEventArgs e)
{ {
assetRequestsYesterday = assetRequestsToday; assetRequestsYesterday = assetRequestsToday;
// There is a possibility that an asset request could occur between the execution of these // There is a possibility that an asset request could occur between the execution of these
// two statements. But we're better off without the synchronization overhead. // two statements. But we're better off without the synchronization overhead.
assetRequestsToday = 0; assetRequestsToday = 0;
assetRequestsNotFoundYesterday = assetRequestsNotFoundToday; assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
assetRequestsNotFoundToday = 0; assetRequestsNotFoundToday = 0;
} }
/// <summary> /// <summary>
/// Record that an asset request failed to find an asset /// Record that an asset request failed to find an asset
/// </summary> /// </summary>
@ -73,7 +73,7 @@ namespace OpenSim.Framework.Statistics
{ {
assetRequestsNotFoundToday++; assetRequestsNotFoundToday++;
} }
/// <summary> /// <summary>
/// Record that a request was made to the asset server /// Record that a request was made to the asset server
/// </summary> /// </summary>
@ -90,10 +90,10 @@ namespace OpenSim.Framework.Statistics
{ {
double elapsedHours = (DateTime.Now - startTime).TotalHours; double elapsedHours = (DateTime.Now - startTime).TotalHours;
if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero if (elapsedHours <= 0) { elapsedHours = 1; } // prevent divide by zero
long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours); long assetRequestsTodayPerHour = (long)Math.Round(AssetRequestsToday / elapsedHours);
long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0); long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
return string.Format( return string.Format(
@"Asset requests today : {0} ({1} per hour) of which {2} were not found @"Asset requests today : {0} ({1} per hour) of which {2} were not found
Asset requests yesterday : {3} ({4} per hour) of which {5} were not found", Asset requests yesterday : {3} ({4} per hour) of which {5} were not found",

View File

@ -26,7 +26,7 @@
*/ */
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Statistics
{ {
/// <summary> /// <summary>
/// Implemented by classes which collect up non-viewer statistical information /// Implemented by classes which collect up non-viewer statistical information
/// </summary> /// </summary>
@ -36,6 +36,6 @@ namespace OpenSim.Framework.Statistics
/// Report back collected statistical information. /// Report back collected statistical information.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
string Report(); string Report();
} }
} }

View File

@ -32,20 +32,20 @@ using libsecondlife;
using OpenSim.Framework.Statistics.Interfaces; using OpenSim.Framework.Statistics.Interfaces;
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Statistics
{ {
/// <summary> /// <summary>
/// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane /// Collects sim statistics which aren't already being collected for the linden viewer's statistics pane
/// </summary> /// </summary>
public class SimExtraStatsCollector : IStatsCollector public class SimExtraStatsCollector : IStatsCollector
{ {
private long assetsInCache; private long assetsInCache;
private long texturesInCache; private long texturesInCache;
private long assetCacheMemoryUsage; private long assetCacheMemoryUsage;
private long textureCacheMemoryUsage; private long textureCacheMemoryUsage;
private long blockedMissingTextureRequests; private long blockedMissingTextureRequests;
private long inventoryServiceRetrievalFailures; private long inventoryServiceRetrievalFailures;
public long AssetsInCache { get { return assetsInCache; } } public long AssetsInCache { get { return assetsInCache; } }
public long TexturesInCache { get { return texturesInCache; } } public long TexturesInCache { get { return texturesInCache; } }
public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } } public long AssetCacheMemoryUsage { get { return assetCacheMemoryUsage; } }
@ -58,47 +58,47 @@ namespace OpenSim.Framework.Statistics
/// driver bugs on clients (though this seems less likely). /// driver bugs on clients (though this seems less likely).
/// </summary> /// </summary>
public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } } public long BlockedMissingTextureRequests { get { return blockedMissingTextureRequests; } }
/// <summary> /// <summary>
/// Number of known failures to retrieve avatar inventory from the inventory service. This does not /// Number of known failures to retrieve avatar inventory from the inventory service. This does not
/// cover situations where the inventory service accepts the request but never returns any data, since /// cover situations where the inventory service accepts the request but never returns any data, since
/// we do not yet timeout this situation. /// we do not yet timeout this situation.
/// </summary> /// </summary>
public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
/// <summary> /// <summary>
/// Retain a dictionary of all packet queues stats reporters /// Retain a dictionary of all packet queues stats reporters
/// </summary> /// </summary>
private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors
= new Dictionary<LLUUID, PacketQueueStatsCollector>(); = new Dictionary<LLUUID, PacketQueueStatsCollector>();
public void AddAsset(AssetBase asset) public void AddAsset(AssetBase asset)
{ {
assetsInCache++; assetsInCache++;
assetCacheMemoryUsage += asset.Data.Length; assetCacheMemoryUsage += asset.Data.Length;
} }
public void AddTexture(AssetBase image) public void AddTexture(AssetBase image)
{ {
if (image.Data != null) if (image.Data != null)
{ {
texturesInCache++; texturesInCache++;
// This could have been a pull stat, though there was originally a nebulous idea to measure flow rates // This could have been a pull stat, though there was originally a nebulous idea to measure flow rates
textureCacheMemoryUsage += image.Data.Length; textureCacheMemoryUsage += image.Data.Length;
} }
} }
public void AddBlockedMissingTextureRequest() public void AddBlockedMissingTextureRequest()
{ {
blockedMissingTextureRequests++; blockedMissingTextureRequests++;
} }
public void AddInventoryServiceRetrievalFailure() public void AddInventoryServiceRetrievalFailure()
{ {
inventoryServiceRetrievalFailures++; inventoryServiceRetrievalFailures++;
} }
/// <summary> /// <summary>
/// Register as a packet queue stats provider /// Register as a packet queue stats provider
/// </summary> /// </summary>
@ -111,7 +111,7 @@ namespace OpenSim.Framework.Statistics
packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider); packetQueueStatsCollectors[uuid] = new PacketQueueStatsCollector(provider);
} }
} }
/// <summary> /// <summary>
/// Deregister a packet queue stats provider /// Deregister a packet queue stats provider
/// </summary> /// </summary>
@ -129,25 +129,25 @@ namespace OpenSim.Framework.Statistics
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string Report() public string Report()
{ {
StringBuilder sb = new StringBuilder(Environment.NewLine); StringBuilder sb = new StringBuilder(Environment.NewLine);
sb.Append("ASSET STATISTICS"); sb.Append("ASSET STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append( sb.Append(
string.Format( string.Format(
@"Asset cache contains {0,6} assets using {1,10:0.000}K" + Environment.NewLine, @"Asset cache contains {0,6} assets using {1,10:0.000}K" + Environment.NewLine,
AssetsInCache, AssetCacheMemoryUsage / 1024.0)); AssetsInCache, AssetCacheMemoryUsage / 1024.0));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("TEXTURE STATISTICS"); sb.Append("TEXTURE STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append( sb.Append(
string.Format( string.Format(
@"Texture cache contains {0,6} textures using {1,10:0.000}K @"Texture cache contains {0,6} textures using {1,10:0.000}K
Blocked requests for missing textures: {2}" + Environment.NewLine, Blocked requests for missing textures: {2}" + Environment.NewLine,
TexturesInCache, TextureCacheMemoryUsage / 1024.0, TexturesInCache, TextureCacheMemoryUsage / 1024.0,
BlockedMissingTextureRequests)); BlockedMissingTextureRequests));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("INVENTORY STATISTICS"); sb.Append("INVENTORY STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
@ -155,26 +155,26 @@ Blocked requests for missing textures: {2}" + Environment.NewLine,
string.Format( string.Format(
"Initial inventory caching failures: {0}" + Environment.NewLine, "Initial inventory caching failures: {0}" + Environment.NewLine,
InventoryServiceRetrievalFailures)); InventoryServiceRetrievalFailures));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("PACKET QUEUE STATISTICS"); sb.Append("PACKET QUEUE STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("Agent UUID "); sb.Append("Agent UUID ");
sb.Append( sb.Append(
string.Format( string.Format(
" {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", " {0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
"Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset")); "Send", "In", "Out", "Resend", "Land", "Wind", "Cloud", "Task", "Texture", "Asset"));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
foreach (LLUUID key in packetQueueStatsCollectors.Keys) foreach (LLUUID key in packetQueueStatsCollectors.Keys)
{ {
sb.Append(string.Format("{0}: ", key)); sb.Append(string.Format("{0}: ", key));
sb.Append(packetQueueStatsCollectors[key].Report()); sb.Append(packetQueueStatsCollectors[key].Report());
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
} }
return sb.ToString(); return sb.ToString();
} }
} }
/// <summary> /// <summary>
@ -183,16 +183,16 @@ Blocked requests for missing textures: {2}" + Environment.NewLine,
public class PacketQueueStatsCollector : IStatsCollector public class PacketQueueStatsCollector : IStatsCollector
{ {
private IPullStatsProvider m_statsProvider; private IPullStatsProvider m_statsProvider;
public PacketQueueStatsCollector(IPullStatsProvider provider) public PacketQueueStatsCollector(IPullStatsProvider provider)
{ {
m_statsProvider = provider; m_statsProvider = provider;
} }
/// <summary> /// <summary>
/// Report back collected statistical information. /// Report back collected statistical information.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string Report() public string Report()
{ {
return m_statsProvider.GetStats(); return m_statsProvider.GetStats();

View File

@ -26,7 +26,7 @@
*/ */
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Statistics
{ {
/// <summary> /// <summary>
/// Singleton used to provide access to statistics reporters /// Singleton used to provide access to statistics reporters
/// </summary> /// </summary>
@ -34,44 +34,44 @@ namespace OpenSim.Framework.Statistics
{ {
private static AssetStatsCollector assetStats; private static AssetStatsCollector assetStats;
private static UserStatsCollector userStats; private static UserStatsCollector userStats;
private static SimExtraStatsCollector simExtraStats; private static SimExtraStatsCollector simExtraStats;
public static AssetStatsCollector AssetStats { get { return assetStats; } } public static AssetStatsCollector AssetStats { get { return assetStats; } }
public static UserStatsCollector UserStats { get { return userStats; } } public static UserStatsCollector UserStats { get { return userStats; } }
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } } public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
private StatsManager() {} private StatsManager() {}
/// <summary> /// <summary>
/// Start collecting statistics related to assets. /// Start collecting statistics related to assets.
/// Should only be called once. /// Should only be called once.
/// </summary> /// </summary>
public static AssetStatsCollector StartCollectingAssetStats() public static AssetStatsCollector StartCollectingAssetStats()
{ {
assetStats = new AssetStatsCollector(); assetStats = new AssetStatsCollector();
return assetStats; return assetStats;
} }
/// <summary> /// <summary>
/// Start collecting statistics related to users. /// Start collecting statistics related to users.
/// Should only be called once. /// Should only be called once.
/// </summary> /// </summary>
public static UserStatsCollector StartCollectingUserStats() public static UserStatsCollector StartCollectingUserStats()
{ {
userStats = new UserStatsCollector(); userStats = new UserStatsCollector();
return userStats; return userStats;
} }
/// <summary> /// <summary>
/// Start collecting extra sim statistics apart from those collected for the client. /// Start collecting extra sim statistics apart from those collected for the client.
/// Should only be called once. /// Should only be called once.
/// </summary> /// </summary>
public static SimExtraStatsCollector StartCollectingSimExtraStats() public static SimExtraStatsCollector StartCollectingSimExtraStats()
{ {
simExtraStats = new SimExtraStatsCollector(); simExtraStats = new SimExtraStatsCollector();
return simExtraStats; return simExtraStats;
} }
} }

View File

@ -35,43 +35,43 @@ namespace OpenSim.Framework.Statistics
public class UserStatsCollector : IStatsCollector public class UserStatsCollector : IStatsCollector
{ {
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
private int successfulLoginsToday; private int successfulLoginsToday;
public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } public int SuccessfulLoginsToday { get { return successfulLoginsToday; } }
private int successfulLoginsYesterday; private int successfulLoginsYesterday;
public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } }
private int successfulLogins; private int successfulLogins;
public int SuccessfulLogins { get { return successfulLogins; } } public int SuccessfulLogins { get { return successfulLogins; } }
private int logouts; private int logouts;
public int Logouts { get { return logouts; } } public int Logouts { get { return logouts; } }
public UserStatsCollector() public UserStatsCollector()
{ {
ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing); ageStatsTimer.Elapsed += new ElapsedEventHandler(OnAgeing);
ageStatsTimer.Enabled = true; ageStatsTimer.Enabled = true;
} }
private void OnAgeing(object source, ElapsedEventArgs e) private void OnAgeing(object source, ElapsedEventArgs e)
{ {
successfulLoginsYesterday = successfulLoginsToday; successfulLoginsYesterday = successfulLoginsToday;
// There is a possibility that an asset request could occur between the execution of these // There is a possibility that an asset request could occur between the execution of these
// two statements. But we're better off without the synchronization overhead. // two statements. But we're better off without the synchronization overhead.
successfulLoginsToday = 0; successfulLoginsToday = 0;
} }
/// <summary> /// <summary>
/// Record a successful login /// Record a successful login
/// </summary> /// </summary>
public void AddSuccessfulLogin() public void AddSuccessfulLogin()
{ {
successfulLogins++; successfulLogins++;
successfulLoginsToday++; successfulLoginsToday++;
} }
public void AddLogout() public void AddLogout()
{ {
logouts++; logouts++;

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework
{ {
/// <summary> /// <summary>
/// A dictionary for task inventory. /// A dictionary for task inventory.
/// ///
/// This class is not thread safe. Callers must synchronize on Dictionary methods. /// This class is not thread safe. Callers must synchronize on Dictionary methods.
/// </summary> /// </summary>
public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>, public class TaskInventoryDictionary : Dictionary<LLUUID, TaskInventoryItem>,
@ -72,10 +72,10 @@ namespace OpenSim.Framework
// //
// System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0 // System.TypeInitializationException: An exception was thrown by the type initializer for OpenSim.Framework.TaskInventoryDictionary ---> System.ArgumentOutOfRangeException: < 0
// Parameter name: length // Parameter name: length
// at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381 // at System.String.Substring (Int32 startIndex, Int32 length) [0x00088] in /build/buildd/mono-1.2.4/mcs/class/corlib/System/String.cs:381
// at System.Xml.Serialization.TypeTranslator.GetTypeData (System.Type runtimeType, System.String xmlDataType) [0x001f6] in /build/buildd/mono-1.2.4/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs:217 // at System.Xml.Serialization.TypeTranslator.GetTypeData (System.Type runtimeType, System.String xmlDataType) [0x001f6] in /build/buildd/mono-1.2.4/mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs:217
// ... // ...
// private static XmlSerializer tiiSerializer // private static XmlSerializer tiiSerializer
// = new XmlSerializer(typeof(Dictionary<LLUUID, TaskInventoryItem>.ValueCollection)); // = new XmlSerializer(typeof(Dictionary<LLUUID, TaskInventoryItem>.ValueCollection));
// see IXmlSerializable // see IXmlSerializable
@ -110,7 +110,7 @@ namespace OpenSim.Framework
m_log.DebugFormat("[TASK INVENTORY]: Skipping empty element {0}", reader.Name); m_log.DebugFormat("[TASK INVENTORY]: Skipping empty element {0}", reader.Name);
} }
// For some .net implementations, this last read is necessary so that we advance beyond the end tag // For some .net implementations, this last read is necessary so that we advance beyond the end tag
// of the element wrapping this object so that the rest of the serialization can complete normally. // of the element wrapping this object so that the rest of the serialization can complete normally.
reader.Read(); reader.Read();
@ -221,7 +221,7 @@ namespace OpenSim.Framework
public uint NextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL; public uint NextOwnerMask = FULL_MASK_PERMISSIONS_GENERAL;
public LLUUID OwnerID = LLUUID.Zero; public LLUUID OwnerID = LLUUID.Zero;
public uint OwnerMask = FULL_MASK_PERMISSIONS_GENERAL; public uint OwnerMask = FULL_MASK_PERMISSIONS_GENERAL;
public LLUUID ParentID = LLUUID.Zero; //parent folder id public LLUUID ParentID = LLUUID.Zero; //parent folder id
public LLUUID ParentPartID = LLUUID.Zero; public LLUUID ParentPartID = LLUUID.Zero;
public LLUUID PermsGranter; public LLUUID PermsGranter;
public int PermsMask; public int PermsMask;

Some files were not shown because too many files have changed in this diff Show More