Merge branch 'master' into careminster-presence-refactor

The modules will need to be updated for this to compile and run again. Please
don't use until I do the companion commit to modules later on.
avinationmerge
Melanie 2010-09-13 16:16:40 +01:00
commit 6a1ce17cdb
216 changed files with 6585 additions and 4483 deletions
OpenSim
ApplicationPlugins/RemoteController
Region
DataSnapshot
OptionalModules
ScriptEngine
Shared/Api/Implementation
XEngine
Server/Handlers/Hypergrid

View File

@ -756,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set the estate
// Check for an existing estate
List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]);
List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
if (estateIDs.Count < 1)
{
UUID userID = UUID.Zero;
@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
}
// Create a new estate with the name provided
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true);
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true);
region.EstateSettings.EstateName = (string) requestData["estate_name"];
region.EstateSettings.EstateOwner = userID;
@ -795,9 +795,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{
int estateID = estateIDs[0];
region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID);
region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID))
if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
throw new Exception("Failed to join estate.");
}

View File

@ -1,4 +1,31 @@
using System;
/*
* 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 OpenSimulator 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.Text;
using OpenMetaverse;
@ -17,7 +44,7 @@ namespace OpenSim.Data
/// <returns></returns>
public static UUID FromDB(object id)
{
if( (id == null) || (id == DBNull.Value))
if ((id == null) || (id == DBNull.Value))
return UUID.Zero;
if (id.GetType() == typeof(Guid))

View File

@ -40,15 +40,4 @@ namespace OpenSim.Data
void Initialise(string connect);
bool Delete(string id);
}
public class AssetDataInitialiser : PluginInitialiserBase
{
private string connect;
public AssetDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IAssetDataPlugin p = plugin as IAssetDataPlugin;
p.Initialise (connect);
}
}
}

View File

@ -155,15 +155,4 @@ namespace OpenSim.Data
/// </returns>
List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
}
public class InventoryDataInitialiser : PluginInitialiserBase
{
private string connect;
public InventoryDataInitialiser (string s) { connect = s; }
public override void Initialise (IPlugin plugin)
{
IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
p.Initialise (connect);
}
}
}

View File

@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
#region Public methods
public MSSQLEstateStore()
{
}
public MSSQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
/// <summary>
/// Initialises the estatedata class.
/// </summary>

View File

@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
/// <summary>
/// A MSSQL Interface for the Region Server.
/// </summary>
public class MSSQLRegionDataStore : IRegionDataStore
public class MSSQLSimulationData : ISimulationDataStore
{
private const string _migrationStore = "RegionStore";
@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
/// </summary>
private MSSQLManager _Database;
private string m_connectionString;
public MSSQLSimulationData()
{
}
public MSSQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
/// <summary>
/// Initialises the region datastore
/// </summary>

View File

@ -122,7 +122,7 @@ namespace OpenSim.Data
int ver = FindVersion(_conn, "migrations");
if (ver <= 0) // -1 = no table, 0 = no version record
{
if( ver < 0 )
if (ver < 0)
ExecuteScript("create table migrations(name varchar(100), version int)");
InsertVersion("migrations", 1);
}
@ -288,7 +288,7 @@ namespace OpenSim.Data
SortedList<int, string[]> migrations = new SortedList<int, string[]>();
string[] names = _assem.GetManifestResourceNames();
if( names.Length == 0 ) // should never happen
if (names.Length == 0) // should never happen
return migrations;
Array.Sort(names); // we want all the migrations ordered
@ -297,7 +297,7 @@ namespace OpenSim.Data
Match m = null;
string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase
if( (m != null) && !String.IsNullOrEmpty(sFile) )
if ((m != null) && !String.IsNullOrEmpty(sFile))
{
/* The filename should be '<StoreName>.migrations[.NNN]' where NNN
* is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip
@ -312,7 +312,7 @@ namespace OpenSim.Data
if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound))
{
if( nLastVerFound <= after )
if (nLastVerFound <= after)
goto scan_old_style;
}
@ -329,7 +329,7 @@ namespace OpenSim.Data
sb.Length = 0;
}
if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
{
migrations[nVersion] = script.ToArray();
}
@ -345,7 +345,7 @@ namespace OpenSim.Data
string sLine = resourceReader.ReadLine();
nLineNo++;
if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line
if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line
continue;
if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
@ -392,7 +392,7 @@ scan_old_style:
if (m.Success)
{
int version = int.Parse(m.Groups[1].ToString());
if ( (version > after) && !migrations.ContainsKey(version) )
if ((version > after) && !migrations.ContainsKey(version))
{
using (Stream resource = _assem.GetManifestResourceStream(s))
{

View File

@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
private void UpdateAccessTime(AssetBase asset)
{
// Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
return;
lock (m_dbLock)
{
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))

View File

@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public MySQLEstateStore()
{
}
public MySQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
InventoryItemBase item = new InventoryItemBase();
// TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
// ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero )
// (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
item.CreatorId = reader["creatorID"].ToString();
// Be a bit safer in parsing these because the

View File

@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL
/// <summary>
/// A MySQL Interface for the Region Server
/// </summary>
public class MySQLDataStore : IRegionDataStore
public class MySQLSimulationData : ISimulationDataStore
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString;
private object m_dbLock = new object();
public MySQLSimulationData()
{
}
public MySQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;
@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL
"UserLocationX, UserLocationY, UserLocationZ, " +
"UserLookAtX, UserLookAtY, UserLookAtZ, " +
"AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
"?UUID, ?RegionUUID, " +
"?LocalLandID, ?Bitmap, ?Name, ?Description, " +
"?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL
"?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
"?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
"?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
"CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL
string command = "select * from `regionwindlight` where region_id = ?regionID";
using(MySqlCommand cmd = new MySqlCommand(command))
using (MySqlCommand cmd = new MySqlCommand(command))
{
cmd.Connection = dbcon;
@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
}
newData.MediaDescription = (string) row["MediaDescription"];
newData.MediaType = (string) row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.MediaDescription = (string) row["MediaDescription"];
newData.MediaType = (string) row["MediaType"];
newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();

View File

@ -1,4 +1,31 @@
using System;
/*
* 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 OpenSimulator 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 OpenMetaverse;

View File

@ -36,7 +36,7 @@ namespace OpenSim.Data.Null
/// <summary>
/// NULL DataStore, do not store anything
/// </summary>
public class NullDataStore : IRegionDataStore
public class NullSimulationData : ISimulationDataStore
{
public void Initialise(string dbfile)
{
@ -73,7 +73,6 @@ namespace OpenSim.Data.Null
{
}
// see IRegionDatastore
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{
}

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
/// <summary>
/// A RegionData Interface to the SQLite database
/// </summary>
public class SQLiteRegionData : IRegionDataStore
public class SQLiteSimulationData : ISimulationDataStore
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental
/***********************************************************************
@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite
**********************************************************************/
/// <summary>
/// See IRegionDataStore
/// <list type="bullet">
/// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -536,15 +544,15 @@ namespace OpenSim.Data.SQLite
/// <param name="prim">the prim</param>
private void LoadItems(SceneObjectPart prim)
{
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
DataTable dbItems = ds.Tables["primitems"];
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
DataRow[] dbItemRows = dbItems.Select(sql);
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
// m_log.DebugFormat(
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
// m_log.DebugFormat(
// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
foreach (DataRow row in dbItemRows)
{
@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite
{
landaccesslist.Rows.Remove(rowsToDelete[iter]);
}
}
Commit();
}
@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthbuyerID"] = land.AuthBuyerID.ToString();
row["OtherCleanTime"] = land.OtherCleanTime;
row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
row["MediaLoop"] = land.MediaLoop.ToString();
row["ObscureMusic"] = land.ObscureMusic.ToString();
row["ObscureMedia"] = land.ObscureMedia.ToString();
row["MediaType"] = land.MediaType;
row["MediaDescription"] = land.MediaDescription;
row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
row["MediaLoop"] = land.MediaLoop.ToString();
row["ObscureMusic"] = land.ObscureMusic.ToString();
row["ObscureMedia"] = land.ObscureMedia.ToString();
}
/// <summary>
@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite
}
/// <summary>
/// see IRegionDatastore
/// </summary>
/// <param name="primID"></param>
/// <param name="items"></param>
@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite
delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
da.DeleteCommand = delete;
da.DeleteCommand.Connection = conn;
}
private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)

View File

@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
private Dictionary<string, FieldInfo> m_FieldMap =
new Dictionary<string, FieldInfo>();
public SQLiteEstateStore()
{
}
public SQLiteEstateStore(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString)
{
m_connectionString = connectionString;

View File

@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy
/// <summary>
/// A RegionData Interface to the SQLite database
/// </summary>
public class SQLiteRegionData : IRegionDataStore
public class SQLiteSimulationData : ISimulationDataStore
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental
/***********************************************************************
@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy
**********************************************************************/
/// <summary>
/// See IRegionDataStore
/// <list type="bullet">
/// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy
}
/// <summary>
/// see IRegionDatastore
/// </summary>
/// <param name="primID"></param>
/// <param name="items"></param>

View File

@ -1,4 +1,31 @@
using System;
/*
* 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 OpenSimulator 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.IO;
using System.Collections.Generic;
using log4net.Config;
@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests
{
if (m_service != null)
{
if( m_service is IDisposable)
if (m_service is IDisposable)
((IDisposable)m_service).Dispose();
m_service = null;
}
if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) )
if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file))
File.Delete(m_file);
}

View File

@ -1,4 +1,31 @@
using System;
/*
* 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 OpenSimulator 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.Linq;
using System.Text;

View File

@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
#else
[TestFixture(Description = "Region store tests (SQLite)")]
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData>
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
{
}
[TestFixture(Description = "Region store tests (MySQL)")]
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore>
public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData>
{
}
[TestFixture(Description = "Region store tests (MS SQL Server)")]
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore>
public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData>
{
}
@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests
public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
where TConn : DbConnection, new()
where TRegStore : class, IRegionDataStore, new()
where TRegStore : class, ISimulationDataStore, new()
{
bool m_rebuildDB;
public IRegionDataStore db;
public ISimulationDataStore db;
public UUID zero = UUID.Zero;
public UUID region1 = UUID.Random();
public UUID region2 = UUID.Random();
@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service)
{
ClearDB();
db = (IRegionDataStore)service;
db = (ISimulationDataStore)service;
db.Initialise(m_connStr);
}

View File

@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
new BakedTextureUploader( capsBase + uploaderPath,
new BakedTextureUploader(capsBase + uploaderPath,
m_httpListener);
uploader.OnUpLoad += BakedTextureUploaded;

View File

@ -124,22 +124,6 @@ namespace OpenSim.Framework
set { m_standaloneUserSource = value; }
}
protected string m_storageConnectionString;
public string StorageConnectionString
{
get { return m_storageConnectionString; }
set { m_storageConnectionString = value; }
}
protected string m_estateConnectionString;
public string EstateConnectionString
{
get { return m_estateConnectionString; }
set { m_estateConnectionString = value; }
}
protected string m_librariesXMLFile;
public string LibrariesXMLFile
{

View File

@ -90,6 +90,57 @@ namespace OpenSim.Framework.Console
return ret;
}
public string CmdPrompt(string p, List<char> excludedCharacters)
{
bool itisdone = false;
string ret = String.Empty;
while (!itisdone)
{
itisdone = true;
ret = CmdPrompt(p);
foreach (char c in excludedCharacters)
{
if (ret.Contains(c.ToString()))
{
System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
itisdone = false;
}
}
}
return ret;
}
public string CmdPrompt(string p, string def, List<char> excludedCharacters)
{
bool itisdone = false;
string ret = String.Empty;
while (!itisdone)
{
itisdone = true;
ret = CmdPrompt(p, def);
if (ret == String.Empty)
{
ret = def;
}
else
{
foreach (char c in excludedCharacters)
{
if (ret.Contains(c.ToString()))
{
System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
itisdone = false;
}
}
}
}
return ret;
}
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
public string CmdPrompt(string prompt, string defaultresponse, List<string> options)
{

View File

@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
SetCursorLeft(0);
y = SetCursorTop(y);
System.Console.WriteLine("{0}{1}", prompt, cmdline);
System.Console.WriteLine();
//Show();
lock (cmdline)
{
@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
}
}
AddToHistory(cmdline.ToString());
//AddToHistory(cmdline.ToString());
return cmdline.ToString();
default:
break;

View File

@ -1,4 +1,31 @@
using System;
/*
* 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 OpenSimulator 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.Threading;
using System.Collections.Generic;
using System.Text;

View File

@ -89,13 +89,13 @@ namespace OpenSim.Framework
private Vector3 _userLocation = new Vector3();
private Vector3 _userLookAt = new Vector3();
private int _otherCleanTime = 0;
private string _mediaType = "none/none";
private string _mediaDescription = "";
private int _mediaHeight = 0;
private int _mediaWidth = 0;
private bool _mediaLoop = false;
private bool _obscureMusic = false;
private bool _obscureMedia = false;
private string _mediaType = "none/none";
private string _mediaDescription = "";
private int _mediaHeight = 0;
private int _mediaWidth = 0;
private bool _mediaLoop = false;
private bool _obscureMusic = false;
private bool _obscureMedia = false;
/// <summary>
/// Whether to obscure parcel media URL
@ -690,13 +690,13 @@ namespace OpenSim.Framework
landData._userLocation = _userLocation;
landData._userLookAt = _userLookAt;
landData._otherCleanTime = _otherCleanTime;
landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth;
landData._mediaHeight = _mediaHeight;
landData._mediaLoop = _mediaLoop;
landData._obscureMusic = _obscureMusic;
landData._obscureMedia = _obscureMedia;
landData._mediaType = _mediaType;
landData._mediaDescription = _mediaDescription;
landData._mediaWidth = _mediaWidth;
landData._mediaHeight = _mediaHeight;
landData._mediaLoop = _mediaLoop;
landData._obscureMusic = _obscureMusic;
landData._obscureMedia = _obscureMedia;
landData._parcelAccessList.Clear();
foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)

View File

@ -49,12 +49,12 @@ namespace OpenSim.Framework
public UUID SnapshotID;
public Vector3 UserLocation;
public Vector3 UserLookAt;
public string MediaType;
public string MediaDescription;
public int MediaHeight;
public int MediaWidth;
public bool MediaLoop;
public bool ObscureMusic;
public bool ObscureMedia;
public string MediaType;
public string MediaDescription;
public int MediaHeight;
public int MediaWidth;
public bool MediaLoop;
public bool ObscureMusic;
public bool ObscureMedia;
}
}

View File

@ -1,4 +1,4 @@
//
//
// Lazy.cs
//
// Authors:

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture:
return "image/x-j2c";
case AssetType.Sound:
return "application/ogg";
return "audio/ogg";
case AssetType.CallingCard:
return "application/vnd.ll.callingcard";
case AssetType.Landmark:
@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder";
case AssetType.InboxFolder:
return "application/vnd.ll.inboxfolder";
case AssetType.Unknown:
default:
return "application/octet-stream";
@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object:
return "application/vnd.ll.primitive";
case InventoryType.Sound:
return "application/ogg";
return "audio/ogg";
case InventoryType.Snapshot:
case InventoryType.Texture:
return "image/x-j2c";
@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2":
return (sbyte)AssetType.Texture;
case "application/ogg":
case "audio/ogg":
return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard":
@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder;
case "application/vnd.ll.inboxfolder":
return (sbyte)AssetType.InboxFolder;
case "application/octet-stream":
default:
return (sbyte)AssetType.Unknown;
@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg":
return (sbyte)InventoryType.Texture;
case "application/ogg":
case "audio/ogg":
case "audio/x-wav":
return (sbyte)InventoryType.Sound;
case "application/vnd.ll.callingcard":

View File

@ -1691,7 +1691,6 @@ namespace OpenSim.Framework.Servers.HttpServer
{
m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
}
}
public void RemoveStreamHandler(string httpMethod, string path)
@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
RemoveHTTPHandler(httpMethod, path);
}
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
}
}
public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{
try

View File

@ -49,7 +49,7 @@ namespace OpenSim
public static string GetVersionString(string versionNumber, Flavour flavour)
{
string versionString = "OpenSim " + versionNumber + " (" + flavour + ")";
string versionString = "OpenSim " + versionNumber + " " + flavour;
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
}

View File

@ -348,15 +348,15 @@ namespace OpenSim.Framework
/// <param name="partID">The new part ID to which this item belongs</param>
public void ResetIDs(UUID partID)
{
_oldID = _itemID;
_itemID = UUID.Random();
_parentPartID = partID;
_parentID = partID;
OldItemID = ItemID;
ItemID = UUID.Random();
ParentPartID = partID;
ParentID = partID;
}
public TaskInventoryItem()
{
_creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
}
}
}

View File

@ -345,10 +345,6 @@ namespace OpenSim
m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
m_configSettings.StorageConnectionString
= startupConfig.GetString("storage_connection_string");
m_configSettings.EstateConnectionString
= startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
m_configSettings.ClientstackDll
= startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
}

View File

@ -316,7 +316,7 @@ namespace OpenSim
m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>",
"Create a new region.",
"The settings for \"region name\" are read from <region_file.ini>."
"The settings for \"region name\" are read from <region_file.ini> in your Regions directory."
+ " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
+ "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
+ "If <region_file.ini> does not exist, it will be created.",
@ -552,19 +552,20 @@ namespace OpenSim
regionFile = Path.Combine(regionsDir, regionFile);
}
RegionInfo regInfo;
RegionInfo regInfo;
if (isXml)
{
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
}
else
{
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
}
IScene scene;
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene);
regInfo.EstateSettings.Save();
}
/// <summary>

View File

@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
using OpenSim.Server.Base;
namespace OpenSim
{
@ -195,6 +196,24 @@ namespace OpenSim
m_permsModules = new List<string>(permissionModules.Split(','));
}
// Load the simulation data service
IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
if (simDataConfig == null)
throw new Exception("Configuration file is missing the [SimulationDataStore] section");
string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section");
m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
// Load the estate data service
IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
if (estateDataConfig == null)
throw new Exception("Configuration file is missing the [EstateDataStore] section");
module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
if (String.IsNullOrEmpty(module))
throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
base.StartupSpecific();
m_stats = StatsManager.StartCollectingSimExtraStats();
@ -612,7 +631,7 @@ namespace OpenSim
regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager);
Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
if (m_autoCreateClientStack)
{
@ -628,30 +647,19 @@ namespace OpenSim
return scene;
}
protected override StorageManager CreateStorageManager()
{
return
CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
}
protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
{
return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring);
}
protected override ClientStackManager CreateClientStackManager()
{
return new ClientStackManager(m_configSettings.ClientstackDll);
}
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager)
protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
IEstateDataService estateDataService, AgentCircuitManager circuitManager)
{
SceneCommunicationService sceneGridService = new SceneCommunicationService();
return new Scene(
regionInfo, circuitManager, sceneGridService,
storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim,
simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim,
m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
}
@ -868,9 +876,11 @@ namespace OpenSim
/// </param>
public void PopulateRegionEstateInfo(RegionInfo regInfo)
{
if (m_storageManager.EstateDataStore != null)
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false);
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
}
if (regInfo.EstateSettings.EstateID == 0) // No record at all
@ -878,11 +888,11 @@ namespace OpenSim
MainConsole.Instance.Output("Your region is not part of an estate.");
while (true)
{
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"});
string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" });
if (response == "no")
{
// Create a new estate
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
//regInfo.EstateSettings.Save();
@ -894,7 +904,7 @@ namespace OpenSim
if (response == "None")
continue;
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response);
List<int> estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1)
{
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
@ -903,9 +913,9 @@ namespace OpenSim
int estateID = estateIDs[0];
regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID);
regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID))
if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
break;
MainConsole.Instance.Output("Joining the estate failed. Please try again.");

View File

@ -289,7 +289,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event GodlikeMessage onGodlikeMessage;
public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
#endregion Events
#region Class Members
@ -3560,9 +3559,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessEntityUpdates(int maxUpdates)
{
Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0;
@ -4229,7 +4228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
{
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
updateMessage.AABBMax = landData.AABBMax;
updateMessage.AABBMin = landData.AABBMin;
@ -4303,13 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
updateMessage.UserLocation = landData.UserLocation;
updateMessage.UserLookAt = landData.UserLookAt;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
updateMessage.MediaType = landData.MediaType;
updateMessage.MediaDesc = landData.MediaDescription;
updateMessage.MediaWidth = landData.MediaWidth;
updateMessage.MediaHeight = landData.MediaHeight;
updateMessage.MediaLoop = landData.MediaLoop;
updateMessage.ObscureMusic = landData.ObscureMusic;
updateMessage.ObscureMedia = landData.ObscureMedia;
try
{
@ -4318,8 +4317,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{
eq.ParcelProperties(updateMessage, this.AgentId);
} else {
m_log.Warn("No EQ Interface when sending parcel data.");
}
m_log.Warn("No EQ Interface when sending parcel data.");
}
}
catch (Exception ex)
{
@ -11245,8 +11244,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outputPacket = false;
if (m_debugPacketLevel <= 200
&&
(packet.Type == PacketType.ImagePacket
&& (packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData
|| packet.Type == PacketType.CoarseLocationUpdate))
@ -11944,7 +11942,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
dialog.Data.Message = Util.StringToBytes256(message);
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
buttons[0] = new ScriptDialogPacket.ButtonsBlock();
buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");

View File

@ -36,6 +36,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager;
@ -48,29 +49,17 @@ namespace OpenSim.Region.ClientStack
protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
protected NetworkServersInfo m_networkServersInfo;
public NetworkServersInfo NetServersInfo
{
get { return m_networkServersInfo; }
}
protected uint m_httpServerPort;
protected StorageManager m_storageManager;
public StorageManager StorageManager
{
get { return m_storageManager; }
}
protected ISimulationDataService m_simulationDataService;
protected IEstateDataService m_estateDataService;
protected ClientStackManager m_clientStackManager;
public SceneManager SceneManager
{
get { return m_sceneManager; }
}
protected SceneManager m_sceneManager = new SceneManager();
public SceneManager SceneManager { get { return m_sceneManager; } }
public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
public IEstateDataService EstateDataService { get { return m_estateDataService; } }
protected abstract void Initialize();
/// <summary>
@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack
/// <returns></returns>
protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
protected abstract StorageManager CreateStorageManager();
protected abstract ClientStackManager CreateClientStackManager();
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager);
protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
protected override void StartupSpecific()
{
m_storageManager = CreateStorageManager();
m_clientStackManager = CreateClientStackManager();
Initialize();

View File

@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
UUID itemID = UUID.Zero;
if (sp != null)
{
foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
{
itemID = grp.GetFromItemID();
if (itemID != UUID.Zero)
@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID
List<EntityBase> detachEntities = m_scene.GetEntities();
EntityBase[] detachEntities = m_scene.GetEntities();
SceneObjectGroup group;
foreach (EntityBase entity in detachEntities)

View File

@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
try
{
deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
if(killingAvatar != null)
if (killingAvatar != null)
killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
}
catch (InvalidOperationException)

View File

@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public UUID PrincipalID;
public FriendInfo[] Friends;
public int Refcount;
public UUID RegionID;
public bool IsFriend(string friend)
{
@ -68,6 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
}
private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>();
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected Dictionary<UUID, UserFriendData> m_Friends =
new Dictionary<UUID, UserFriendData>();
protected List<UUID> m_NeedsListOfFriends = new List<UUID>();
protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
protected IPresenceService PresenceService
{
@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)mPort);
server.AddStreamHandler(new FriendsRequestHandler(this));
}
if (m_FriendsService == null)
@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnClientLogin += OnClientLogin;
}
@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public uint GetFriendPerms(UUID principalID, UUID friendID)
{
if (!m_Friends.ContainsKey(principalID))
return 0;
UserFriendData data = m_Friends[principalID];
string searchFor = friendID.ToString();
foreach (FriendInfo fi in data.Friends)
FriendInfo[] friends = GetFriends(principalID);
foreach (FriendInfo fi in friends)
{
if (fi.Friend == searchFor)
if (fi.Friend == friendID.ToString())
return (uint)fi.TheirFlags;
}
return 0;
}
@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += OnTerminateFriendship;
client.OnGrantUserRights += OnGrantUserRights;
lock (m_Friends)
{
if (m_Friends.ContainsKey(client.AgentId))
// Asynchronously fetch the friends list or increment the refcount for the existing
// friends list
Util.FireAndForget(
delegate(object o)
{
m_Friends[client.AgentId].Refcount++;
return;
lock (m_Friends)
{
UserFriendData friendsData;
if (m_Friends.TryGetValue(client.AgentId, out friendsData))
{
friendsData.Refcount++;
}
else
{
friendsData = new UserFriendData();
friendsData.PrincipalID = client.AgentId;
friendsData.Friends = FriendsService.GetFriends(client.AgentId);
friendsData.Refcount = 1;
m_Friends[client.AgentId] = friendsData;
}
}
}
UserFriendData newFriends = new UserFriendData();
newFriends.PrincipalID = client.AgentId;
newFriends.Friends = m_FriendsService.GetFriends(client.AgentId);
newFriends.Refcount = 1;
newFriends.RegionID = UUID.Zero;
m_Friends.Add(client.AgentId, newFriends);
}
);
}
private void OnClientClosed(UUID agentID, Scene scene)
{
ScenePresence sp = scene.GetScenePresence(agentID);
if (sp != null && !sp.IsChildAgent)
{
// do this for root agents closing out
StatusChange(agentID, false);
}
lock (m_Friends)
if (m_Friends.ContainsKey(agentID))
{
UserFriendData friendsData;
if (m_Friends.TryGetValue(agentID, out friendsData))
{
if (m_Friends[agentID].Refcount == 1)
friendsData.Refcount--;
if (friendsData.Refcount <= 0)
m_Friends.Remove(agentID);
else
m_Friends[agentID].Refcount--;
}
}
}
private void OnMakeRootAgent(ScenePresence sp)
{
UUID agentID = sp.ControllingClient.AgentId;
if (m_Friends.ContainsKey(agentID))
{
// This is probably an overkill, but just
// to make sure we have the latest and greatest
// friends list -- always pull OnMakeRoot
m_Friends[agentID].Friends =
m_FriendsService.GetFriends(agentID);
m_Friends[agentID].RegionID =
sp.ControllingClient.Scene.RegionInfo.RegionID;
}
}
private void OnMakeChildAgent(ScenePresence sp)
{
UUID agentID = sp.ControllingClient.AgentId;
if (m_Friends.ContainsKey(agentID))
{
if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
m_Friends[agentID].RegionID = UUID.Zero;
}
UpdateFriendsCache(agentID);
}
private void OnClientLogin(IClientAPI client)
@ -296,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Register that we need to send the list of online friends to this user
lock (m_NeedsListOfFriends)
if (!m_NeedsListOfFriends.Contains(agentID))
{
m_NeedsListOfFriends.Add(agentID);
}
m_NeedsListOfFriends.Add(agentID);
}
public void SendFriendsOnlineIfNeeded(IClientAPI client)
{
UUID agentID = client.AgentId;
if (m_NeedsListOfFriends.Contains(agentID))
// Check if the online friends list is needed
lock (m_NeedsListOfFriends)
{
if (!m_Friends.ContainsKey(agentID))
{
m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
if (!m_NeedsListOfFriends.Remove(agentID))
return;
}
}
//
// Send the friends online
//
List<UUID> online = GetOnlineFriends(agentID);
if (online.Count > 0)
{
m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
client.SendAgentOnline(online.ToArray());
}
// Send the friends online
List<UUID> online = GetOnlineFriends(agentID);
if (online.Count > 0)
{
m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
client.SendAgentOnline(online.ToArray());
}
//
// Send outstanding friendship offers
//
if (m_Friends.ContainsKey(agentID))
{
List<string> outstanding = new List<string>();
// Send outstanding friendship offers
List<string> outstanding = new List<string>();
FriendInfo[] friends = GetFriends(agentID);
foreach (FriendInfo fi in friends)
{
if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend);
}
foreach (FriendInfo fi in m_Friends[agentID].Friends)
if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend);
GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
"Will you be my friend?", true, Vector3.Zero);
GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero);
foreach (string fid in outstanding)
{
try
{
im.fromAgentID = new Guid(fid);
}
catch
{
continue;
}
foreach (string fid in outstanding)
{
UUID fromAgentID;
if (!UUID.TryParse(fid, out fromAgentID))
continue;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID));
im.fromAgentName = account.FirstName + " " + account.LastName;
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
PresenceInfo presence = null;
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid });
if (presences != null && presences.Length > 0)
presence = presences[0];
if (presence != null)
im.offline = 0;
im.fromAgentID = fromAgentID.Guid;
im.fromAgentName = account.FirstName + " " + account.LastName;
im.offline = (byte)((presence == null) ? 1 : 0);
im.imSessionID = im.fromAgentID;
im.imSessionID = im.fromAgentID;
// Finally
LocalFriendshipOffered(agentID, im);
}
}
lock (m_NeedsListOfFriends)
m_NeedsListOfFriends.Remove(agentID);
// Finally
LocalFriendshipOffered(agentID, im);
}
}
@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
List<string> friendList = new List<string>();
List<UUID> online = new List<UUID>();
foreach (FriendInfo fi in m_Friends[userID].Friends)
FriendInfo[] friends = GetFriends(userID);
foreach (FriendInfo fi in friends)
{
if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi.Friend);
}
if (friendList.Count == 0)
// no friends whatsoever
return online;
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
online.Add(new UUID(pi.UserID));
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID);
if (friendList.Count > 0)
{
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence)
{
UUID presenceID;
if (UUID.TryParse(pi.UserID, out presenceID))
online.Add(presenceID);
}
}
return online;
}
//
// Find the client for a ID
//
/// <summary>
/// Find the client for a ID
/// </summary>
public IClientAPI LocateClientObject(UUID agentID)
{
Scene scene = GetClientScene(agentID);
if (scene == null)
return null;
if (scene != null)
{
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence != null)
return presence.ControllingClient;
}
ScenePresence presence = scene.GetScenePresence(agentID);
if (presence == null)
return null;
return presence.ControllingClient;
return null;
}
//
// Find the scene for an agent
//
/// <summary>
/// Find the scene for an agent
/// </summary>
private Scene GetClientScene(UUID agentId)
{
lock (m_Scenes)
@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (Scene scene in m_Scenes)
{
ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null)
{
if (!presence.IsChildAgent)
return scene;
}
if (presence != null && !presence.IsChildAgent)
return scene;
}
}
return null;
}
@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// <param name="online"></param>
private void StatusChange(UUID agentID, bool online)
{
//m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online);
if (m_Friends.ContainsKey(agentID))
FriendInfo[] friends = GetFriends(agentID);
if (friends.Length > 0)
{
//m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
List<FriendInfo> friendList = new List<FriendInfo>();
foreach (FriendInfo fi in m_Friends[agentID].Friends)
foreach (FriendInfo fi in friends)
{
if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi);
}
Util.FireAndForget(delegate
{
foreach (FriendInfo fi in friendList)
Util.FireAndForget(
delegate
{
//m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
// Notify about this user status
StatusNotify(fi, agentID, online);
foreach (FriendInfo fi in friendList)
{
//m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
// Notify about this user status
StatusNotify(fi, agentID, online);
}
}
});
);
}
else
m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
}
private void StatusNotify(FriendInfo friend, UUID userID, bool online)
{
UUID friendID = UUID.Zero;
UUID friendID;
if (UUID.TryParse(friend.Friend, out friendID))
{
// Try local
@ -471,34 +430,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
{
PresenceInfo friendSession = null;
foreach (PresenceInfo pinfo in friendSessions)
if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad
{
friendSession = pinfo;
break;
}
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
}
// Friend is not online. Ignore.
}
else
{
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
}
}
private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
{
if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered)
if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
{
// we got a friendship offer
UUID principalID = new UUID(im.fromAgentID);
@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return;
// The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
}
// If the prospective friend is not online, he'll get the message upon login.
}
@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
// update the local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
// Update the local cache
UpdateFriendsCache(agentID);
//
// Notify the friend
@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// The friend is not here
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
client.SendAgentOnline(new UUID[] { friendID });
}
}
@ -592,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipDenied(agentID, client.Name, friendID))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
if (region != null)
m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
else
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
}
}
@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.Delete(exfriendID, agentID.ToString());
// Update local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
UpdateFriendsCache(agentID);
client.SendTerminateFriend(exfriendID);
@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
}
}
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
{
if (!m_Friends.ContainsKey(remoteClient.AgentId))
FriendInfo[] friends = GetFriends(remoteClient.AgentId);
if (friends.Length == 0)
return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
// Let's find the friend in this user's friend list
UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null;
foreach (FriendInfo fi in fd.Friends)
foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString())
friend = fi;
}
if (friend != null) // Found it
{
@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights))
return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() });
if (friendSessions != null && friendSessions.Length > 0)
PresenceInfo friendSession = PresenceService.GetAgent(target);
if (friendSession != null)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null)
{
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
// TODO: You might want to send the delta to save the lookup
// on the other end!!
m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
}
}
}
@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
// update the local cache
m_Friends[friendID].Friends = FriendsService.GetFriends(friendID);
// Update the local cache
UpdateFriendsCache(friendID);
// we're done
return true;
}
@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendClient != null)
{
// the prospective friend in this sim as root agent
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im);
@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID);
// update local cache
m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID);
UpdateFriendsCache(exfriendID);
// we're done
return true;
}
@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
}
// update local cache
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID);
foreach (FriendInfo finfo in m_Friends[friendID].Friends)
if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights;
// Update local cache
lock (m_Friends)
{
FriendInfo[] friends = GetFriends(friendID);
foreach (FriendInfo finfo in friends)
{
if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights;
}
}
return true;
}
@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false;
}
#endregion
private FriendInfo[] GetFriends(UUID agentID)
{
UserFriendData friendsData;
lock (m_Friends)
{
if (m_Friends.TryGetValue(agentID, out friendsData))
return friendsData.Friends;
}
return EMPTY_FRIENDS;
}
private void UpdateFriendsCache(UUID agentID)
{
lock (m_Friends)
{
UserFriendData friendsData;
if (m_Friends.TryGetValue(agentID, out friendsData))
friendsData.Friends = FriendsService.GetFriends(agentID);
}
}
}
}

View File

@ -138,8 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (scene.Entities.ContainsKey(toAgentID) &&
scene.Entities[toAgentID] is ScenePresence)
{
// m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName);
// Local message
// m_log.DebugFormat(
// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
if (!user.IsChildAgent)
{
@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent)
{
// Non-cached user agent lookup.
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() });
if (presences != null && presences.Length > 0)
upd = presences[0];
upd = PresenceService.GetAgent(toAgentID);
if (upd != null)
{

View File

@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
"[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
inventoryFolder.Name,
inventoryFolder.ID,
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath );
m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
//recurse through all dirs getting dirs and files
SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);

View File

@ -326,9 +326,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
try
{
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
Dictionary<string, object> options = new Dictionary<string, object>();
Dictionary<string, object> options = new Dictionary<string, object>();
OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
List<string> mainParams = optionSet.Parse(cmdparams);

View File

@ -387,8 +387,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
string userFirstName = "Jock";
string userLastName = "Stirrup";
UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
// Create asset
SceneObjectGroup object1;
@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
Scene scene = SceneSetupHelpers.SetupScene("inventory");
SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);

View File

@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
{
if (!queues.ContainsKey(agentId))
{
/*
/*
m_log.DebugFormat(
"[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
agentId, m_scene.RegionInfo.RegionName);
@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
{
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
Enqueue(item, avatarID);
}

View File

@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
return placesReply;
}
public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
{
OSDMap message = new OSDMap();
message.Add("message", OSD.FromString("ParcelProperties"));
OSD message_body = parcelPropertiesMessage.Serialize();
message.Add("body", message_body);
return message;
}
public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
{
OSDMap message = new OSDMap();
message.Add("message", OSD.FromString("ParcelProperties"));
OSD message_body = parcelPropertiesMessage.Serialize();
message.Add("body", message_body);
return message;
}
}
}

View File

@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
new UserAgentServerConnector(m_Config, MainServer.Instance);
new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
}
scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
}

View File

@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors;
using OpenSim.Services.Connectors.SimianGrid;
using OpenMetaverse;
namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
}
else
{
// We're instantiating this class explicitly, but this won't
// work in general, because the remote grid may be running
// an inventory server that has a different protocol.
// Eventually we will want a piece of protocol asking
// the remote server about its kind. Definitely cool thing to do!
connector = new RemoteXInventoryServicesConnector(url);
// Still not as flexible as I would like this to be,
// but good enough for now
string connectorType = new HeloServicesConnector(url).Helo();
m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
if (connectorType == "opensim-simian")
connector = new SimianInventoryServiceConnector(url);
else
connector = new RemoteXInventoryServicesConnector(url);
m_connectors.Add(url, connector);
}
}

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{
public class UserAccountCache
{
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account)
{
// Cache even null accounts
m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d));
m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
if (account != null)
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d));
m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
// m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
}

View File

@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
List<EntityBase> entities = m_scene.GetEntities();
EntityBase[] entities = m_scene.GetEntities();
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
/*

View File

@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{
@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SceneObjectPart part2 = CreateSceneObjectPart2();
AssetNotecard nc = new AssetNotecard("Hello World!");
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset
@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
public void TestLoadOarV0_2()
{
TestHelper.InMethod();
//log4net.Config.XmlConfigurator.Configure();
// log4net.Config.XmlConfigurator.Configure();
MemoryStream archiveWriteStream = new MemoryStream();
TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);

View File

@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
{
if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{
avatar.ControllingClient.SendAlertMessage(
"You are not allowed on this parcel because the land owner has restricted access.");
}
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
{
lock (m_landList)
{
foreach (LandObject p in m_landList.Values)
@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate()
{
ResetAllLandPrimCounts();
foreach (EntityBase obj in m_scene.Entities)
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
{
if (obj != null)
{
@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel);
}
}
}
}
@ -1382,31 +1378,31 @@ namespace OpenSim.Region.CoreModules.World.Land
{
return RemoteParcelRequest(request, path, param, agentID, caps);
}));
UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
}));
UUID parcelCapID = UUID.Random();
caps.RegisterHandler("ParcelPropertiesUpdate",
new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
delegate(string request, string path, string param,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return ProcessPropertiesUpdate(request, path, param, agentID, caps);
}));
}
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{
IClientAPI client;
if ( ! m_scene.TryGetClient(agentID, out client) ) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() );
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
{
IClientAPI client;
if (! m_scene.TryGetClient(agentID, out client)) {
m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
properties.Deserialize(args);
properties.Deserialize(args);
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
LandUpdateArgs land_update = new LandUpdateArgs();
int parcelID = properties.LocalID;
land_update.AuthBuyerID = properties.AuthBuyerID;
land_update.Category = properties.Category;
land_update.Desc = properties.Desc;
land_update.GroupID = properties.GroupID;
@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land
land_update.SnapshotID = properties.SnapshotID;
land_update.UserLocation = properties.UserLocation;
land_update.UserLookAt = properties.UserLookAt;
land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
land_update.MediaDescription = properties.MediaDesc;
land_update.MediaType = properties.MediaType;
land_update.MediaWidth = properties.MediaWidth;
land_update.MediaHeight = properties.MediaHeight;
land_update.MediaLoop = properties.MediaLoop;
land_update.ObscureMusic = properties.ObscureMusic;
land_update.ObscureMedia = properties.ObscureMedia;
ILandObject land;
ILandObject land;
lock (m_landList)
{
m_landList.TryGetValue(parcelID, out land);
@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (land != null)
{
land.UpdateLandProperties(land_update, client);
land.UpdateLandProperties(land_update, client);
m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
}
}
else
{
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
}
m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
}
return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
}
}
// we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
// "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
// So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x

View File

@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.SnapshotID = args.SnapshotID;
newData.UserLocation = args.UserLocation;
newData.UserLookAt = args.UserLookAt;
newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
newData.MediaType = args.MediaType;
newData.MediaDescription = args.MediaDescription;
newData.MediaWidth = args.MediaWidth;
newData.MediaHeight = args.MediaHeight;
newData.MediaLoop = args.MediaLoop;
newData.ObscureMusic = args.ObscureMusic;
newData.ObscureMedia = args.ObscureMedia;
m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);

View File

@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
{
string xmlstream = "<scene>";
List<EntityBase> EntityList = scene.GetEntities();
EntityBase[] EntityList = scene.GetEntities();
List<string> EntityXml = new List<string>();
foreach (EntityBase ent in EntityList)

View File

@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
return SceneXmlLoader.SaveGroupToXml2(grp);
}
public void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
{
SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
}
public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max)
public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
{
SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
}

View File

@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
{
if (m_ready)
{
if(m_scene.GetRootAgentCount() > 0)
if (m_scene.GetRootAgentCount() > 0)
{
// Ask wind plugin to generate a LL wind array to be cached locally
// Try not to update this too often, as it may involve array copies

View File

@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
double[,] hm = whichScene.Heightmap.GetDoubles();
tc = Environment.TickCount;
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
List<EntityBase> objs = whichScene.GetEntities();
EntityBase[] objs = whichScene.GetEntities();
Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
//SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
List<float> z_sortheights = new List<float>();

View File

@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
lock (m_rootAgents)
{
m_rootAgents.Remove(AgentId);
if(m_rootAgents.Count == 0)
if (m_rootAgents.Count == 0)
StopThread();
}
}

View File

@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
XmlNode node;
foreach (EntityBase entity in m_scene.Entities)
EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase entity in entities)
{
// only objects, not avatars
if (entity is SceneObjectGroup)

View File

@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// Backup the inventory to the given data store
/// </summary>
/// <param name="datastore"></param>
void ProcessInventoryBackup(IRegionDataStore datastore);
void ProcessInventoryBackup(ISimulationDataService datastore);
uint MaskEffectivePermissions();

View File

@ -0,0 +1,45 @@
/*
* 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 OpenSimulator 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 OpenSim.Framework;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IEstateDataService
{
EstateSettings LoadEstateSettings(UUID regionID, bool create);
EstateSettings LoadEstateSettings(int estateID);
void StoreEstateSettings(EstateSettings es);
List<int> GetEstates(string search);
bool LinkRegion(UUID regionID, int estateID);
List<UUID> GetRegions(int estateID);
bool DeleteEstate(int estateID);
}
}

View File

@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// the loaded IAR with existing folders where possible.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool DearchiveInventory(
string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options);
string firstName, string lastName, string invPath, string pass, Stream loadStream,
Dictionary<string, object> options);
/// <summary>
/// Archive a user's inventory folder to the given stream
@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="options">Archiving options. Currently, there are none.</param>
/// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
bool ArchiveInventory(
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options);
Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
Dictionary<string, object> options);
}
}

View File

@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary>
/// <param name="entityList"></param>
/// <param name="fileName"></param>
void SavePrimListToXml2(List<EntityBase> entityList, string fileName);
void SavePrimListToXml2(EntityBase[] entityList, string fileName);
/// <summary>
/// Save a set of prims in the xml2 format, optionally specifying a bounding box for which
@ -101,7 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="stream"></param>
/// <param name="min"></param>
/// <param name="max"></param>
void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max);
void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max);
void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);

View File

@ -0,0 +1,98 @@
/*
* 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 OpenSimulator 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 OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
public interface ISimulationDataService
{
/// <summary>
/// Stores all object's details apart from inventory
/// </summary>
/// <param name="obj"></param>
/// <param name="regionUUID"></param>
void StoreObject(SceneObjectGroup obj, UUID regionUUID);
/// <summary>
/// Entirely removes the object, including inventory
/// </summary>
/// <param name="uuid"></param>
/// <param name="regionUUID"></param>
/// <returns></returns>
void RemoveObject(UUID uuid, UUID regionUUID);
/// <summary>
/// Store a prim's inventory
/// </summary>
/// <returns></returns>
void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items);
/// <summary>
/// Load persisted objects from region storage.
/// </summary>
/// <param name="regionUUID">the Region UUID</param>
/// <returns>List of loaded groups</returns>
List<SceneObjectGroup> LoadObjects(UUID regionUUID);
/// <summary>
/// Store a terrain revision in region storage
/// </summary>
/// <param name="ter">HeightField data</param>
/// <param name="regionID">region UUID</param>
void StoreTerrain(double[,] terrain, UUID regionID);
/// <summary>
/// Load the latest terrain revision from region storage
/// </summary>
/// <param name="regionID">the region UUID</param>
/// <returns>Heightfield data</returns>
double[,] LoadTerrain(UUID regionID);
void StoreLandObject(ILandObject Parcel);
/// <summary>
/// <list type="bullet">
/// <item>delete from land where UUID=globalID</item>
/// <item>delete from landaccesslist where LandUUID=globalID</item>
/// </list>
/// </summary>
/// <param name="globalID"></param>
void RemoveLandObject(UUID globalID);
List<LandData> LoadLandObjects(UUID regionUUID);
void StoreRegionSettings(RegionSettings rs);
RegionSettings LoadRegionSettings(UUID regionUUID);
RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
void StoreRegionWindlightSettings(RegionLightShareData wl);
}
}

View File

@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IRegionDataStore
public interface ISimulationDataStore
{
/// <summary>
/// Initialises the data storage engine

View File

@ -34,227 +34,89 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes
{
public class EntityManager : IEnumerable<EntityBase>
public class EntityManager
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>();
private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
//private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>();
private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim();
private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>();
[Obsolete("Use Add() instead.")]
public void Add(UUID id, EntityBase eb)
public int Count
{
Add(eb);
get { return m_entities.Count; }
}
public void Add(EntityBase entity)
{
m_lock.EnterWriteLock();
try
{
try
{
m_eb_uuid.Add(entity.UUID, entity);
m_eb_localID.Add(entity.LocalId, entity);
}
catch(Exception e)
{
m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
}
public void InsertOrReplace(EntityBase entity)
{
m_lock.EnterWriteLock();
try
{
try
{
m_eb_uuid[entity.UUID] = entity;
m_eb_localID[entity.LocalId] = entity;
}
catch(Exception e)
{
m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
}
}
finally
{
m_lock.ExitWriteLock();
}
m_entities.Add(entity.UUID, entity.LocalId, entity);
}
public void Clear()
{
m_lock.EnterWriteLock();
try
{
m_eb_uuid.Clear();
m_eb_localID.Clear();
}
finally
{
m_lock.ExitWriteLock();
}
}
public int Count
{
get
{
return m_eb_uuid.Count;
}
m_entities.Clear();
}
public bool ContainsKey(UUID id)
{
try
{
return m_eb_uuid.ContainsKey(id);
}
catch
{
return false;
}
return m_entities.ContainsKey(id);
}
public bool ContainsKey(uint localID)
{
try
{
return m_eb_localID.ContainsKey(localID);
}
catch
{
return false;
}
return m_entities.ContainsKey(localID);
}
public bool Remove(uint localID)
{
m_lock.EnterWriteLock();
try
{
try
{
bool a = false;
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
a = m_eb_uuid.Remove(entity.UUID);
bool b = m_eb_localID.Remove(localID);
return a && b;
}
catch (Exception e)
{
m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
return m_entities.Remove(localID);
}
public bool Remove(UUID id)
{
m_lock.EnterWriteLock();
try
{
try
{
bool a = false;
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
a = m_eb_localID.Remove(entity.LocalId);
bool b = m_eb_uuid.Remove(id);
return a && b;
}
catch (Exception e)
{
m_log.ErrorFormat("Remove Entity failed for {0}", id, e);
return false;
}
}
finally
{
m_lock.ExitWriteLock();
}
return m_entities.Remove(id);
}
public List<EntityBase> GetAllByType<T>()
public EntityBase[] GetAllByType<T>()
{
List<EntityBase> tmp = new List<EntityBase>();
m_lock.EnterReadLock();
try
{
try
m_entities.ForEach(
delegate(EntityBase entity)
{
foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid)
{
if (pair.Value is T)
{
tmp.Add(pair.Value);
}
}
if (entity is T)
tmp.Add(entity);
}
catch (Exception e)
{
m_log.ErrorFormat("GetAllByType failed for {0}", e);
tmp = null;
}
}
finally
{
m_lock.ExitReadLock();
}
);
return tmp;
return tmp.ToArray();
}
public List<EntityBase> GetEntities()
public EntityBase[] GetEntities()
{
m_lock.EnterReadLock();
try
{
return new List<EntityBase>(m_eb_uuid.Values);
}
finally
{
m_lock.ExitReadLock();
}
List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
return tmp.ToArray();
}
public void ForEach(Action<EntityBase> action)
{
m_entities.ForEach(action);
}
public EntityBase Find(Predicate<EntityBase> predicate)
{
return m_entities.FindValue(predicate);
}
public EntityBase this[UUID id]
{
get
{
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
EntityBase entity;
m_entities.TryGetValue(id, out entity);
return entity;
}
set
{
InsertOrReplace(value);
Add(value);
}
}
@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
{
get
{
m_lock.EnterReadLock();
try
{
EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity))
return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
EntityBase entity;
m_entities.TryGetValue(localID, out entity);
return entity;
}
set
{
InsertOrReplace(value);
Add(value);
}
}
public bool TryGetValue(UUID key, out EntityBase obj)
{
m_lock.EnterReadLock();
try
{
return m_eb_uuid.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
return m_entities.TryGetValue(key, out obj);
}
public bool TryGetValue(uint key, out EntityBase obj)
{
m_lock.EnterReadLock();
try
{
return m_eb_localID.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
return m_entities.TryGetValue(key, out obj);
}
/// <summary>
/// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
/// </summary>
/// <returns></returns>
public IEnumerator<EntityBase> GetEnumerator()
{
return GetEntities().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}

View File

@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnTerrainUpdateDelegate OnTerrainUpdate;
public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup);
public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
public event OnBackupDelegate OnBackup;
@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public void TriggerOnBackup(IRegionDataStore dstore, bool forced)
public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
{
OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null)

View File

@ -1,3 +1,30 @@
/*
* 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 OpenSimulator 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 log4net;
@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart)
{
SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId);
if (group == null)
{
entityPos = entity.AbsolutePosition;
}
else
{
entityPos = group.AbsolutePosition;
}
// Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
// before its scheduled update was triggered
//entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{

View File

@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
foreach (EntityBase group in Entities)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase group in entities)
{
if (group is SceneObjectGroup)
{

View File

@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="remoteClient"></param>
public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)
@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)
@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
{
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
SurfaceTouchEventArgs surfaceArg = null;
if (surfaceArgs != null && surfaceArgs.Count > 0)

View File

@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
public partial class Scene : SceneBase
{
public delegate void SynchronizeSceneHandler(Scene scene);
public SynchronizeSceneHandler SynchronizeScene = null;
/* Used by the loadbalancer plugin on GForge */
protected int m_splitRegionID = 0;
public int SplitRegionID
{
get { return m_splitRegionID; }
set { m_splitRegionID = value; }
}
private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
public delegate void SynchronizeSceneHandler(Scene scene);
#region Fields
protected Timer m_restartWaitTimer = new Timer();
public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter;
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
private volatile int m_bordersLocked = 0;
public bool BordersLocked
{
get { return m_bordersLocked == 1; }
set
{
if (value == true)
m_bordersLocked = 1;
else
m_bordersLocked = 0;
}
}
public List<Border> NorthBorders = new List<Border>();
public List<Border> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>();
public List<Border> WestBorders = new List<Border>();
/// <value>
/// The scene graph for this scene
/// </value>
/// TODO: Possibly stop other classes being able to manipulate this directly.
private SceneGraph m_sceneGraph;
/// <summary>
/// Are we applying physics to any of the prims in this scene?
/// </summary>
/// <summary>Are we applying physics to any of the prims in this scene?</summary>
public bool m_physicalPrim;
public float m_maxNonphys = 256;
public float m_maxPhys = 10;
@ -119,24 +85,130 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent
public bool m_strictAccessControl = true;
public int MaxUndoCount = 5;
public bool LoginsDisabled = true;
public bool LoadingPrims;
public IXfer XferManager;
// the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
// the maximum time that must elapse before a changed object will be considered for persisted
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
protected int m_splitRegionID;
protected Timer m_restartWaitTimer = new Timer();
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
protected string m_simulatorVersion = "OpenSimulator Server";
protected ModuleLoader m_moduleLoader;
protected AgentCircuitManager m_authenticateHandler;
protected SceneCommunicationService m_sceneGridService;
protected ISnmpModule m_snmpService = null;
protected ISimulationDataService m_SimulationDataService;
protected IEstateDataService m_EstateDataService;
protected IAssetService m_AssetService;
protected IAuthorizationService m_AuthorizationService;
protected IInventoryService m_InventoryService;
protected IGridService m_GridService;
protected ILibraryService m_LibraryService;
protected ISimulationService m_simulationService;
protected IAuthenticationService m_AuthenticationService;
protected IPresenceService m_PresenceService;
protected IUserAccountService m_UserAccountService;
protected IAvatarService m_AvatarService;
protected IGridUserService m_GridUserService;
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule;
protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule;
// Central Update Loop
protected int m_fps = 10;
protected uint m_frame;
protected float m_timespan = 0.089f;
protected DateTime m_lastupdate = DateTime.UtcNow;
// TODO: Possibly stop other classes being able to manipulate this directly.
private SceneGraph m_sceneGraph;
private volatile int m_bordersLocked;
private int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds;
private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
private Object m_heartbeatLock = new Object();
protected string m_simulatorVersion = "OpenSimulator Server";
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
private int m_update_terrain = 50;
private int m_update_land = 1;
private int m_update_coarse_locations = 50;
protected ModuleLoader m_moduleLoader;
protected StorageManager m_storageManager;
protected AgentCircuitManager m_authenticateHandler;
private int frameMS;
private int physicsMS2;
private int physicsMS;
private int otherMS;
private int tempOnRezMS;
private int eventMS;
private int backupMS;
private int terrainMS;
private int landMS;
private int lastCompletedFrame;
protected SceneCommunicationService m_sceneGridService;
public bool LoginsDisabled = true;
public bool LoadingPrims = false;
public bool CombineRegions = false;
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
private int m_LastLogin;
private Thread HeartbeatThread;
private volatile bool shuttingdown;
private int m_lastUpdate;
private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0;
private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
private bool m_generateMaptiles;
#endregion Fields
#region Properties
/* Used by the loadbalancer plugin on GForge */
public int SplitRegionID
{
get { return m_splitRegionID; }
set { m_splitRegionID = value; }
}
public bool BordersLocked
{
get { return m_bordersLocked == 1; }
set
{
if (value == true)
m_bordersLocked = 1;
else
m_bordersLocked = 0;
}
}
public new float TimeDilation
{
@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; }
}
public IXfer XferManager;
protected ISnmpModule m_snmpService = null;
public ISnmpModule SnmpService
{
get
@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IAssetService m_AssetService;
protected IAuthorizationService m_AuthorizationService;
public ISimulationDataService SimulationDataService
{
get
{
if (m_SimulationDataService == null)
{
m_SimulationDataService = RequestModuleInterface<ISimulationDataService>();
private Object m_heartbeatLock = new Object();
if (m_SimulationDataService == null)
{
throw new Exception("No ISimulationDataService available.");
}
}
return m_SimulationDataService;
}
}
public IEstateDataService EstateDataService
{
get
{
if (m_EstateDataService == null)
{
m_EstateDataService = RequestModuleInterface<IEstateDataService>();
if (m_EstateDataService == null)
{
throw new Exception("No IEstateDataService available.");
}
}
return m_EstateDataService;
}
}
public IAssetService AssetService
{
@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IInventoryService m_InventoryService;
public IInventoryService InventoryService
{
get
@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IGridService m_GridService;
public IGridService GridService
{
get
@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected ILibraryService m_LibraryService;
public ILibraryService LibraryService
{
get
@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected ISimulationService m_simulationService;
public ISimulationService SimulationService
{
get
@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService
{
get
@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IPresenceService m_PresenceService;
public IPresenceService PresenceService
{
get
@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
return m_PresenceService;
}
}
protected IUserAccountService m_UserAccountService;
public IUserAccountService UserAccountService
{
get
@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService;
public OpenSim.Services.Interfaces.IAvatarService AvatarService
public IAvatarService AvatarService
{
get
{
@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IGridUserService m_GridUserService;
public IGridUserService GridUserService
{
get
@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
public IAttachmentsModule AttachmentsModule { get; set; }
protected IAvatarFactory m_AvatarFactory;
public IAvatarFactory AvatarFactory
{
get { return m_AvatarFactory; }
}
protected IConfigSource m_config;
protected IRegionSerialiserModule m_serialiser;
protected IDialogModule m_dialogModule;
protected IEntityTransferModule m_teleportModule;
protected ICapabilitiesModule m_capsModule;
public ICapabilitiesModule CapsModule
{
get { return m_capsModule; }
}
protected override IConfigSource GetConfig()
{
return m_config;
}
// Central Update Loop
protected int m_fps = 10;
protected uint m_frame;
protected float m_timespan = 0.089f;
protected DateTime m_lastupdate = DateTime.UtcNow;
private int m_update_physics = 1;
private int m_update_entitymovement = 1;
private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
private int m_update_presences = 1; // Update scene presence movements
private int m_update_events = 1;
private int m_update_backup = 200;
private int m_update_terrain = 50;
private int m_update_land = 1;
private int m_update_coarse_locations = 50;
private int frameMS;
private int physicsMS2;
private int physicsMS;
private int otherMS;
private int tempOnRezMS;
private int eventMS;
private int backupMS;
private int terrainMS;
private int landMS;
private int lastCompletedFrame;
public int MonitorFrameTime { get { return frameMS; } }
public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorLandTime { get { return landMS; } }
public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
private bool m_physics_enabled = true;
private bool m_scripts_enabled = true;
private string m_defaultScriptEngine;
private int m_LastLogin;
private Thread HeartbeatThread;
private volatile bool shuttingdown;
private int m_lastUpdate;
private bool m_firstHeartbeat = true;
private object m_deleting_scene_object = new object();
private object m_cleaningAttachments = new object();
// the minimum time that must elapse before a changed object will be considered for persisted
public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
// the maximum time that must elapse before a changed object will be considered for persisted
public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
private bool m_reprioritizationEnabled = true;
private double m_reprioritizationInterval = 5000.0;
private double m_rootReprioritizationDistance = 10.0;
private double m_childReprioritizationDistance = 20.0;
private Timer m_mapGenerationTimer = new Timer();
bool m_generateMaptiles = false;
#endregion
#region Properties
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sceneGraph.RestorePresences = value; }
}
#endregion
#endregion Properties
#region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService,
StorageManager storeManager,
ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{
@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
m_moduleLoader = moduleLoader;
m_authenticateHandler = authen;
m_sceneGridService = sceneGridService;
m_storageManager = storeManager;
m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName;
@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings
// Load region settings
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null)
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
}
m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
if (estateDataService != null)
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
#endregion Region Settings
@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
//Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject);
new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject);
new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo);
@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
if (ScriptEngine)
{
m_log.Info("Stopping all Scripts in Scene");
foreach (EntityBase ent in Entities)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{
if (ent is SceneObjectGroup)
{
((SceneObjectGroup) ent).RemoveScriptInstances(false);
}
((SceneObjectGroup)ent).RemoveScriptInstances(false);
}
}
else
{
m_log.Info("Starting all Scripts in Scene");
lock (Entities)
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase ent in entities)
{
foreach (EntityBase ent in Entities)
if (ent is SceneObjectGroup)
{
if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup)ent).ResumeScripts();
}
SceneObjectGroup sog = (SceneObjectGroup)ent;
sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
sog.ResumeScripts();
}
}
}
m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
}
@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes
shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects");
List<EntityBase> entities = GetEntities();
EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities)
{
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
{
((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false);
((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
}
}
@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{
MainConsole.Instance.Output("The current estate has no owner set.");
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test");
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User");
List<char> excluded = new List<char>(new char[1]{' '});
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
{
lock (m_returns)
{
EventManager.TriggerOnBackup(m_storageManager.DataStore, forced);
EventManager.TriggerOnBackup(SimulationDataService, forced);
m_backingup = false;
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (group != null)
{
group.ProcessBackup(m_storageManager.DataStore, true);
group.ProcessBackup(SimulationDataService, true);
}
}
@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SaveTerrain()
{
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
public void StoreWindlightProfile(RegionLightShareData wl)
{
m_regInfo.WindlightSettings = wl;
wl.Save();
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
SimulationDataService.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
public void LoadWindlightProfile()
{
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile();
}
@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID);
double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null)
{
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
else
{
@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
}
}
catch (Exception e)
@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
public void loadAllLandObjectsFromStorage(UUID regionID)
{
m_log.Info("[SCENE]: Loading land objects from storage");
List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID);
List<LandData> landData = SimulationDataService.LoadLandObjects(regionID);
if (LandChannel != null)
{
@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
LoadingPrims = true;
m_log.Info("[SCENE]: Loading objects from datastore");
List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID);
List<SceneObjectGroup> PrimsFromDB = SimulationDataService.LoadObjects(regionID);
m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore");
@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
lock (Entities)
{
ICollection<EntityBase> entities = new List<EntityBase>(Entities);
EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase e in entities)
{
if (e is SceneObjectGroup)
@ -2191,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes
// to the DB.
ForceSceneObjectBackup(so);
so.DetachFromBackup();
m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID);
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
{
ScenePresence presence = GetScenePresence(agentID);
if(presence != null)
if (presence != null)
{
try
{
@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Other Methods
protected override IConfigSource GetConfig()
{
return m_config;
}
#endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)
@ -4107,9 +4129,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void ForceClientUpdate()
{
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
/// will not affect the original list of objects in the scene.
/// </summary>
/// <returns></returns>
public List<EntityBase> GetEntities()
public EntityBase[] GetEntities()
{
return m_sceneGraph.GetEntities();
}
@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CleanTempObjects()
{
List<EntityBase> objs = GetEntities();
foreach (EntityBase obj in objs)
EntityBase[] entities = GetEntities();
foreach (EntityBase obj in entities)
{
if (obj is SceneObjectGroup)
{
@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid)
{
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID);
SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
}
public int GetHealth()
@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes
public List<UUID> GetEstateRegions(int estateID)
{
if (m_storageManager.EstateDataStore == null)
return new List<UUID>();
IEstateDataService estateDataService = EstateDataService;
if (estateDataService == null)
return new List<UUID>(0);
return m_storageManager.EstateDataStore.GetRegions(estateID);
return estateDataService.GetRegions(estateID);
}
public void ReloadEstateData()
{
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate();
}
}
public void TriggerEstateSunUpdate()

View File

@ -81,10 +81,7 @@ namespace OpenSim.Region.Framework.Scenes
protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
// SceneObjects is not currently populated or used.
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
protected internal EntityManager Entities = new EntityManager();
// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
protected RegionInfo m_regInfo;
@ -370,68 +367,57 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
return false;
lock (sceneObject)
if (Entities.ContainsKey(sceneObject.UUID))
return false;
List<SceneObjectPart> children;
lock (sceneObject.Children)
children = new List<SceneObjectPart>(sceneObject.Children.Values);
// Clamp child prim sizes and add child prims to the m_numPrim count
if (m_parentScene.m_clampPrimSize)
{
if (Entities.ContainsKey(sceneObject.UUID))
foreach (SceneObjectPart part in children)
{
// m_log.WarnFormat(
// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
return false;
Vector3 scale = part.Shape.Scale;
if (scale.X > m_parentScene.m_maxNonphys)
scale.X = m_parentScene.m_maxNonphys;
if (scale.Y > m_parentScene.m_maxNonphys)
scale.Y = m_parentScene.m_maxNonphys;
if (scale.Z > m_parentScene.m_maxNonphys)
scale.Z = m_parentScene.m_maxNonphys;
part.Shape.Scale = scale;
}
}
m_numPrim += children.Count;
// m_log.DebugFormat(
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
sceneObject.AttachToScene(m_parentScene);
lock (sceneObject.Children)
{
if (m_parentScene.m_clampPrimSize)
{
foreach (SceneObjectPart part in sceneObject.Children.Values)
{
Vector3 scale = part.Shape.Scale;
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
if (scale.X > m_parentScene.m_maxNonphys)
scale.X = m_parentScene.m_maxNonphys;
if (scale.Y > m_parentScene.m_maxNonphys)
scale.Y = m_parentScene.m_maxNonphys;
if (scale.Z > m_parentScene.m_maxNonphys)
scale.Z = m_parentScene.m_maxNonphys;
Entities.Add(sceneObject);
part.Shape.Scale = scale;
}
}
if (attachToBackup)
sceneObject.AttachToBackup();
m_numPrim += sceneObject.Children.Count;
}
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
sceneObject.AttachToScene(m_parentScene);
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
if (sendClientUpdates)
sceneObject.ScheduleGroupForFullUpdate();
Entities.Add(sceneObject);
if (attachToBackup)
sceneObject.AttachToBackup();
if (OnObjectCreate != null)
OnObjectCreate(sceneObject);
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByFullID[part.UUID] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
}
return true;
@ -443,42 +429,38 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>true if the object was deleted, false if there was no object to delete</returns>
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{
if (Entities.ContainsKey(uuid))
EntityBase entity;
if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
return false;
SceneObjectGroup grp = (SceneObjectGroup)entity;
if (!resultOfObjectLinked)
{
SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid];
m_numPrim -= grp.PrimCount;
if (!resultOfObjectLinked)
{
m_numPrim -= grp.PrimCount;
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
RemovePhysicalPrim(grp.PrimCount);
}
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
Entities.Remove(uuid);
//SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
return true;
if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
RemovePhysicalPrim(grp.PrimCount);
}
return false;
if (OnObjectRemove != null)
OnObjectRemove(Entities[uuid]);
lock (SceneObjectGroupsByFullID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
{
foreach (SceneObjectPart part in grp.Children.Values)
SceneObjectGroupsByLocalID.Remove(part.LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
return Entities.Remove(uuid);
}
/// <summary>
@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void AddToUpdateList(SceneObjectGroup obj)
{
lock (m_updateList)
{
m_updateList[obj.UUID] = obj;
}
}
public void FireAttachToBackup(SceneObjectGroup obj)
@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes
{
if (!Monitor.TryEnter(m_updateLock))
return;
List<SceneObjectGroup> updates;
// Some updates add more updates to the updateList.
// Get the current list of updates and clear the list before iterating
lock (m_updateList)
try
{
updates = new List<SceneObjectGroup>(m_updateList.Values);
m_updateList.Clear();
}
List<SceneObjectGroup> updates;
// Go through all updates
for (int i = 0; i < updates.Count; i++)
{
SceneObjectGroup sog = updates[i];
// Don't abort the whole update if one entity happens to give us an exception.
try
// Some updates add more updates to the updateList.
// Get the current list of updates and clear the list before iterating
lock (m_updateList)
{
sog.Update();
updates = new List<SceneObjectGroup>(m_updateList.Values);
m_updateList.Clear();
}
catch (Exception e)
// Go through all updates
for (int i = 0; i < updates.Count; i++)
{
m_log.ErrorFormat(
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
SceneObjectGroup sog = updates[i];
// Don't abort the whole update if one entity happens to give us an exception.
try
{
sog.Update();
}
catch (Exception e)
{
m_log.ErrorFormat(
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
}
}
}
Monitor.Exit(m_updateLock);
finally
{
Monitor.Exit(m_updateLock);
}
}
protected internal void AddPhysicalPrim(int number)
@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(uint localID)
{
if (Entities.ContainsKey(localID))
return Entities[localID] as SceneObjectGroup;
EntityBase entity;
if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
if (sog != null)
{
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
{
if (sog.HasChildPrim(localID))
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
}
if (sog.HasChildPrim(localID))
return sog;
SceneObjectGroupsByLocalID.Remove(localID);
}
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
//m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(localID))
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(localID))
{
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByLocalID)
{
SceneObjectGroupsByLocalID[localID] = sog;
}
return sog;
}
}
}
return null;
}
@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID)
{
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
{
lock (sog.Children)
{
if (sog.Children.ContainsKey(fullID))
return sog;
}
SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
SceneObjectGroupsByFullID.Remove(fullID);
if (sog != null)
{
lock (sog.Children)
{
if (sog.Children.ContainsKey(fullID))
return sog;
}
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID);
}
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(fullID))
sog = (SceneObjectGroup)ent;
if (sog.HasChildPrim(fullID))
{
sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByFullID)
{
SceneObjectGroupsByFullID[fullID] = sog;
}
return sog;
}
}
}
return null;
}
@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes
// Primitive Ray Tracing
float closestDistance = 280f;
EntityIntersection result = new EntityIntersection();
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if the part was not found</returns>
protected internal SceneObjectPart GetSceneObjectPart(string name)
{
List<EntityBase> EntityList = GetEntities();
SceneObjectPart sop = null;
// FIXME: use a dictionary here
foreach (EntityBase ent in EntityList)
{
if (ent is SceneObjectGroup)
Entities.Find(
delegate(EntityBase entity)
{
foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts())
if (entity is SceneObjectGroup)
{
if (p.Name == name)
foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
{
return p;
if (p.Name == name)
{
sop = p;
return true;
}
}
}
return false;
}
}
return null;
);
return sop;
}
/// <summary>
@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
/// it
/// </summary>
/// <returns></returns>
protected internal List<EntityBase> GetEntities()
protected internal EntityBase[] GetEntities()
{
return Entities.GetEntities();
}
@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
{
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
List<EntityBase> EntityList = GetEntities();
EntityBase[] EntityList = GetEntities();
int limit = 0;
foreach (EntityBase ent in EntityList)
{
@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{
List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>();
EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
foreach (EntityBase ent in objlist)
{
SceneObjectGroup obj = (SceneObjectGroup)ent;
@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID objid = UUID.Zero;
SceneObjectPart obj = null;
List<EntityBase> EntityList = GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{

View File

@ -1731,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Processes backup.
/// </summary>
/// <param name="datastore"></param>
public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup)
public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
{
if (!m_isBackedUp)
{
@ -1944,7 +1944,6 @@ namespace OpenSim.Region.Framework.Scenes
part.PhysActor.LocalID = part.LocalId;
part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
}
}
if (userExposed)
{
@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes
ScheduleGroupForFullUpdate();
}
}
finally
{
@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if a child part with the primID was not found</returns>
public SceneObjectPart GetChildPart(UUID primID)
{
SceneObjectPart childPart = null;
SceneObjectPart childPart;
lock (m_parts)
{
if (m_parts.ContainsKey(primID))
{
childPart = m_parts[primID];
}
}
m_parts.TryGetValue(primID, out childPart);
return childPart;
}

View File

@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID
{
get { return m_uuid; }
set { m_uuid = value; }
set
{
m_uuid = value;
// This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
if (Inventory != null)
Inventory.ResetInventoryIDs();
}
}
public uint LocalId
@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if(!sp.IsChildAgent)
if (!sp.IsChildAgent)
sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
});
}
@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
Inventory.ResetInventoryIDs();
}
/// <summary>

View File

@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_items.LockItemsForWrite(true);
if (0 == Items.Count)
if (Items.Count == 0)
{
m_items.LockItemsForWrite(false);
return;
@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Process inventory backup
/// </summary>
/// <param name="datastore"></param>
public void ProcessInventoryBackup(IRegionDataStore datastore)
public void ProcessInventoryBackup(ISimulationDataService datastore)
{
if (HasInventoryChanged)
{

View File

@ -73,9 +73,10 @@ namespace OpenSim.Region.Framework.Scenes
{
m_pendingObjects = new Queue<SceneObjectGroup>();
lock(m_pendingObjects)
lock (m_pendingObjects)
{
foreach (EntityBase e in m_presence.Scene.Entities)
EntityBase[] entities = m_presence.Scene.Entities.GetEntities();
foreach (EntityBase e in entities)
{
if (e != null && e is SceneObjectGroup)
m_pendingObjects.Enqueue((SceneObjectGroup)e);
@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
lock(m_pendingObjects)
lock (m_pendingObjects)
{
while (m_pendingObjects != null && m_pendingObjects.Count > 0)
{

View File

@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
int primCount = 0;
stream.WriteLine("<scene>\n");
List<EntityBase> EntityList = scene.GetEntities();
foreach (EntityBase ent in EntityList)
EntityBase[] entityList = scene.GetEntities();
foreach (EntityBase ent in entityList)
{
if (ent is SceneObjectGroup)
{
@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
public static void SavePrimsToXml2(Scene scene, string fileName)
{
List<EntityBase> EntityList = scene.GetEntities();
SavePrimListToXml2(EntityList, fileName);
EntityBase[] entityList = scene.GetEntities();
SavePrimListToXml2(entityList, fileName);
}
public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max)
{
List<EntityBase> EntityList = scene.GetEntities();
SavePrimListToXml2(EntityList, stream, min, max);
EntityBase[] entityList = scene.GetEntities();
SavePrimListToXml2(entityList, stream, min, max);
}
public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
"[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}",
primName, scene.RegionInfo.RegionName, fileName);
List<EntityBase> entityList = scene.GetEntities();
EntityBase[] entityList = scene.GetEntities();
List<EntityBase> primList = new List<EntityBase>();
foreach (EntityBase ent in entityList)
@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
SavePrimListToXml2(primList, fileName);
SavePrimListToXml2(primList.ToArray(), fileName);
}
public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName)
public static void SavePrimListToXml2(EntityBase[] entityList, string fileName)
{
FileStream file = new FileStream(fileName, FileMode.Create);
try
@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
}
}
public static void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max)
public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
{
int primCount = 0;
stream.WriteLine("<scene>\n");

View File

@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// scene backup thread.
scene.Backup(true);
List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
@ -335,7 +335,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
scene.DeleteSceneObject(groupToDelete, false);
List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID);
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));

View File

@ -75,7 +75,9 @@ namespace OpenSim.Region.Framework.Tests
protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
{
AssetNotecard nc = new AssetNotecard("Hello World!");
AssetNotecard nc = new AssetNotecard();
nc.BodyText = "Hello World!";
nc.Encode();
UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset

View File

@ -1,96 +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 OpenSimulator 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.Reflection;
using log4net;
using OpenSim.Region.Framework.Interfaces;
namespace OpenSim.Region.Framework
{
public class StorageManager
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IRegionDataStore m_dataStore;
public IRegionDataStore DataStore
{
get { return m_dataStore; }
}
private IEstateDataStore m_estateDataStore;
public IEstateDataStore EstateDataStore
{
get { return m_estateDataStore; }
}
public StorageManager(IRegionDataStore storage)
{
m_dataStore = storage;
}
public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
{
m_log.Info("[DATASTORE]: Attempting to load " + dllName);
Assembly pluginAssembly = Assembly.LoadFrom(dllName);
foreach (Type pluginType in pluginAssembly.GetTypes())
{
if (pluginType.IsPublic)
{
Type typeInterface = pluginType.GetInterface("IRegionDataStore", true);
if (typeInterface != null)
{
IRegionDataStore plug =
(IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
plug.Initialise(connectionstring);
m_dataStore = plug;
m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
}
typeInterface = pluginType.GetInterface("IEstateDataStore", true);
if (typeInterface != null)
{
IEstateDataStore estPlug =
(IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
estPlug.Initialise(estateconnectionstring);
m_estateDataStore = estPlug;
}
}
}
//TODO: Add checking and warning to make sure it initialised.
}
}
}

View File

@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendNamesReply()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users)
{
SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendWhoReply()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users)
{
/*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName,
@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendReplyUsers()
{
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>();
EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
SendServerCommand("392 :UserID Terminal Host");
if (users.Count == 0)
if (users.Length == 0)
{
SendServerCommand("395 :Nobody logged in");
return;

View File

@ -91,11 +91,11 @@ using OpenSim.Services.Interfaces;
* + RoleID
*
* GroupID -> GroupNotice -> NoticeID
* + TimeStamp [uint]
* + FromName [string]
* + Subject [string]
* + Message [string]
* + BinaryBucket [byte[]]
* + TimeStamp [uint]
* + FromName [string]
* + Subject [string]
* + Message [string]
* + BinaryBucket [byte[]]
*
* */
@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID);
GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers);
if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
if (SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
{
AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
string GroupName;
OSDMap GroupInfoMap;
if( SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap) )
if (SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap))
{
GroupInfoMap["Charter"] = OSD.FromString(charter);
GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList);
@ -379,7 +379,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
string GroupRoleMemberType = "GroupRole" + groupID.ToString();
if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers))
{
foreach(UUID UserID in GroupRoleMembers.Keys)
foreach (UUID UserID in GroupRoleMembers.Keys)
{
EnsureRoleNotSelectedByMember(groupID, roleID, UserID);
@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
OSDMap UserGroupMemberInfo;
if( SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo) )
if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
{
data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//
OSDMap GroupRoleInfo;
if( SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo) )
if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo))
{
data.GroupTitle = GroupRoleInfo["Title"].AsString();
data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
@ -748,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
//
OSDMap GroupInfo;
string GroupName;
if( SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo) )
if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
{
data.GroupID = groupID;
data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
@ -928,12 +928,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
Dictionary<string, OSDMap> GroupRoles;
if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
{
foreach( KeyValuePair<string, OSDMap> Role in GroupRoles )
foreach (KeyValuePair<string, OSDMap> Role in GroupRoles)
{
Dictionary<UUID, OSDMap> GroupRoleMembers;
if( SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers) )
if (SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers))
{
foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers )
foreach (KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers)
{
GroupRoleMembersData data = new GroupRoleMembersData();
@ -1264,7 +1264,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
}
if(maps.Count == 0)
if (maps.Count == 0)
{
if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
}
@ -1352,17 +1352,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
// Check if this is an update or a request
if ( requestArgs["RequestMethod"] == "RemoveGeneric"
|| requestArgs["RequestMethod"] == "AddGeneric"
)
if (requestArgs["RequestMethod"] == "RemoveGeneric"
|| requestArgs["RequestMethod"] == "AddGeneric")
{
// Any and all updates cause the cache to clear
m_memoryCache.Clear();
// Send update to server, return the response without caching it
return WebUtil.PostToService(m_groupsServerURI, requestArgs);
}
// If we're not doing an update, we must be requesting data

View File

@ -960,7 +960,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
}
if( resp == null )
if (resp == null)
{
string UserService;
UUID SessionID;

View File

@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
}
// Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList)
public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
{
System.Collections.ArrayList missingList = new System.Collections.ArrayList();
SceneObjectGroup temp = null;

View File

@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public void FindDifferences()
{
System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities();
List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities());
DiffersFromSceneGroup = false;
// if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))

View File

@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
private readonly Scene m_scene;
private readonly IEnumerator<EntityBase> m_sogEnum;
private readonly ISecurityCredential m_security;
private readonly List<EntityBase> m_entities;
public IObjEnum(Scene scene, ISecurityCredential security)
{
m_scene = scene;
m_security = security;
m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator();
m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
m_sogEnum = m_entities.GetEnumerator();
}
public void Dispose()

View File

@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
return;
}
foreach(string button in buttons)
foreach (string button in buttons)
{
if (button == String.Empty)
{

View File

@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{
get
{
List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Count];
EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Length];
for (int i = 0; i < ents.Count; i++)
for (int i = 0; i < ents.Length; i++)
{
EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);

View File

@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
{
m_copse = new List<Copse>();
List<EntityBase> objs = m_scene.GetEntities();
EntityBase[] objs = m_scene.GetEntities();
foreach (EntityBase obj in objs)
{
if (obj is SceneObjectGroup)

View File

@ -142,7 +142,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
{
RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
}
public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)

View File

@ -4298,9 +4298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
if (pinfos != null && pinfos.Length > 0)
pinfo = pinfos[0];
pinfo = World.PresenceService.GetAgent(uuid);
ce = new UserInfoCacheEntry();
ce.time = Util.EnvironmentTickCount();
@ -4319,11 +4317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
{
PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() });
if (pinfos != null && pinfos.Length > 0)
pinfo = pinfos[0];
else
pinfo = null;
pinfo = World.PresenceService.GetAgent(uuid);
ce.time = Util.EnvironmentTickCount();
ce.pinfo = pinfo;

View File

@ -1220,7 +1220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// can modify it
ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
if (startLandObject == null)
if (startLandObject == null)
{
OSSLShoutError("There is no land at that location");
return;
@ -1237,7 +1237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID uuid;
// Process the rules, not sure what the impact would be of changing owner or group
for (int idx = 0; idx < rules.Length; )
for (int idx = 0; idx < rules.Length;)
{
int code = rules.GetLSLIntegerItem(idx++);
string arg = rules.GetLSLStringItem(idx++);

View File

@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
}
else
{
Entities = m_CmdManager.m_ScriptEngine.World.GetEntities();
Entities = new List<EntityBase>(m_CmdManager.m_ScriptEngine.World.GetEntities());
}
SceneObjectPart SensePoint = ts.host;
@ -417,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
List<SensedEntity> sensedEntities = new List<SensedEntity>();
// If nobody about quit fast
if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
if (m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
return sensedEntities;
SceneObjectPart SensePoint = ts.host;
@ -496,7 +496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
{
ScenePresence sp;
// Try direct lookup by UUID
if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
if (!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
return sensedEntities;
senseEntity(sp);
}

View File

@ -632,7 +632,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
bool postOnRez = (bool)p[4];
StateSource stateSource = (StateSource)p[5];
lock(m_CompileDict)
lock (m_CompileDict)
{
if (!m_CompileDict.ContainsKey(itemID))
return false;

View File

@ -0,0 +1,79 @@
/*
* 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 OpenSimulator 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.IO;
using System.Net;
using System.Reflection;
using Nini.Config;
using log4net;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Handlers.Base;
namespace OpenSim.Server.Handlers.Hypergrid
{
public class HeloServiceInConnector : ServiceConnector
{
public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
base(config, server, configName)
{
server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
}
}
public class HeloServerGetHandler : BaseStreamHandler
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_HandlersType;
public HeloServerGetHandler(string handlersType) :
base("GET", "/helo")
{
m_HandlersType = handlersType;
}
public override byte[] Handle(string path, Stream requestData,
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{
return OKResponse(httpResponse);
}
private byte[] OKResponse(OSHttpResponse httpResponse)
{
m_log.Debug("[HELO]: hi, I was called");
httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
httpResponse.StatusCode = (int)HttpStatusCode.OK;
httpResponse.StatusDescription = "OK";
return new byte[0];
}
}
}

View File

@ -32,6 +32,8 @@ using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Services.Interfaces;
using OpenSim.Services.Connectors.Hypergrid;
using OpenSim.Services.Connectors.SimianGrid;
namespace OpenSim.Services.Connectors
{
@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>();
private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
public HGAssetServiceConnector(IConfigSource source)
{
@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors
private IAssetService GetConnector(string url)
{
AssetServicesConnector connector = null;
IAssetService connector = null;
lock (m_connectors)
{
if (m_connectors.ContainsKey(url))
@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors
}
else
{
// We're instantiating this class explicitly, but this won't
// work in general, because the remote grid may be running
// an asset server that has a different protocol.
// Eventually we will want a piece of protocol asking
// the remote server about its kind. Definitely cool thing to do!
connector = new AssetServicesConnector(url);
// Still not as flexible as I would like this to be,
// but good enough for now
string connectorType = new HeloServicesConnector(url).Helo();
m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType);
if (connectorType == "opensim-simian")
{
connector = new SimianAssetServiceConnector(url);
}
else
connector = new AssetServicesConnector(url);
m_connectors.Add(url, connector);
}
}

View File

@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
paramList.Add(hash);
XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" );
string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
XmlRpcResponse response = null;
try

View File

@ -0,0 +1,75 @@
/*
* 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 OpenSimulator 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 log4net;
using System;
using System.Net;
using System.Reflection;
using Nini.Config;
namespace OpenSim.Services.Connectors
{
public class HeloServicesConnector
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private string m_ServerURI = String.Empty;
public HeloServicesConnector()
{
}
public HeloServicesConnector(string serverURI)
{
m_ServerURI = serverURI.TrimEnd('/');
}
public virtual string Helo()
{
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
try
{
WebResponse response = req.GetResponse();
if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
return string.Empty;
return response.Headers.Get("X-Handlers-Provided");
}
catch (Exception e)
{
m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
}
// fail
return string.Empty;
}
}
}

View File

@ -26,11 +26,9 @@
*/
using System;
using System.Collections.Generic;
using System.Reflection;
using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenMetaverse;
using log4net;
@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void OnMakeRootAgent(ScenePresence sp)
{
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
Util.FireAndForget(delegate(object o)
{
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
});
}
public void OnNewClient(IClientAPI client)
@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
{
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
// Asynchronously update the position stored in the session table for this agent
Util.FireAndForget(delegate(object o)
{
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
});
}
}
}

View File

@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
CommonInit(source);
}
public SimianAssetServiceConnector(string url)
{
m_serverUrl = url;
}
public void Initialise(IConfigSource source)
{
IConfig moduleConfig = source.Configs["Modules"];
@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
public AssetBase Get(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
// Cache fetch
if (m_cache != null)
{
@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public AssetMetadata GetMetadata(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
AssetMetadata metadata = null;
// Cache fetch
@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns>True if the id was parseable, false otherwise</returns>
public bool Get(string id, Object sender, AssetRetrieved handler)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
// Cache fetch
if (m_cache != null)
{
@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public string Store(AssetBase asset)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
bool storedInCache = false;
string errorMessage = null;
@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns>
public bool Delete(string id)
{
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
//string errorMessage = String.Empty;
string url = m_serverUrl + id;

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