mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
reorganizing namespaces to put all the Data stuff into it's own namespace
/ dir structure. This is coming in over a few changesets so consider trunk broken for the next 30 minutes as these get pulled together.
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class AssetDataBase : IAssetProvider
|
||||
{
|
||||
public abstract AssetBase FetchAsset(LLUUID uuid);
|
||||
public abstract void CreateAsset(AssetBase asset);
|
||||
public abstract void UpdateAsset(AssetBase asset);
|
||||
public abstract bool ExistsAsset(LLUUID uuid);
|
||||
public abstract void CommitAssets();
|
||||
|
||||
public abstract string Version { get; }
|
||||
public abstract string Name { get; }
|
||||
public abstract void Initialise();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class DataStoreBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class GridDataBase : IGridData
|
||||
{
|
||||
public abstract RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||
public abstract RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
||||
public abstract RegionProfileData GetProfileByString(string regionName);
|
||||
public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
public abstract bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||
public abstract void Initialise();
|
||||
public abstract void Close();
|
||||
public abstract string getName();
|
||||
public abstract string getVersion();
|
||||
public abstract DataResponse AddProfile(RegionProfileData profile);
|
||||
public abstract ReservationData GetReservationAtPoint(uint x, uint y);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Collections.Generic;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public enum DataResponse
|
||||
{
|
||||
RESPONSE_OK,
|
||||
RESPONSE_AUTHREQUIRED,
|
||||
RESPONSE_INVALIDCREDENTIALS,
|
||||
RESPONSE_ERROR
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A standard grid interface
|
||||
/// </summary>
|
||||
public interface IGridData
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a regionHandle
|
||||
/// </summary>
|
||||
/// <param name="regionHandle">A 64bit Region Handle</param>
|
||||
/// <returns>A simprofile</returns>
|
||||
RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a UUID
|
||||
/// </summary>
|
||||
/// <param name="UUID">A 128bit UUID</param>
|
||||
/// <returns>A sim profile</returns>
|
||||
RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a sim profile from a string match
|
||||
/// </summary>
|
||||
/// <param name="regionName">A string for a partial region name match</param>
|
||||
/// <returns>A sim profile</returns>
|
||||
RegionProfileData GetProfileByString(string regionName);
|
||||
|
||||
/// <summary>
|
||||
/// Returns all profiles within the specified range
|
||||
/// </summary>
|
||||
/// <param name="Xmin">Minimum sim coordinate (X)</param>
|
||||
/// <param name="Ymin">Minimum sim coordinate (Y)</param>
|
||||
/// <param name="Xmax">Maximum sim coordinate (X)</param>
|
||||
/// <param name="Ymin">Maximum sim coordinate (Y)</param>
|
||||
/// <returns>An array containing all the sim profiles in the specified range</returns>
|
||||
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||
|
||||
/// <summary>
|
||||
/// Authenticates a sim by use of its recv key.
|
||||
/// WARNING: Insecure
|
||||
/// </summary>
|
||||
/// <param name="UUID">The UUID sent by the sim</param>
|
||||
/// <param name="regionHandle">The regionhandle sent by the sim</param>
|
||||
/// <param name="simrecvkey">The receiving key sent by the sim</param>
|
||||
/// <returns>Whether the sim has been authenticated</returns>
|
||||
bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise();
|
||||
|
||||
/// <summary>
|
||||
/// Closes the interface
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// The plugin being loaded
|
||||
/// </summary>
|
||||
/// <returns>A string containing the plugin name</returns>
|
||||
string getName();
|
||||
|
||||
/// <summary>
|
||||
/// The plugins version
|
||||
/// </summary>
|
||||
/// <returns>A string containing the plugin version</returns>
|
||||
string getVersion();
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new profile to the database
|
||||
/// </summary>
|
||||
/// <param name="profile">The profile to add</param>
|
||||
/// <returns>RESPONSE_OK if successful, error if not.</returns>
|
||||
DataResponse AddProfile(RegionProfileData profile);
|
||||
|
||||
ReservationData GetReservationAtPoint(uint x, uint y);
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// The severity of an individual log message
|
||||
/// </summary>
|
||||
public enum LogSeverity : int
|
||||
{
|
||||
/// <summary>
|
||||
/// Critical: systems failure
|
||||
/// </summary>
|
||||
CRITICAL = 1,
|
||||
/// <summary>
|
||||
/// Major: warning prior to systems failure
|
||||
/// </summary>
|
||||
MAJOR = 2,
|
||||
/// <summary>
|
||||
/// Medium: an individual non-critical task failed
|
||||
/// </summary>
|
||||
MEDIUM = 3,
|
||||
/// <summary>
|
||||
/// Low: Informational warning
|
||||
/// </summary>
|
||||
LOW = 4,
|
||||
/// <summary>
|
||||
/// Info: Information
|
||||
/// </summary>
|
||||
INFO = 5,
|
||||
/// <summary>
|
||||
/// Verbose: Debug Information
|
||||
/// </summary>
|
||||
VERBOSE = 6
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface to a LogData storage system
|
||||
/// </summary>
|
||||
public interface ILogData
|
||||
{
|
||||
void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
||||
string logMessage);
|
||||
|
||||
/// <summary>
|
||||
/// Initialises the interface
|
||||
/// </summary>
|
||||
void Initialise();
|
||||
|
||||
/// <summary>
|
||||
/// Closes the interface
|
||||
/// </summary>
|
||||
void Close();
|
||||
|
||||
/// <summary>
|
||||
/// The plugin being loaded
|
||||
/// </summary>
|
||||
/// <returns>A string containing the plugin name</returns>
|
||||
string getName();
|
||||
|
||||
/// <summary>
|
||||
/// The plugins version
|
||||
/// </summary>
|
||||
/// <returns>A string containing the plugin version</returns>
|
||||
string getVersion();
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
/*
|
||||
Taken from public code listing at by Alex Pinsker
|
||||
http://alexpinsker.blogspot.com/2005/12/reading-ini-file-from-c_113432097333021549.html
|
||||
*/
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Parse settings from ini-like files
|
||||
/// </summary>
|
||||
public class IniFile
|
||||
{
|
||||
static IniFile()
|
||||
{
|
||||
_iniKeyValuePatternRegex = new Regex(
|
||||
@"((\s)*(?<Key>([^\=^\s^\n]+))[\s^\n]*
|
||||
# key part (surrounding whitespace stripped)
|
||||
\=
|
||||
(\s)*(?<Value>([^\n^\s]+(\n){0,1})))
|
||||
# value part (surrounding whitespace stripped)
|
||||
",
|
||||
RegexOptions.IgnorePatternWhitespace |
|
||||
RegexOptions.Compiled |
|
||||
RegexOptions.CultureInvariant);
|
||||
}
|
||||
|
||||
private static Regex _iniKeyValuePatternRegex;
|
||||
|
||||
public IniFile(string iniFileName)
|
||||
{
|
||||
_iniFileName = iniFileName;
|
||||
}
|
||||
|
||||
public string ParseFileReadValue(string key)
|
||||
{
|
||||
using (StreamReader reader =
|
||||
new StreamReader(_iniFileName))
|
||||
{
|
||||
do
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
Match match =
|
||||
_iniKeyValuePatternRegex.Match(line);
|
||||
if (match.Success)
|
||||
{
|
||||
string currentKey =
|
||||
match.Groups["Key"].Value as string;
|
||||
if (currentKey != null &&
|
||||
currentKey.Trim().CompareTo(key) == 0)
|
||||
{
|
||||
string value =
|
||||
match.Groups["Value"].Value as string;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
} while (reader.Peek() != -1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public string IniFileName
|
||||
{
|
||||
get { return _iniFileName; }
|
||||
}
|
||||
|
||||
private string _iniFileName;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class InventoryDataBase
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Data;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Data.Base;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public class OpenSimDataReader : BaseDataReader
|
||||
{
|
||||
public OpenSimDataReader(IDataReader source) : base(source)
|
||||
{
|
||||
}
|
||||
|
||||
public LLVector3 GetVector(string s)
|
||||
{
|
||||
float x = GetFloat(s + "X");
|
||||
float y = GetFloat(s + "Y");
|
||||
float z = GetFloat(s + "Z");
|
||||
|
||||
LLVector3 vector = new LLVector3(x, y, z);
|
||||
|
||||
return vector;
|
||||
}
|
||||
|
||||
public LLQuaternion GetQuaternion(string s)
|
||||
{
|
||||
float x = GetFloat(s + "X");
|
||||
float y = GetFloat(s + "Y");
|
||||
float z = GetFloat(s + "Z");
|
||||
float w = GetFloat(s + "W");
|
||||
|
||||
LLQuaternion quaternion = new LLQuaternion(x, y, z, w);
|
||||
|
||||
return quaternion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Data;
|
||||
using System.Data.Common;
|
||||
using libsecondlife;
|
||||
|
||||
using OpenSim.Framework.Data.Base;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class OpenSimDatabaseConnector : BaseDatabaseConnector
|
||||
{
|
||||
public OpenSimDatabaseConnector(string connectionString) : base(connectionString)
|
||||
{
|
||||
}
|
||||
|
||||
public override object ConvertToDbType(object value)
|
||||
{
|
||||
if (value is LLUUID)
|
||||
{
|
||||
return ((LLUUID) value).UUID.ToString();
|
||||
}
|
||||
|
||||
return base.ConvertToDbType(value);
|
||||
}
|
||||
|
||||
public override BaseDataReader CreateReader(IDataReader reader)
|
||||
{
|
||||
return new OpenSimDataReader(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Data.Common;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
|
||||
using OpenSim.Framework.Data.Base;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField>
|
||||
{
|
||||
public OpenSimObjectFieldMapper(BaseTableMapper tableMapper, string fieldName,
|
||||
ObjectGetAccessor<TObject, TField> rowMapperGetAccessor,
|
||||
ObjectSetAccessor<TObject, TField> rowMapperSetAccessor)
|
||||
: base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames)
|
||||
{
|
||||
string fieldName = FieldName;
|
||||
object value = GetParamValue(obj);
|
||||
|
||||
if (ValueType == typeof(LLVector3))
|
||||
{
|
||||
LLVector3 vector = (LLVector3)value;
|
||||
|
||||
RawAddParam(command, fieldNames, fieldName + "X", vector.X);
|
||||
RawAddParam(command, fieldNames, fieldName + "Y", vector.Y);
|
||||
RawAddParam(command, fieldNames, fieldName + "Z", vector.Z);
|
||||
}
|
||||
else if (ValueType == typeof(LLQuaternion))
|
||||
{
|
||||
LLQuaternion quaternion = (LLQuaternion)value;
|
||||
|
||||
RawAddParam(command, fieldNames, fieldName + "X", quaternion.X);
|
||||
RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y);
|
||||
RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z);
|
||||
RawAddParam(command, fieldNames, fieldName + "W", quaternion.W);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.ExpandField(obj, command, fieldNames);
|
||||
}
|
||||
}
|
||||
|
||||
protected override object GetValue(BaseDataReader reader)
|
||||
{
|
||||
object value;
|
||||
|
||||
OpenSimDataReader osreader = (OpenSimDataReader) reader;
|
||||
|
||||
if (ValueType == typeof(LLVector3))
|
||||
{
|
||||
value = osreader.GetVector(FieldName);
|
||||
}
|
||||
else if (ValueType == typeof(LLQuaternion))
|
||||
{
|
||||
value = osreader.GetQuaternion(FieldName);
|
||||
}
|
||||
else if (ValueType == typeof(LLUUID))
|
||||
{
|
||||
Guid guid = reader.GetGuid(FieldName);
|
||||
value = new LLUUID(guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
value = base.GetValue(reader);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Data;
|
||||
|
||||
using OpenSim.Framework.Data.Base;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class OpenSimTableMapper<TRowMapper, TPrimaryKey> : BaseTableMapper<TRowMapper, TPrimaryKey>
|
||||
{
|
||||
public OpenSimTableMapper(BaseDatabaseConnector database, string tableName) : base(database, tableName)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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 OpenSim.Framework;
|
||||
using OpenSim.Framework.Data.Base;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
|
||||
{
|
||||
public Guid SceneObjectPartId;
|
||||
|
||||
public PrimitiveBaseShapeRowMapper(BaseSchema schema, PrimitiveBaseShape obj) : base(schema, obj)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public class PrimitiveBaseShapeTableMapper : OpenSimTableMapper<PrimitiveBaseShapeRowMapper, Guid>
|
||||
{
|
||||
public PrimitiveBaseShapeTableMapper(BaseDatabaseConnector connection, string tableName)
|
||||
: base(connection, tableName)
|
||||
{
|
||||
BaseSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new BaseSchema<PrimitiveBaseShapeRowMapper>(this);
|
||||
m_schema = rowMapperSchema;
|
||||
|
||||
m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PCode",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<ushort>("PathBegin",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<ushort>("PathEnd",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathScaleX",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathScaleY",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathShearX",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathShearY",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<ushort>("ProfileBegin",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<ushort>("ProfileEnd",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<LLVector3>("Scale",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<sbyte>("PathTaperX",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<sbyte>("PathTaperY",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<sbyte>("PathTwist",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathRevolutions",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<sbyte>("PathTwistBegin",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("PathCurve",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte>("ProfileCurve",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<ushort>("ProfileHollow",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte[]>("TextureEntry",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; });
|
||||
|
||||
rowMapperSchema.AddMapping<byte[]>("ExtraParams",
|
||||
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; },
|
||||
delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; });
|
||||
}
|
||||
|
||||
public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader)
|
||||
{
|
||||
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||
|
||||
PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape);
|
||||
mapper.FillObject( reader );
|
||||
|
||||
return mapper;
|
||||
}
|
||||
|
||||
public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||
{
|
||||
PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
|
||||
return Update(sceneObjectPartId, mapper);
|
||||
}
|
||||
|
||||
public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||
{
|
||||
PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
|
||||
return Add(mapper);
|
||||
}
|
||||
|
||||
private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||
{
|
||||
PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape );
|
||||
mapper.SceneObjectPartId = sceneObjectPartId;
|
||||
return mapper;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
|
||||
[assembly : AssemblyTitle("OpenSim.Framework.Data")]
|
||||
[assembly : AssemblyDescription("")]
|
||||
[assembly : AssemblyConfiguration("")]
|
||||
[assembly : AssemblyCompany("")]
|
||||
[assembly : AssemblyProduct("OpenSim.Framework.Data")]
|
||||
[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2008")]
|
||||
[assembly : AssemblyTrademark("")]
|
||||
[assembly : AssemblyCulture("")]
|
||||
|
||||
// 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
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
|
||||
[assembly : ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
|
||||
[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly : AssemblyVersion("1.0.0.0")]
|
||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,257 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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;
|
||||
using libsecondlife;
|
||||
using Nwc.XmlRpc;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// A class which contains information known to the grid server about a region
|
||||
/// </summary>
|
||||
public class RegionProfileData
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the region
|
||||
/// </summary>
|
||||
public string regionName = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// A 64-bit number combining map position into a (mostly) unique ID
|
||||
/// </summary>
|
||||
public ulong regionHandle;
|
||||
|
||||
/// <summary>
|
||||
/// OGS/OpenSim Specific ID for a region
|
||||
/// </summary>
|
||||
public LLUUID UUID;
|
||||
|
||||
/// <summary>
|
||||
/// Coordinates of the region
|
||||
/// </summary>
|
||||
public uint regionLocX;
|
||||
public uint regionLocY;
|
||||
public uint regionLocZ; // Reserved (round-robin, layers, etc)
|
||||
|
||||
/// <summary>
|
||||
/// Authentication secrets
|
||||
/// </summary>
|
||||
/// <remarks>Not very secure, needs improvement.</remarks>
|
||||
public string regionSendKey = String.Empty;
|
||||
public string regionRecvKey = String.Empty;
|
||||
public string regionSecret = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the region is online
|
||||
/// </summary>
|
||||
public bool regionOnline;
|
||||
|
||||
/// <summary>
|
||||
/// Information about the server that the region is currently hosted on
|
||||
/// </summary>
|
||||
public string serverIP = String.Empty;
|
||||
public uint serverPort;
|
||||
public string serverURI = String.Empty;
|
||||
|
||||
public uint httpPort;
|
||||
public uint remotingPort;
|
||||
public string httpServerURI = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Set of optional overrides. Can be used to create non-eulicidean spaces.
|
||||
/// </summary>
|
||||
public ulong regionNorthOverrideHandle;
|
||||
public ulong regionSouthOverrideHandle;
|
||||
public ulong regionEastOverrideHandle;
|
||||
public ulong regionWestOverrideHandle;
|
||||
|
||||
/// <summary>
|
||||
/// Optional: URI Location of the region database
|
||||
/// </summary>
|
||||
/// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
|
||||
public string regionDataURI = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Region Asset Details
|
||||
/// </summary>
|
||||
public string regionAssetURI = String.Empty;
|
||||
|
||||
public string regionAssetSendKey = String.Empty;
|
||||
public string regionAssetRecvKey = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Region Userserver Details
|
||||
/// </summary>
|
||||
public string regionUserURI = String.Empty;
|
||||
|
||||
public string regionUserSendKey = String.Empty;
|
||||
public string regionUserRecvKey = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// Region Map Texture Asset
|
||||
/// </summary>
|
||||
public LLUUID regionMapTextureID = new LLUUID("00000000-0000-1111-9999-000000000006");
|
||||
|
||||
/// <summary>
|
||||
/// this particular mod to the file provides support within the spec for RegionProfileData for the
|
||||
/// owner_uuid for the region
|
||||
/// </summary>
|
||||
public LLUUID owner_uuid = LLUUID.Zero;
|
||||
|
||||
/// <summary>
|
||||
/// OGS/OpenSim Specific original ID for a region after move/split
|
||||
/// </summary>
|
||||
public LLUUID originUUID;
|
||||
|
||||
/// <summary>
|
||||
/// Get Sim profile data from grid server when in grid mode
|
||||
/// </summary>
|
||||
/// <param name="region_uuid"></param>
|
||||
/// <param name="gridserver_url"></param>
|
||||
/// <param name="?"></param>
|
||||
/// <returns></returns>
|
||||
public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
|
||||
string gridserver_sendkey, string gridserver_recvkey)
|
||||
{
|
||||
Hashtable requestData = new Hashtable();
|
||||
requestData["region_uuid"] = region_uuid.UUID.ToString();
|
||||
requestData["authkey"] = gridserver_sendkey;
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(requestData);
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
||||
|
||||
Hashtable responseData = (Hashtable) GridResp.Value;
|
||||
|
||||
if (responseData.ContainsKey("error"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionProfileData simData = new RegionProfileData();
|
||||
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
||||
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
||||
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
|
||||
simData.serverIP = (string) responseData["sim_ip"];
|
||||
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
||||
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
||||
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
||||
simData.serverURI = (string)responseData["server_uri"];
|
||||
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
||||
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
||||
simData.regionName = (string) responseData["region_name"];
|
||||
|
||||
return simData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request sim profile information from a grid server
|
||||
/// </summary>
|
||||
/// <param name="region_handle"></param>
|
||||
/// <param name="gridserver_url"></param>
|
||||
/// <param name="gridserver_sendkey"></param>
|
||||
/// <param name="gridserver_recvkey"></param>
|
||||
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||
public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
|
||||
string gridserver_sendkey, string gridserver_recvkey)
|
||||
{
|
||||
Hashtable requestData = new Hashtable();
|
||||
requestData["region_handle"] = region_handle.ToString();
|
||||
requestData["authkey"] = gridserver_sendkey;
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(requestData);
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
||||
|
||||
Hashtable responseData = (Hashtable) GridResp.Value;
|
||||
|
||||
if (responseData.ContainsKey("error"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionProfileData simData = new RegionProfileData();
|
||||
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
||||
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
||||
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
|
||||
simData.serverIP = (string) responseData["sim_ip"];
|
||||
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
||||
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
||||
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
||||
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
||||
simData.serverURI = (string)responseData["server_uri"];
|
||||
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
||||
simData.regionName = (string) responseData["region_name"];
|
||||
|
||||
return simData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Request sim profile information from a grid server
|
||||
/// </summary>
|
||||
/// <param name="region_handle"></param>
|
||||
/// <param name="gridserver_url"></param>
|
||||
/// <param name="gridserver_sendkey"></param>
|
||||
/// <param name="gridserver_recvkey"></param>
|
||||
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||
public static RegionProfileData RequestSimProfileData(string regionName, string gridserver_url,
|
||||
string gridserver_sendkey, string gridserver_recvkey)
|
||||
{
|
||||
Hashtable requestData = new Hashtable();
|
||||
requestData["region_name_search"] = regionName;
|
||||
requestData["authkey"] = gridserver_sendkey;
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(requestData);
|
||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
||||
|
||||
Hashtable responseData = (Hashtable)GridResp.Value;
|
||||
|
||||
if (responseData.ContainsKey("error"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionProfileData simData = new RegionProfileData();
|
||||
simData.regionLocX = Convert.ToUInt32((string)responseData["region_locx"]);
|
||||
simData.regionLocY = Convert.ToUInt32((string)responseData["region_locy"]);
|
||||
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
|
||||
simData.serverIP = (string)responseData["sim_ip"];
|
||||
simData.serverPort = Convert.ToUInt32((string)responseData["sim_port"]);
|
||||
simData.httpPort = Convert.ToUInt32((string)responseData["http_port"]);
|
||||
simData.remotingPort = Convert.ToUInt32((string)responseData["remoting_port"]);
|
||||
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
||||
simData.serverURI = (string)responseData["server_uri"];
|
||||
simData.UUID = new LLUUID((string)responseData["region_UUID"]);
|
||||
simData.regionName = (string)responseData["region_name"];
|
||||
|
||||
return simData;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* 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 OpenSim Project 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 THE CONTRIBUTORS 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 libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public class ReservationData
|
||||
{
|
||||
public LLUUID userUUID = LLUUID.Zero;
|
||||
public int reservationMinX = 0;
|
||||
public int reservationMinY = 0;
|
||||
public int reservationMaxX = 65536;
|
||||
public int reservationMaxY = 65536;
|
||||
|
||||
public string reservationName = System.String.Empty;
|
||||
public string reservationCompany = System.String.Empty;
|
||||
public bool status = true;
|
||||
|
||||
public string gridSendKey = System.String.Empty;
|
||||
public string gridRecvKey = System.String.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using libsecondlife;
|
||||
|
||||
namespace OpenSim.Framework.Data
|
||||
{
|
||||
public abstract class UserDataBase : IUserData
|
||||
{
|
||||
public abstract UserProfileData GetUserByUUID(LLUUID user);
|
||||
public abstract UserProfileData GetUserByName(string fname, string lname);
|
||||
public abstract UserAgentData GetAgentByUUID(LLUUID user);
|
||||
public abstract UserAgentData GetAgentByName(string name);
|
||||
public abstract UserAgentData GetAgentByName(string fname, string lname);
|
||||
public abstract void StoreWebLoginKey(LLUUID agentID, LLUUID webLoginKey);
|
||||
public abstract void AddNewUserProfile(UserProfileData user);
|
||||
public abstract bool UpdateUserProfile(UserProfileData user);
|
||||
public abstract void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid);
|
||||
public abstract void AddNewUserAgent(UserAgentData agent);
|
||||
public abstract void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms);
|
||||
public abstract void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend);
|
||||
public abstract void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms);
|
||||
public abstract List<FriendListItem> GetUserFriendList(LLUUID friendlistowner);
|
||||
public abstract bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount);
|
||||
public abstract bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID inventory);
|
||||
public abstract string GetVersion();
|
||||
public abstract string getName();
|
||||
public abstract void Initialise();
|
||||
public abstract List<OpenSim.Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user