From 55f7fe0ae3d979cb0988f385bfee27b8c7f75820 Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Sat, 2 Jun 2007 00:37:31 +0000
Subject: Dont want to do that again --- MySQL interface is now fully
documented. Added little bit more documentation to the MSSQL interface.
---
.../OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs | 6 +
.../OpenGrid.Framework.Data.MySQL/MySQLGridData.cs | 55 ++++++++-
.../MySQLInventoryData.cs | 87 ++++++++++++++
.../OpenGrid.Framework.Data.MySQL/MySQLLogData.cs | 55 +++++++++
.../OpenGrid.Framework.Data.MySQL/MySQLManager.cs | 125 ++++++++++++++++-----
.../OpenGrid.Framework.Data.MySQL/MySQLUserData.cs | 100 +++++++++++++++++
6 files changed, 402 insertions(+), 26 deletions(-)
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
index 36d5744..85e3129 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MSSQL/MSSQLManager.cs
@@ -35,8 +35,14 @@ using OpenGrid.Framework.Data;
namespace OpenGrid.Framework.Data.MSSQL
{
+ ///
+ /// A management class for the MS SQL Storage Engine
+ ///
class MSSqlManager
{
+ ///
+ /// The database connection object
+ ///
IDbConnection dbcon;
///
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
index e047c6d..5c2e567 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLGridData.cs
@@ -1,3 +1,29 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* 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
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
using System;
using System.Collections.Generic;
using System.Text;
@@ -5,8 +31,14 @@ using OpenGrid.Framework.Data;
namespace OpenGrid.Framework.Data.MySQL
{
+ ///
+ /// A MySQL Interface for the Grid Server
+ ///
public class MySQLGridData : IGridData
{
+ ///
+ /// MySQL Database Manager
+ ///
private MySQLManager database;
///
@@ -33,16 +65,32 @@ namespace OpenGrid.Framework.Data.MySQL
database.Close();
}
+ ///
+ /// Returns the plugin name
+ ///
+ /// Plugin name
public string getName()
{
return "MySql OpenGridData";
}
+ ///
+ /// Returns the plugin version
+ ///
+ /// Plugin version
public string getVersion()
{
return "0.1";
}
+ ///
+ /// Returns all the specified region profiles within coordates -- coordinates are inclusive
+ ///
+ /// Minimum X coordinate
+ /// Minimum Y coordinate
+ /// Maximum X coordinate
+ /// Maximum Y coordinate
+ ///
public SimProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
{
try
@@ -145,11 +193,16 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Adds a new profile to the database
+ ///
+ /// The profile to add
+ /// Successful?
public DataResponse AddProfile(SimProfileData profile)
{
lock (database)
{
- if (database.insertRow(profile))
+ if (database.insertRegion(profile))
{
return DataResponse.RESPONSE_OK;
}
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
index 50ffbb0..9177cc3 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLInventoryData.cs
@@ -1,3 +1,29 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* 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
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
using System;
using System.Collections.Generic;
using System.Text;
@@ -5,10 +31,19 @@ using libsecondlife;
namespace OpenGrid.Framework.Data.MySQL
{
+ ///
+ /// A MySQL interface for the inventory server
+ ///
class MySQLInventoryData : IInventoryData
{
+ ///
+ /// The database manager
+ ///
public MySQLManager database;
+ ///
+ /// Loads and initialises this database plugin
+ ///
public void Initialise()
{
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
@@ -22,21 +57,37 @@ namespace OpenGrid.Framework.Data.MySQL
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
}
+ ///
+ /// The name of this DB provider
+ ///
+ /// Name of DB provider
public string getName()
{
return "MySQL Inventory Data Interface";
}
+ ///
+ /// Closes this DB provider
+ ///
public void Close()
{
// Do nothing.
}
+ ///
+ /// Returns the version of this DB provider
+ ///
+ /// A string containing the DB provider
public string getVersion()
{
return "0.1";
}
+ ///
+ /// Returns a list of items in a specified folder
+ ///
+ /// The folder to search
+ /// A list containing inventory items
public List getInventoryInFolder(LLUUID folderID)
{
try
@@ -65,6 +116,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns a list of the root folders within a users inventory
+ ///
+ /// The user whos inventory is to be searched
+ /// A list of folder objects
public List getUserRootFolders(LLUUID user)
{
try
@@ -94,6 +150,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns a list of folders in a users inventory contained within the specified folder
+ ///
+ /// The folder to search
+ /// A list of inventory folders
public List getInventoryFolders(LLUUID parentID)
{
try
@@ -122,6 +183,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns a specified inventory item
+ ///
+ /// The item to return
+ /// An inventory item
public InventoryItemBase getInventoryItem(LLUUID item)
{
try
@@ -157,6 +223,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns a specified inventory folder
+ ///
+ /// The folder to return
+ /// A folder class
public InventoryFolderBase getInventoryFolder(LLUUID folder)
{
try
@@ -192,6 +263,10 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Adds a specified item to the database
+ ///
+ /// The inventory item
public void addInventoryItem(InventoryItemBase item)
{
lock (database)
@@ -200,11 +275,19 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Updates the specified inventory item
+ ///
+ /// Inventory item to update
public void updateInventoryItem(InventoryItemBase item)
{
addInventoryItem(item);
}
+ ///
+ /// Creates a new inventory folder
+ ///
+ /// Folder to create
public void addInventoryFolder(InventoryFolderBase folder)
{
lock (database)
@@ -213,6 +296,10 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Updates an inventory folder
+ ///
+ /// Folder to update
public void updateInventoryFolder(InventoryFolderBase folder)
{
addInventoryFolder(folder);
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
index c2f9653..3765ae1 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLLogData.cs
@@ -1,13 +1,48 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* 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
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenGrid.Framework.Data.MySQL
{
+ ///
+ /// An interface to the log database for MySQL
+ ///
class MySQLLogData : ILogData
{
+ ///
+ /// The database manager
+ ///
public MySQLManager database;
+ ///
+ /// Artificial constructor called when the plugin is loaded
+ ///
public void Initialise()
{
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
@@ -21,6 +56,15 @@ namespace OpenGrid.Framework.Data.MySQL
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
}
+ ///
+ /// Saves a log item to the database
+ ///
+ /// The daemon triggering the event
+ /// The target of the action (region / agent UUID, etc)
+ /// The method call where the problem occured
+ /// The arguments passed to the method
+ /// How critical is this?
+ /// The message to log
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
{
try
@@ -33,16 +77,27 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns the name of this DB provider
+ ///
+ /// A string containing the DB provider name
public string getName()
{
return "MySQL Logdata Interface";
}
+ ///
+ /// Closes the database provider
+ ///
public void Close()
{
// Do nothing.
}
+ ///
+ /// Returns the version of this DB provider
+ ///
+ /// A string containing the provider version
public string getVersion()
{
return "0.1";
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
index 9fbdffb..6ddd02c 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLManager.cs
@@ -1,3 +1,29 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* 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
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
using System;
using System.Collections.Generic;
using System.Text;
@@ -13,9 +39,18 @@ using OpenGrid.Framework.Data;
namespace OpenGrid.Framework.Data.MySQL
{
+ ///
+ /// A MySQL Database manager
+ ///
class MySQLManager
{
+ ///
+ /// The database connection object
+ ///
IDbConnection dbcon;
+ ///
+ /// Connection string for ADO.net
+ ///
string connectionString;
///
@@ -137,6 +172,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Reads a region row from a database reader
+ ///
+ /// An active database reader
+ /// A region profile
public SimProfileData readSimRow(IDataReader reader)
{
SimProfileData retval = new SimProfileData();
@@ -199,6 +239,11 @@ namespace OpenGrid.Framework.Data.MySQL
return retval;
}
+ ///
+ /// Reads an agent row from a database reader
+ ///
+ /// An active database reader
+ /// A user session agent
public UserAgentData readAgentRow(IDataReader reader)
{
UserAgentData retval = new UserAgentData();
@@ -231,6 +276,11 @@ namespace OpenGrid.Framework.Data.MySQL
return retval;
}
+ ///
+ /// Reads a user profile from an active data reader
+ ///
+ /// An active database reader
+ /// A user profile
public UserProfileData readUserRow(IDataReader reader)
{
UserProfileData retval = new UserProfileData();
@@ -344,6 +394,16 @@ namespace OpenGrid.Framework.Data.MySQL
return rows;
}
+ ///
+ /// Inserts a new row into the log database
+ ///
+ /// The daemon which triggered this event
+ /// Who were we operating on when this occured (region UUID, user UUID, etc)
+ /// The method call where the problem occured
+ /// The arguments passed to the method
+ /// How critical is this?
+ /// Extra message info
+ /// Saved successfully?
public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
{
string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
@@ -377,6 +437,11 @@ namespace OpenGrid.Framework.Data.MySQL
return returnval;
}
+ ///
+ /// Inserts a new item into the database
+ ///
+ /// The item
+ /// Success?
public bool insertItem(InventoryItemBase item)
{
string sql = "REPLACE INTO inventoryitems (inventoryID, assetID, type, parentFolderID, avatarID, inventoryName, inventoryDescription, inventoryNextPermissions, inventoryCurrentPermissions) VALUES ";
@@ -413,6 +478,11 @@ namespace OpenGrid.Framework.Data.MySQL
return returnval;
}
+ ///
+ /// Inserts a new folder into the database
+ ///
+ /// The folder
+ /// Success?
public bool insertFolder(InventoryFolderBase folder)
{
string sql = "REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName) VALUES ";
@@ -442,7 +512,12 @@ namespace OpenGrid.Framework.Data.MySQL
return returnval;
}
- public bool insertRow(SimProfileData profile)
+ ///
+ /// Inserts a new region into the database
+ ///
+ /// The region to insert
+ /// Success?
+ public bool insertRegion(SimProfileData regiondata)
{
string sql = "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql += "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
@@ -454,30 +529,30 @@ namespace OpenGrid.Framework.Data.MySQL
Dictionary parameters = new Dictionary();
- parameters["?regionHandle"] = profile.regionHandle.ToString();
- parameters["?regionName"] = profile.regionName.ToString();
- parameters["?uuid"] = profile.UUID.ToStringHyphenated();
- parameters["?regionRecvKey"] = profile.regionRecvKey.ToString();
- parameters["?regionSecret"] = profile.regionSecret.ToString();
- parameters["?regionSendKey"] = profile.regionSendKey.ToString();
- parameters["?regionDataURI"] = profile.regionDataURI.ToString();
- parameters["?serverIP"] = profile.serverIP.ToString();
- parameters["?serverPort"] = profile.serverPort.ToString();
- parameters["?serverURI"] = profile.serverURI.ToString();
- parameters["?locX"] = profile.regionLocX.ToString();
- parameters["?locY"] = profile.regionLocY.ToString();
- parameters["?locZ"] = profile.regionLocZ.ToString();
- parameters["?eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
- parameters["?westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
- parameters["?northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
- parameters["?southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
- parameters["?regionAssetURI"] = profile.regionAssetURI.ToString();
- parameters["?regionAssetRecvKey"] = profile.regionAssetRecvKey.ToString();
- parameters["?regionAssetSendKey"] = profile.regionAssetSendKey.ToString();
- parameters["?regionUserURI"] = profile.regionUserURI.ToString();
- parameters["?regionUserRecvKey"] = profile.regionUserRecvKey.ToString();
- parameters["?regionUserSendKey"] = profile.regionUserSendKey.ToString();
- parameters["?regionMapTexture"] = profile.regionMapTextureID.ToStringHyphenated();
+ parameters["?regionHandle"] = regiondata.regionHandle.ToString();
+ parameters["?regionName"] = regiondata.regionName.ToString();
+ parameters["?uuid"] = regiondata.UUID.ToStringHyphenated();
+ parameters["?regionRecvKey"] = regiondata.regionRecvKey.ToString();
+ parameters["?regionSecret"] = regiondata.regionSecret.ToString();
+ parameters["?regionSendKey"] = regiondata.regionSendKey.ToString();
+ parameters["?regionDataURI"] = regiondata.regionDataURI.ToString();
+ parameters["?serverIP"] = regiondata.serverIP.ToString();
+ parameters["?serverPort"] = regiondata.serverPort.ToString();
+ parameters["?serverURI"] = regiondata.serverURI.ToString();
+ parameters["?locX"] = regiondata.regionLocX.ToString();
+ parameters["?locY"] = regiondata.regionLocY.ToString();
+ parameters["?locZ"] = regiondata.regionLocZ.ToString();
+ parameters["?eastOverrideHandle"] = regiondata.regionEastOverrideHandle.ToString();
+ parameters["?westOverrideHandle"] = regiondata.regionWestOverrideHandle.ToString();
+ parameters["?northOverrideHandle"] = regiondata.regionNorthOverrideHandle.ToString();
+ parameters["?southOverrideHandle"] = regiondata.regionSouthOverrideHandle.ToString();
+ parameters["?regionAssetURI"] = regiondata.regionAssetURI.ToString();
+ parameters["?regionAssetRecvKey"] = regiondata.regionAssetRecvKey.ToString();
+ parameters["?regionAssetSendKey"] = regiondata.regionAssetSendKey.ToString();
+ parameters["?regionUserURI"] = regiondata.regionUserURI.ToString();
+ parameters["?regionUserRecvKey"] = regiondata.regionUserRecvKey.ToString();
+ parameters["?regionUserSendKey"] = regiondata.regionUserSendKey.ToString();
+ parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToStringHyphenated();
bool returnval = false;
diff --git a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
index 4a7276c..1bb9125 100644
--- a/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
+++ b/OpenGridServices/OpenGrid.Framework.Data.MySQL/MySQLUserData.cs
@@ -1,3 +1,29 @@
+/*
+* Copyright (c) OpenSim project, http://sim.opensecondlife.org/
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+* * Redistributions of source code must retain the above copyright
+* notice, this list of conditions and the following disclaimer.
+* * Redistributions in binary form must reproduce the above copyright
+* notice, this list of conditions and the following disclaimer in the
+* documentation and/or other materials provided with the distribution.
+* * Neither the name of the nor the
+* names of its contributors may be used to endorse or promote products
+* derived from this software without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+* DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
+* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+* 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
+* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
using System;
using System.Collections.Generic;
using System.Text;
@@ -6,12 +32,23 @@ using libsecondlife;
namespace OpenGrid.Framework.Data.MySQL
{
+ ///
+ /// A database interface class to a user profile storage system
+ ///
class MySQLUserData : IUserData
{
+ ///
+ /// Database manager for MySQL
+ ///
public MySQLManager database;
+ ///
+ /// Loads and initialises the MySQL storage plugin
+ ///
public void Initialise()
{
+ // Load from an INI file connection details
+ // TODO: move this to XML?
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
@@ -23,11 +60,22 @@ namespace OpenGrid.Framework.Data.MySQL
database = new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, settingPort);
}
+ ///
+ /// Searches the database for a specified user profile
+ ///
+ /// The account name of the user
+ /// A user profile
public UserProfileData getUserByName(string name)
{
return getUserByName(name.Split(' ')[0], name.Split(' ')[1]);
}
+ ///
+ /// Searches the database for a specified user profile by name components
+ ///
+ /// The first part of the account name
+ /// The second part of the account name
+ /// A user profile
public UserProfileData getUserByName(string user, string last)
{
try
@@ -57,6 +105,11 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Searches the database for a specified user profile by UUID
+ ///
+ /// The account ID
+ /// The users profile
public UserProfileData getUserByUUID(LLUUID uuid)
{
try
@@ -85,17 +138,33 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Returns a user session searching by name
+ ///
+ /// The account name
+ /// The users session
public UserAgentData getAgentByName(string name)
{
return getAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
}
+ ///
+ /// Returns a user session by account name
+ ///
+ /// First part of the users account name
+ /// Second part of the users account name
+ /// The users session
public UserAgentData getAgentByName(string user, string last)
{
UserProfileData profile = getUserByName(user, last);
return getAgentByUUID(profile.UUID);
}
+ ///
+ /// Returns an agent session by account UUID
+ ///
+ /// The accounts UUID
+ /// The users session
public UserAgentData getAgentByUUID(LLUUID uuid)
{
try
@@ -124,30 +193,61 @@ namespace OpenGrid.Framework.Data.MySQL
}
}
+ ///
+ /// Creates a new users profile
+ ///
+ /// The user profile to create
public void addNewUserProfile(UserProfileData user)
{
}
+ ///
+ /// Creates a new agent
+ ///
+ /// The agent to create
public void addNewUserAgent(UserAgentData agent)
{
// Do nothing.
}
+ ///
+ /// Performs a money transfer request between two accounts
+ ///
+ /// The senders account ID
+ /// The recievers account ID
+ /// The amount to transfer
+ /// Success?
public bool moneyTransferRequest(LLUUID from, LLUUID to, uint amount)
{
return false;
}
+ ///
+ /// Performs an inventory transfer request between two accounts
+ ///
+ /// TODO: Move to inventory server
+ /// The senders account ID
+ /// The recievers account ID
+ /// The item to transfer
+ /// Success?
public bool inventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
{
return false;
}
+ ///
+ /// Database provider name
+ ///
+ /// Provider name
public string getName()
{
return "MySQL Userdata Interface";
}
+ ///
+ /// Database provider version
+ ///
+ /// provider version
public string getVersion()
{
return "0.1";
--
cgit v1.1