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

View File

@ -756,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
// Set the estate // Set the estate
// Check for an existing 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) if (estateIDs.Count < 1)
{ {
UUID userID = UUID.Zero; UUID userID = UUID.Zero;
@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
} }
// Create a new estate with the name provided // 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.EstateName = (string) requestData["estate_name"];
region.EstateSettings.EstateOwner = userID; region.EstateSettings.EstateOwner = userID;
@ -795,9 +795,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
{ {
int estateID = estateIDs[0]; 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."); 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.Collections.Generic;
using System.Text; using System.Text;
using OpenMetaverse; using OpenMetaverse;

View File

@ -40,15 +40,4 @@ namespace OpenSim.Data
void Initialise(string connect); void Initialise(string connect);
bool Delete(string id); 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> /// </returns>
List<InventoryItemBase> fetchActiveGestures(UUID avatarID); 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 #region Public methods
public MSSQLEstateStore()
{
}
public MSSQLEstateStore(string connectionString)
{
Initialise(connectionString);
}
/// <summary> /// <summary>
/// Initialises the estatedata class. /// Initialises the estatedata class.
/// </summary> /// </summary>

View File

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

View File

@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
private void UpdateAccessTime(AssetBase asset) 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) lock (m_dbLock)
{ {
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))

View File

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

View File

@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// A MySQL Interface for the Region Server /// A MySQL Interface for the Region Server
/// </summary> /// </summary>
public class MySQLDataStore : IRegionDataStore public class MySQLSimulationData : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private string m_connectionString; private string m_connectionString;
private object m_dbLock = new object(); private object m_dbLock = new object();
public MySQLSimulationData()
{
}
public MySQLSimulationData(string connectionString)
{
Initialise(connectionString);
}
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;

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.Collections.Generic;
using OpenMetaverse; using OpenMetaverse;

View File

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

View File

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

View File

@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
/// <summary> /// <summary>
/// A RegionData Interface to the SQLite database /// A RegionData Interface to the SQLite database
/// </summary> /// </summary>
public class SQLiteRegionData : IRegionDataStore public class SQLiteSimulationData : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
private String m_connectionString; private String m_connectionString;
public SQLiteSimulationData()
{
}
public SQLiteSimulationData(string connectionString)
{
Initialise(connectionString);
}
// Temporary attribute while this is experimental // Temporary attribute while this is experimental
/*********************************************************************** /***********************************************************************
@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// See IRegionDataStore
/// <list type="bullet"> /// <list type="bullet">
/// <item>Initialises RegionData Interface</item> /// <item>Initialises RegionData Interface</item>
/// <item>Loads and initialises a new SQLite connection and maintains it.</item> /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite
{ {
landaccesslist.Rows.Remove(rowsToDelete[iter]); landaccesslist.Rows.Remove(rowsToDelete[iter]);
} }
} }
Commit(); Commit();
} }
@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// see IRegionDatastore
/// </summary> /// </summary>
/// <param name="primID"></param> /// <param name="primID"></param>
/// <param name="items"></param> /// <param name="items"></param>
@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite
delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
da.DeleteCommand = delete; da.DeleteCommand = delete;
da.DeleteCommand.Connection = conn; da.DeleteCommand.Connection = conn;
} }
private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)

View File

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

View File

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

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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;

View File

@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
#else #else
[TestFixture(Description = "Region store tests (SQLite)")] [TestFixture(Description = "Region store tests (SQLite)")]
public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData> public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
{ {
} }
[TestFixture(Description = "Region store tests (MySQL)")] [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)")] [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> public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
where TConn : DbConnection, new() where TConn : DbConnection, new()
where TRegStore : class, IRegionDataStore, new() where TRegStore : class, ISimulationDataStore, new()
{ {
bool m_rebuildDB; bool m_rebuildDB;
public IRegionDataStore db; public ISimulationDataStore db;
public UUID zero = UUID.Zero; public UUID zero = UUID.Zero;
public UUID region1 = UUID.Random(); public UUID region1 = UUID.Random();
public UUID region2 = UUID.Random(); public UUID region2 = UUID.Random();
@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
protected override void InitService(object service) protected override void InitService(object service)
{ {
ClearDB(); ClearDB();
db = (IRegionDataStore)service; db = (ISimulationDataStore)service;
db.Initialise(m_connStr); db.Initialise(m_connStr);
} }

View File

@ -124,22 +124,6 @@ namespace OpenSim.Framework
set { m_standaloneUserSource = value; } 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; protected string m_librariesXMLFile;
public string LibrariesXMLFile public string LibrariesXMLFile
{ {

View File

@ -90,6 +90,57 @@ namespace OpenSim.Framework.Console
return ret; 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 // 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) public string CmdPrompt(string prompt, string defaultresponse, List<string> options)
{ {

View File

@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
SetCursorLeft(0); SetCursorLeft(0);
y = SetCursorTop(y); y = SetCursorTop(y);
System.Console.WriteLine("{0}{1}", prompt, cmdline); System.Console.WriteLine();
//Show();
lock (cmdline) lock (cmdline)
{ {
@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
} }
} }
AddToHistory(cmdline.ToString()); //AddToHistory(cmdline.ToString());
return cmdline.ToString(); return cmdline.ToString();
default: default:
break; 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.Threading;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;

View File

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

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework
case AssetType.Texture: case AssetType.Texture:
return "image/x-j2c"; return "image/x-j2c";
case AssetType.Sound: case AssetType.Sound:
return "application/ogg"; return "audio/ogg";
case AssetType.CallingCard: case AssetType.CallingCard:
return "application/vnd.ll.callingcard"; return "application/vnd.ll.callingcard";
case AssetType.Landmark: case AssetType.Landmark:
@ -98,8 +98,6 @@ namespace OpenSim.Framework
return "application/vnd.ll.outfitfolder"; return "application/vnd.ll.outfitfolder";
case AssetType.MyOutfitsFolder: case AssetType.MyOutfitsFolder:
return "application/vnd.ll.myoutfitsfolder"; return "application/vnd.ll.myoutfitsfolder";
case AssetType.InboxFolder:
return "application/vnd.ll.inboxfolder";
case AssetType.Unknown: case AssetType.Unknown:
default: default:
return "application/octet-stream"; return "application/octet-stream";
@ -128,7 +126,7 @@ namespace OpenSim.Framework
case InventoryType.Object: case InventoryType.Object:
return "application/vnd.ll.primitive"; return "application/vnd.ll.primitive";
case InventoryType.Sound: case InventoryType.Sound:
return "application/ogg"; return "audio/ogg";
case InventoryType.Snapshot: case InventoryType.Snapshot:
case InventoryType.Texture: case InventoryType.Texture:
return "image/x-j2c"; return "image/x-j2c";
@ -147,6 +145,7 @@ namespace OpenSim.Framework
case "image/jp2": case "image/jp2":
return (sbyte)AssetType.Texture; return (sbyte)AssetType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
return (sbyte)AssetType.Sound; return (sbyte)AssetType.Sound;
case "application/vnd.ll.callingcard": case "application/vnd.ll.callingcard":
case "application/x-metaverse-callingcard": case "application/x-metaverse-callingcard":
@ -209,8 +208,6 @@ namespace OpenSim.Framework
return (sbyte)AssetType.OutfitFolder; return (sbyte)AssetType.OutfitFolder;
case "application/vnd.ll.myoutfitsfolder": case "application/vnd.ll.myoutfitsfolder":
return (sbyte)AssetType.MyOutfitsFolder; return (sbyte)AssetType.MyOutfitsFolder;
case "application/vnd.ll.inboxfolder":
return (sbyte)AssetType.InboxFolder;
case "application/octet-stream": case "application/octet-stream":
default: default:
return (sbyte)AssetType.Unknown; return (sbyte)AssetType.Unknown;
@ -227,6 +224,7 @@ namespace OpenSim.Framework
case "image/jpeg": case "image/jpeg":
return (sbyte)InventoryType.Texture; return (sbyte)InventoryType.Texture;
case "application/ogg": case "application/ogg":
case "audio/ogg":
case "audio/x-wav": case "audio/x-wav":
return (sbyte)InventoryType.Sound; return (sbyte)InventoryType.Sound;
case "application/vnd.ll.callingcard": 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."); m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
} }
} }
public void RemoveStreamHandler(string httpMethod, string path) public void RemoveStreamHandler(string httpMethod, string path)
@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
RemoveHTTPHandler(httpMethod, path); RemoveHTTPHandler(httpMethod, path);
} }
public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
} }
} }
public bool RemoveLLSDHandler(string path, LLSDMethod handler) public bool RemoveLLSDHandler(string path, LLSDMethod handler)
{ {
try try

View File

@ -49,7 +49,7 @@ namespace OpenSim
public static string GetVersionString(string versionNumber, Flavour flavour) public static string GetVersionString(string versionNumber, Flavour flavour)
{ {
string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; string versionString = "OpenSim " + versionNumber + " " + flavour;
return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 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> /// <param name="partID">The new part ID to which this item belongs</param>
public void ResetIDs(UUID partID) public void ResetIDs(UUID partID)
{ {
_oldID = _itemID; OldItemID = ItemID;
_itemID = UUID.Random(); ItemID = UUID.Random();
_parentPartID = partID; ParentPartID = partID;
_parentID = partID; ParentID = partID;
} }
public TaskInventoryItem() 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.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 m_configSettings.ClientstackDll
= startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); = 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", m_console.Commands.AddCommand("region", false, "create region",
"create region [\"region name\"] <region_file.ini>", "create region [\"region name\"] <region_file.ini>",
"Create a new region.", "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 + " 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 + "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.", + "If <region_file.ini> does not exist, it will be created.",
@ -561,6 +561,7 @@ namespace OpenSim
{ {
regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
} }
IScene scene; IScene scene;
PopulateRegionEstateInfo(regInfo); PopulateRegionEstateInfo(regInfo);
CreateRegion(regInfo, true, out scene); CreateRegion(regInfo, true, out scene);

View File

@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Server.Base;
namespace OpenSim namespace OpenSim
{ {
@ -195,6 +196,24 @@ namespace OpenSim
m_permsModules = new List<string>(permissionModules.Split(',')); 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(); base.StartupSpecific();
m_stats = StatsManager.StartCollectingSimExtraStats(); m_stats = StatsManager.StartCollectingSimExtraStats();
@ -612,7 +631,7 @@ namespace OpenSim
regionInfo.InternalEndPoint.Port = (int) port; regionInfo.InternalEndPoint.Port = (int) port;
Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
if (m_autoCreateClientStack) if (m_autoCreateClientStack)
{ {
@ -628,30 +647,19 @@ namespace OpenSim
return scene; 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() protected override ClientStackManager CreateClientStackManager()
{ {
return new ClientStackManager(m_configSettings.ClientstackDll); return new ClientStackManager(m_configSettings.ClientstackDll);
} }
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
AgentCircuitManager circuitManager) IEstateDataService estateDataService, AgentCircuitManager circuitManager)
{ {
SceneCommunicationService sceneGridService = new SceneCommunicationService(); SceneCommunicationService sceneGridService = new SceneCommunicationService();
return new Scene( return new Scene(
regionInfo, circuitManager, sceneGridService, 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); m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
} }
@ -868,9 +876,11 @@ namespace OpenSim
/// </param> /// </param>
public void PopulateRegionEstateInfo(RegionInfo regInfo) 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 if (regInfo.EstateSettings.EstateID == 0) // No record at all
@ -882,7 +892,7 @@ namespace OpenSim
if (response == "no") if (response == "no")
{ {
// Create a new estate // 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.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
//regInfo.EstateSettings.Save(); //regInfo.EstateSettings.Save();
@ -894,7 +904,7 @@ namespace OpenSim
if (response == "None") if (response == "None")
continue; continue;
List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response); List<int> estateIDs = estateDataService.GetEstates(response);
if (estateIDs.Count < 1) if (estateIDs.Count < 1)
{ {
MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); 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]; 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; break;
MainConsole.Instance.Output("Joining the estate failed. Please try again."); 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 GodlikeMessage onGodlikeMessage;
public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
#endregion Events #endregion Events
#region Class Members #region Class Members
@ -3560,9 +3559,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private void ProcessEntityUpdates(int maxUpdates) private void ProcessEntityUpdates(int maxUpdates)
{ {
Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
int updatesThisCall = 0; int updatesThisCall = 0;
@ -11245,8 +11244,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
outputPacket = false; outputPacket = false;
if (m_debugPacketLevel <= 200 if (m_debugPacketLevel <= 200
&& && (packet.Type == PacketType.ImagePacket
(packet.Type == PacketType.ImagePacket
|| packet.Type == PacketType.ImageData || packet.Type == PacketType.ImageData
|| packet.Type == PacketType.LayerData || packet.Type == PacketType.LayerData
|| packet.Type == PacketType.CoarseLocationUpdate)) || packet.Type == PacketType.CoarseLocationUpdate))
@ -11944,7 +11942,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
dialog.Data.LastName = Util.StringToBytes256(ownerLastName); dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
dialog.Data.Message = Util.StringToBytes256(message); dialog.Data.Message = Util.StringToBytes256(message);
ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
buttons[0] = new ScriptDialogPacket.ButtonsBlock(); buttons[0] = new ScriptDialogPacket.ButtonsBlock();
buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");

View File

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

View File

@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// We can NOT use the dictionries here, as we are looking // We can NOT use the dictionries here, as we are looking
// for an entity by the fromAssetID, which is NOT the prim UUID // 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; SceneObjectGroup group;
foreach (EntityBase entity in detachEntities) foreach (EntityBase entity in detachEntities)

View File

@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public UUID PrincipalID; public UUID PrincipalID;
public FriendInfo[] Friends; public FriendInfo[] Friends;
public int Refcount; public int Refcount;
public UUID RegionID;
public bool IsFriend(string friend) 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); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected List<Scene> m_Scenes = new List<Scene>(); protected List<Scene> m_Scenes = new List<Scene>();
@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
protected Dictionary<UUID, UserFriendData> m_Friends = protected Dictionary<UUID, UserFriendData> m_Friends =
new Dictionary<UUID, UserFriendData>(); new Dictionary<UUID, UserFriendData>();
protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
protected IPresenceService PresenceService protected IPresenceService PresenceService
{ {
@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Instantiate the request handler // Instantiate the request handler
IHttpServer server = MainServer.GetHttpServer((uint)mPort); IHttpServer server = MainServer.GetHttpServer((uint)mPort);
server.AddStreamHandler(new FriendsRequestHandler(this)); server.AddStreamHandler(new FriendsRequestHandler(this));
} }
if (m_FriendsService == null) if (m_FriendsService == null)
@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
scene.EventManager.OnClientClosed += OnClientClosed; scene.EventManager.OnClientClosed += OnClientClosed;
scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
scene.EventManager.OnClientLogin += OnClientLogin; scene.EventManager.OnClientLogin += OnClientLogin;
} }
@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
public uint GetFriendPerms(UUID principalID, UUID friendID) public uint GetFriendPerms(UUID principalID, UUID friendID)
{ {
if (!m_Friends.ContainsKey(principalID)) FriendInfo[] friends = GetFriends(principalID);
return 0; foreach (FriendInfo fi in friends)
UserFriendData data = m_Friends[principalID];
string searchFor = friendID.ToString();
foreach (FriendInfo fi in data.Friends)
{ {
if (fi.Friend == searchFor) if (fi.Friend == friendID.ToString())
return (uint)fi.TheirFlags; return (uint)fi.TheirFlags;
} }
return 0; return 0;
} }
@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.OnApproveFriendRequest += OnApproveFriendRequest; client.OnApproveFriendRequest += OnApproveFriendRequest;
client.OnDenyFriendRequest += OnDenyFriendRequest; client.OnDenyFriendRequest += OnDenyFriendRequest;
client.OnTerminateFriendship += OnTerminateFriendship; client.OnTerminateFriendship += OnTerminateFriendship;
client.OnGrantUserRights += OnGrantUserRights; client.OnGrantUserRights += OnGrantUserRights;
// Asynchronously fetch the friends list or increment the refcount for the existing
// friends list
Util.FireAndForget(
delegate(object o)
{
lock (m_Friends) lock (m_Friends)
{ {
if (m_Friends.ContainsKey(client.AgentId)) UserFriendData friendsData;
if (m_Friends.TryGetValue(client.AgentId, out friendsData))
{ {
m_Friends[client.AgentId].Refcount++; friendsData.Refcount++;
return;
} }
else
{
friendsData = new UserFriendData();
friendsData.PrincipalID = client.AgentId;
friendsData.Friends = FriendsService.GetFriends(client.AgentId);
friendsData.Refcount = 1;
UserFriendData newFriends = new UserFriendData(); m_Friends[client.AgentId] = friendsData;
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) private void OnClientClosed(UUID agentID, Scene scene)
{ {
ScenePresence sp = scene.GetScenePresence(agentID); ScenePresence sp = scene.GetScenePresence(agentID);
if (sp != null && !sp.IsChildAgent) if (sp != null && !sp.IsChildAgent)
{
// do this for root agents closing out // do this for root agents closing out
StatusChange(agentID, false); StatusChange(agentID, false);
}
lock (m_Friends) lock (m_Friends)
if (m_Friends.ContainsKey(agentID))
{ {
if (m_Friends[agentID].Refcount == 1) UserFriendData friendsData;
if (m_Friends.TryGetValue(agentID, out friendsData))
{
friendsData.Refcount--;
if (friendsData.Refcount <= 0)
m_Friends.Remove(agentID); m_Friends.Remove(agentID);
else }
m_Friends[agentID].Refcount--;
} }
} }
private void OnMakeRootAgent(ScenePresence sp) private void OnMakeRootAgent(ScenePresence sp)
{ {
UUID agentID = sp.ControllingClient.AgentId; UUID agentID = sp.ControllingClient.AgentId;
UpdateFriendsCache(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;
}
} }
private void OnClientLogin(IClientAPI client) private void OnClientLogin(IClientAPI client)
@ -296,26 +276,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Register that we need to send the list of online friends to this user // Register that we need to send the list of online friends to this user
lock (m_NeedsListOfFriends) lock (m_NeedsListOfFriends)
if (!m_NeedsListOfFriends.Contains(agentID))
{
m_NeedsListOfFriends.Add(agentID); m_NeedsListOfFriends.Add(agentID);
} }
}
public void SendFriendsOnlineIfNeeded(IClientAPI client) public void SendFriendsOnlineIfNeeded(IClientAPI client)
{ {
UUID agentID = client.AgentId; 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)) if (!m_NeedsListOfFriends.Remove(agentID))
{
m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
return; return;
} }
//
// Send the friends online // Send the friends online
//
List<UUID> online = GetOnlineFriends(agentID); List<UUID> online = GetOnlineFriends(agentID);
if (online.Count > 0) if (online.Count > 0)
{ {
@ -323,39 +298,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.SendAgentOnline(online.ToArray()); client.SendAgentOnline(online.ToArray());
} }
//
// Send outstanding friendship offers // Send outstanding friendship offers
//
if (m_Friends.ContainsKey(agentID))
{
List<string> outstanding = new List<string>(); List<string> outstanding = new List<string>();
FriendInfo[] friends = GetFriends(agentID);
foreach (FriendInfo fi in m_Friends[agentID].Friends) foreach (FriendInfo fi in friends)
{
if (fi.TheirFlags == -1) if (fi.TheirFlags == -1)
outstanding.Add(fi.Friend); 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) foreach (string fid in outstanding)
{ {
try UUID fromAgentID;
{ if (!UUID.TryParse(fid, out fromAgentID))
im.fromAgentID = new Guid(fid);
}
catch
{
continue; continue;
}
UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
im.fromAgentID = fromAgentID.Guid;
im.fromAgentName = account.FirstName + " " + account.LastName; im.fromAgentName = account.FirstName + " " + account.LastName;
im.offline = (byte)((presence == null) ? 1 : 0);
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.imSessionID = im.fromAgentID; im.imSessionID = im.fromAgentID;
// Finally // Finally
@ -363,54 +329,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
lock (m_NeedsListOfFriends)
m_NeedsListOfFriends.Remove(agentID);
}
}
List<UUID> GetOnlineFriends(UUID userID) List<UUID> GetOnlineFriends(UUID userID)
{ {
List<string> friendList = new List<string>(); List<string> friendList = new List<string>();
List<UUID> online = new List<UUID>(); 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)) if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi.Friend); friendList.Add(fi.Friend);
} }
if (friendList.Count == 0) if (friendList.Count > 0)
// no friends whatsoever {
return online;
PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
foreach (PresenceInfo pi in presence) foreach (PresenceInfo pi in presence)
online.Add(new UUID(pi.UserID)); {
//m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); UUID presenceID;
if (UUID.TryParse(pi.UserID, out presenceID))
online.Add(presenceID);
}
}
return online; return online;
} }
// /// <summary>
// Find the client for a ID /// Find the client for a ID
// /// </summary>
public IClientAPI LocateClientObject(UUID agentID) public IClientAPI LocateClientObject(UUID agentID)
{ {
Scene scene = GetClientScene(agentID); Scene scene = GetClientScene(agentID);
if (scene == null) if (scene != null)
return null; {
ScenePresence presence = scene.GetScenePresence(agentID); ScenePresence presence = scene.GetScenePresence(agentID);
if (presence == null) if (presence != null)
return null;
return presence.ControllingClient; return presence.ControllingClient;
} }
// return null;
// Find the scene for an agent }
//
/// <summary>
/// Find the scene for an agent
/// </summary>
private Scene GetClientScene(UUID agentId) private Scene GetClientScene(UUID agentId)
{ {
lock (m_Scenes) lock (m_Scenes)
@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
foreach (Scene scene in m_Scenes) foreach (Scene scene in m_Scenes)
{ {
ScenePresence presence = scene.GetScenePresence(agentId); ScenePresence presence = scene.GetScenePresence(agentId);
if (presence != null) if (presence != null && !presence.IsChildAgent)
{
if (!presence.IsChildAgent)
return scene; return scene;
} }
} }
}
return null; return null;
} }
@ -435,18 +396,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
/// <param name="online"></param> /// <param name="online"></param>
private void StatusChange(UUID agentID, bool online) private void StatusChange(UUID agentID, bool online)
{ {
//m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); FriendInfo[] friends = GetFriends(agentID);
if (m_Friends.ContainsKey(agentID)) if (friends.Length > 0)
{ {
//m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
List<FriendInfo> friendList = new List<FriendInfo>(); 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)) if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
friendList.Add(fi); friendList.Add(fi);
} }
Util.FireAndForget(delegate Util.FireAndForget(
delegate
{ {
foreach (FriendInfo fi in friendList) foreach (FriendInfo fi in friendList)
{ {
@ -454,16 +415,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// Notify about this user status // Notify about this user status
StatusNotify(fi, agentID, online); StatusNotify(fi, agentID, online);
} }
});
} }
else );
m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID); }
} }
private void StatusNotify(FriendInfo friend, UUID userID, bool online) private void StatusNotify(FriendInfo friend, UUID userID, bool online)
{ {
UUID friendID = UUID.Zero; UUID friendID;
if (UUID.TryParse(friend.Friend, out friendID)) if (UUID.TryParse(friend.Friend, out friendID))
{ {
// Try local // Try local
@ -471,34 +430,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return; return;
// The friend is not here [as root]. Let's forward. // The friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0) 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); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
//m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
m_FriendsSimConnector.StatusNotify(region, userID, friendID, online); m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
} }
} }
// Friend is not online. Ignore.
}
else else
{
m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
} }
}
private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 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 // we got a friendship offer
UUID principalID = new UUID(im.fromAgentID); UUID principalID = new UUID(im.fromAgentID);
@ -529,16 +477,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return; return;
// The prospective friend is not here [as root]. Let's forward. // The prospective friend is not here [as root]. Let's forward.
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message); m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
} }
}
// If the prospective friend is not online, he'll get the message upon login. // 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(agentID, friendID.ToString(), 1);
FriendsService.StoreFriend(friendID, agentID.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 // Notify the friend
@ -564,10 +508,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
// The friend is not here // The friend is not here
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
@ -575,7 +516,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.SendAgentOnline(new UUID[] { friendID }); client.SendAgentOnline(new UUID[] { friendID });
} }
} }
}
private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders) private void OnDenyFriendRequest(IClientAPI client, UUID agentID, UUID friendID, List<UUID> callingCardFolders)
{ {
@ -592,10 +532,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipDenied(agentID, client.Name, friendID)) if (LocalFriendshipDenied(agentID, client.Name, friendID))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(friendID);
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
@ -605,7 +542,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID); m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
} }
} }
}
private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID) private void OnTerminateFriendship(IClientAPI client, UUID agentID, UUID exfriendID)
{ {
@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
FriendsService.Delete(exfriendID, agentID.ToString()); FriendsService.Delete(exfriendID, agentID.ToString());
// Update local cache // Update local cache
m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); UpdateFriendsCache(agentID);
client.SendTerminateFriend(exfriendID); client.SendTerminateFriend(exfriendID);
@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalFriendshipTerminated(exfriendID)) if (LocalFriendshipTerminated(exfriendID))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID); m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
} }
} }
}
private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 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; return;
m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); 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 // Let's find the friend in this user's friend list
UserFriendData fd = m_Friends[remoteClient.AgentId];
FriendInfo friend = null; FriendInfo friend = null;
foreach (FriendInfo fi in fd.Friends) foreach (FriendInfo fi in friends)
{
if (fi.Friend == target.ToString()) if (fi.Friend == target.ToString())
friend = fi; friend = fi;
}
if (friend != null) // Found it if (friend != null) // Found it
{ {
@ -670,10 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (LocalGrantRights(requester, target, myFlags, rights)) if (LocalGrantRights(requester, target, myFlags, rights))
return; return;
PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); PresenceInfo friendSession = PresenceService.GetAgent(target);
if (friendSessions != null && friendSessions.Length > 0)
{
PresenceInfo friendSession = friendSessions[0];
if (friendSession != null) if (friendSession != null)
{ {
GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
@ -683,7 +614,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
} }
} }
}
#region Local #region Local
@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im); friendClient.SendInstantMessage(im);
// update the local cache
m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); // Update the local cache
UpdateFriendsCache(friendID);
// we're done // we're done
return true; return true;
} }
@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
if (friendClient != null) if (friendClient != null)
{ {
// the prospective friend in this sim as root agent // the prospective friend in this sim as root agent
GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
(byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
friendClient.SendInstantMessage(im); friendClient.SendInstantMessage(im);
@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// the friend in this sim as root agent // the friend in this sim as root agent
friendClient.SendTerminateFriend(exfriendID); friendClient.SendTerminateFriend(exfriendID);
// update local cache // update local cache
m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); UpdateFriendsCache(exfriendID);
// we're done // we're done
return true; return true;
} }
@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
} }
// update local cache // Update local cache
//m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); lock (m_Friends)
foreach (FriendInfo finfo in m_Friends[friendID].Friends) {
FriendInfo[] friends = GetFriends(friendID);
foreach (FriendInfo finfo in friends)
{
if (finfo.Friend == userID.ToString()) if (finfo.Friend == userID.ToString())
finfo.TheirFlags = rights; finfo.TheirFlags = rights;
}
}
return true; return true;
} }
@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
return false; return false;
} }
#endregion #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) && if (scene.Entities.ContainsKey(toAgentID) &&
scene.Entities[toAgentID] is ScenePresence) scene.Entities[toAgentID] is ScenePresence)
{ {
// m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); // m_log.DebugFormat(
// Local message // "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
// toAgentID.ToString(), scene.RegionInfo.RegionName);
ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
if (!user.IsChildAgent) if (!user.IsChildAgent)
{ {
@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
if (lookupAgent) if (lookupAgent)
{ {
// Non-cached user agent lookup. // Non-cached user agent lookup.
PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); upd = PresenceService.GetAgent(toAgentID);
if (presences != null && presences.Length > 0)
upd = presences[0];
if (upd != null) if (upd != null)
{ {

View File

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

View File

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

View File

@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
{ {
public class UserAccountCache public class UserAccountCache
{ {
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
public void Cache(UUID userID, UserAccount account) public void Cache(UUID userID, UserAccount account)
{ {
// Cache even null accounts // 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) 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); // 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>(); 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>(); List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
/* /*

View File

@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
using RegionSettings = OpenSim.Framework.RegionSettings;
namespace OpenSim.Region.CoreModules.World.Archiver.Tests namespace OpenSim.Region.CoreModules.World.Archiver.Tests
{ {
@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
SceneObjectPart part2 = CreateSceneObjectPart2(); 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 ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset AssetBase ncAsset

View File

@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
} }
} }
private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
{ {
if (m_scene.Permissions.IsGod(avatar.UUID)) return; if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
{ {
avatar.ControllingClient.SendAlertMessage( avatar.ControllingClient.SendAlertMessage(
"You are not allowed on this parcel because the land owner has restricted access."); "You are not allowed on this parcel because the land owner has restricted access.");
} }
public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
{ {
lock (m_landList) lock (m_landList)
{ {
foreach (LandObject p in m_landList.Values) foreach (LandObject p in m_landList.Values)
@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
public void EventManagerOnParcelPrimCountUpdate() public void EventManagerOnParcelPrimCountUpdate()
{ {
ResetAllLandPrimCounts(); ResetAllLandPrimCounts();
foreach (EntityBase obj in m_scene.Entities) EntityBase[] entities = m_scene.Entities.GetEntities();
foreach (EntityBase obj in entities)
{ {
if (obj != null) if (obj != null)
{ {
@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
temp.Add(currentParcel); temp.Add(currentParcel);
} }
} }
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
/// </summary> /// </summary>
/// <param name="entityList"></param> /// <param name="entityList"></param>
/// <param name="fileName"></param> /// <param name="fileName"></param>
void SavePrimListToXml2(List<EntityBase> entityList, string fileName); void SavePrimListToXml2(EntityBase[] entityList, string fileName);
/// <summary> /// <summary>
/// Save a set of prims in the xml2 format, optionally specifying a bounding box for which /// 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="stream"></param>
/// <param name="min"></param> /// <param name="min"></param>
/// <param name="max"></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); 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 namespace OpenSim.Region.Framework.Interfaces
{ {
public interface IRegionDataStore public interface ISimulationDataStore
{ {
/// <summary> /// <summary>
/// Initialises the data storage engine /// Initialises the data storage engine

View File

@ -34,293 +34,114 @@ using OpenMetaverse;
namespace OpenSim.Region.Framework.Scenes 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 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, 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();
[Obsolete("Use Add() instead.")] public int Count
public void Add(UUID id, EntityBase eb)
{ {
Add(eb); get { return m_entities.Count; }
} }
public void Add(EntityBase entity) public void Add(EntityBase entity)
{ {
m_lock.EnterWriteLock(); m_entities.Add(entity.UUID, entity.LocalId, entity);
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();
}
} }
public void Clear() public void Clear()
{ {
m_lock.EnterWriteLock(); m_entities.Clear();
try
{
m_eb_uuid.Clear();
m_eb_localID.Clear();
}
finally
{
m_lock.ExitWriteLock();
}
}
public int Count
{
get
{
return m_eb_uuid.Count;
}
} }
public bool ContainsKey(UUID id) public bool ContainsKey(UUID id)
{ {
try return m_entities.ContainsKey(id);
{
return m_eb_uuid.ContainsKey(id);
}
catch
{
return false;
}
} }
public bool ContainsKey(uint localID) public bool ContainsKey(uint localID)
{ {
try return m_entities.ContainsKey(localID);
{
return m_eb_localID.ContainsKey(localID);
}
catch
{
return false;
}
} }
public bool Remove(uint localID) public bool Remove(uint localID)
{ {
m_lock.EnterWriteLock(); return m_entities.Remove(localID);
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();
}
} }
public bool Remove(UUID id) public bool Remove(UUID id)
{ {
m_lock.EnterWriteLock(); return m_entities.Remove(id);
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();
}
} }
public List<EntityBase> GetAllByType<T>() public EntityBase[] GetAllByType<T>()
{ {
List<EntityBase> tmp = new List<EntityBase>(); List<EntityBase> tmp = new List<EntityBase>();
m_lock.EnterReadLock(); m_entities.ForEach(
try delegate(EntityBase entity)
{ {
try if (entity is T)
{ tmp.Add(entity);
foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid)
{
if (pair.Value is T)
{
tmp.Add(pair.Value);
} }
} );
}
catch (Exception e) return tmp.ToArray();
{
m_log.ErrorFormat("GetAllByType failed for {0}", e);
tmp = null;
}
}
finally
{
m_lock.ExitReadLock();
} }
return tmp; public EntityBase[] GetEntities()
{
List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
return tmp.ToArray();
} }
public List<EntityBase> GetEntities() public void ForEach(Action<EntityBase> action)
{ {
m_lock.EnterReadLock(); m_entities.ForEach(action);
try
{
return new List<EntityBase>(m_eb_uuid.Values);
} }
finally
public EntityBase Find(Predicate<EntityBase> predicate)
{ {
m_lock.ExitReadLock(); return m_entities.FindValue(predicate);
}
} }
public EntityBase this[UUID id] public EntityBase this[UUID id]
{ {
get get
{
m_lock.EnterReadLock();
try
{ {
EntityBase entity; EntityBase entity;
if (m_eb_uuid.TryGetValue(id, out entity)) m_entities.TryGetValue(id, out entity);
return entity; return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
} }
set set
{ {
InsertOrReplace(value); Add(value);
} }
} }
public EntityBase this[uint localID] public EntityBase this[uint localID]
{ {
get get
{
m_lock.EnterReadLock();
try
{ {
EntityBase entity; EntityBase entity;
if (m_eb_localID.TryGetValue(localID, out entity)) m_entities.TryGetValue(localID, out entity);
return entity; return entity;
else
return null;
}
finally
{
m_lock.ExitReadLock();
}
} }
set set
{ {
InsertOrReplace(value); Add(value);
} }
} }
public bool TryGetValue(UUID key, out EntityBase obj) public bool TryGetValue(UUID key, out EntityBase obj)
{ {
m_lock.EnterReadLock(); return m_entities.TryGetValue(key, out obj);
try
{
return m_eb_uuid.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
}
} }
public bool TryGetValue(uint key, out EntityBase obj) public bool TryGetValue(uint key, out EntityBase obj)
{ {
m_lock.EnterReadLock(); return m_entities.TryGetValue(key, out obj);
try
{
return m_eb_localID.TryGetValue(key, out obj);
}
finally
{
m_lock.ExitReadLock();
} }
} }
/// <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 event OnTerrainUpdateDelegate OnTerrainUpdate;
public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
public event OnBackupDelegate OnBackup; 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; OnBackupDelegate handlerOnAttach = OnBackup;
if (handlerOnAttach != null) 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;
using System.Collections.Generic; using System.Collections.Generic;
using log4net; using log4net;
@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 entityPos = entity.AbsolutePosition; Vector3 entityPos = entity.AbsolutePosition;
if (entity is SceneObjectPart) if (entity is SceneObjectPart)
{ {
SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
if (group == null) // before its scheduled update was triggered
{ //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
entityPos = entity.AbsolutePosition; entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
}
else
{
entityPos = group.AbsolutePosition;
}
} }
else else
{ {

View File

@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 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) if (group is SceneObjectGroup)
{ {

View File

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

View File

@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
public partial class Scene : SceneBase 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_MIN_TIME_FOR_PERSISTENCE = 60L;
private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
public delegate void SynchronizeSceneHandler(Scene scene);
#region Fields #region Fields
protected Timer m_restartWaitTimer = new Timer(); public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter; 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> NorthBorders = new List<Border>();
public List<Border> EastBorders = new List<Border>(); public List<Border> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>(); public List<Border> SouthBorders = new List<Border>();
public List<Border> WestBorders = new List<Border>(); public List<Border> WestBorders = new List<Border>();
/// <value> /// <summary>Are we applying physics to any of the prims in this scene?</summary>
/// 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>
public bool m_physicalPrim; public bool m_physicalPrim;
public float m_maxNonphys = 256; public float m_maxNonphys = 256;
public float m_maxPhys = 10; public float m_maxPhys = 10;
@ -119,24 +85,130 @@ namespace OpenSim.Region.Framework.Scenes
// root agents when ACL denies access to root agent // root agents when ACL denies access to root agent
public bool m_strictAccessControl = true; public bool m_strictAccessControl = true;
public int MaxUndoCount = 5; 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 int m_RestartTimerCounter;
private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
private int m_incrementsof15seconds; private int m_incrementsof15seconds;
private volatile bool m_backingup; private volatile bool m_backingup;
private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 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; private int frameMS;
protected StorageManager m_storageManager; private int physicsMS2;
protected AgentCircuitManager m_authenticateHandler; 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; 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 public new float TimeDilation
{ {
@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
get { return m_sceneGridService; } get { return m_sceneGridService; }
} }
public IXfer XferManager;
protected ISnmpModule m_snmpService = null;
public ISnmpModule SnmpService public ISnmpModule SnmpService
{ {
get get
@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IAssetService m_AssetService; public ISimulationDataService SimulationDataService
protected IAuthorizationService m_AuthorizationService; {
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 public IAssetService AssetService
{ {
@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IInventoryService m_InventoryService;
public IInventoryService InventoryService public IInventoryService InventoryService
{ {
get get
@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IGridService m_GridService;
public IGridService GridService public IGridService GridService
{ {
get get
@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected ILibraryService m_LibraryService;
public ILibraryService LibraryService public ILibraryService LibraryService
{ {
get get
@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected ISimulationService m_simulationService;
public ISimulationService SimulationService public ISimulationService SimulationService
{ {
get get
@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IAuthenticationService m_AuthenticationService;
public IAuthenticationService AuthenticationService public IAuthenticationService AuthenticationService
{ {
get get
@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IPresenceService m_PresenceService;
public IPresenceService PresenceService public IPresenceService PresenceService
{ {
get get
@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
return m_PresenceService; return m_PresenceService;
} }
} }
protected IUserAccountService m_UserAccountService;
public IUserAccountService UserAccountService public IUserAccountService UserAccountService
{ {
get get
@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; public IAvatarService AvatarService
public OpenSim.Services.Interfaces.IAvatarService AvatarService
{ {
get get
{ {
@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IGridUserService m_GridUserService;
public IGridUserService GridUserService public IGridUserService GridUserService
{ {
get get
@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
public IAttachmentsModule AttachmentsModule { get; set; } public IAttachmentsModule AttachmentsModule { get; set; }
protected IAvatarFactory m_AvatarFactory;
public IAvatarFactory AvatarFactory public IAvatarFactory AvatarFactory
{ {
get { return m_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 public ICapabilitiesModule CapsModule
{ {
get { return m_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 MonitorFrameTime { get { return frameMS; } }
public int MonitorPhysicsUpdateTime { get { return physicsMS; } } public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
public int MonitorPhysicsSyncTime { get { return physicsMS2; } } public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorLandTime { get { return landMS; } } public int MonitorLandTime { get { return landMS; } }
public int MonitorLastFrameTick { get { return lastCompletedFrame; } } 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 UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
set { m_sceneGraph.RestorePresences = value; } set { m_sceneGraph.RestorePresences = value; }
} }
#endregion #endregion Properties
#region Constructors #region Constructors
public Scene(RegionInfo regInfo, AgentCircuitManager authen, public Scene(RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService, SceneCommunicationService sceneGridService,
StorageManager storeManager, ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
{ {
@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
m_moduleLoader = moduleLoader; m_moduleLoader = moduleLoader;
m_authenticateHandler = authen; m_authenticateHandler = authen;
m_sceneGridService = sceneGridService; m_sceneGridService = sceneGridService;
m_storageManager = storeManager; m_SimulationDataService = simDataService;
m_EstateDataService = estateDataService;
m_regInfo = regInfo; m_regInfo = regInfo;
m_regionHandle = m_regInfo.RegionHandle; m_regionHandle = m_regInfo.RegionHandle;
m_regionName = m_regInfo.RegionName; m_regionName = m_regInfo.RegionName;
@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Region Settings #region Region Settings
// Load region settings // Load region settings
m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
if (m_storageManager.EstateDataStore != null) m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
{ if (estateDataService != null)
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
}
#endregion Region Settings #endregion Region Settings
@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
//Bind Storage Manager functions to some land manager functions for this scene //Bind Storage Manager functions to some land manager functions for this scene
EventManager.OnLandObjectAdded += EventManager.OnLandObjectAdded +=
new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); new EventManager.LandObjectAdded(simDataService.StoreLandObject);
EventManager.OnLandObjectRemoved += EventManager.OnLandObjectRemoved +=
new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
m_sceneGraph = new SceneGraph(this, m_regInfo); m_sceneGraph = new SceneGraph(this, m_regInfo);
@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
if (ScriptEngine) if (ScriptEngine)
{ {
m_log.Info("Stopping all Scripts in Scene"); 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) if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).RemoveScriptInstances(false); ((SceneObjectGroup)ent).RemoveScriptInstances(false);
} }
} }
}
else else
{ {
m_log.Info("Starting all Scripts in Scene"); 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 sog = (SceneObjectGroup)ent;
((SceneObjectGroup)ent).ResumeScripts(); sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
} sog.ResumeScripts();
} }
} }
} }
m_scripts_enabled = !ScriptEngine; m_scripts_enabled = !ScriptEngine;
m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); 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; shuttingdown = true;
m_log.Debug("[SCENE]: Persisting changed objects"); m_log.Debug("[SCENE]: Persisting changed objects");
List<EntityBase> entities = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase entity in entities) foreach (EntityBase entity in entities)
{ {
if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) 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) while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
{ {
MainConsole.Instance.Output("The current estate has no owner set."); MainConsole.Instance.Output("The current estate has no owner set.");
string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); List<char> excluded = new List<char>(new char[1]{' '});
string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); 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); UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
lock (m_returns) lock (m_returns)
{ {
EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); EventManager.TriggerOnBackup(SimulationDataService, forced);
m_backingup = false; m_backingup = false;
foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (group != null) if (group != null)
{ {
group.ProcessBackup(m_storageManager.DataStore, true); group.ProcessBackup(SimulationDataService, true);
} }
} }
@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void SaveTerrain() public void SaveTerrain()
{ {
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
public void StoreWindlightProfile(RegionLightShareData wl) public void StoreWindlightProfile(RegionLightShareData wl)
{ {
m_regInfo.WindlightSettings = wl; m_regInfo.WindlightSettings = wl;
wl.Save(); SimulationDataService.StoreRegionWindlightSettings(wl);
m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
public void LoadWindlightProfile() public void LoadWindlightProfile()
{ {
m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
m_eventManager.TriggerOnSaveNewWindlightProfile(); m_eventManager.TriggerOnSaveNewWindlightProfile();
} }
@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
{ {
try try
{ {
double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
if (map == null) if (map == null)
{ {
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
Heightmap = new TerrainChannel(); Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
else else
{ {
@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Heightmap = new TerrainChannel(); Heightmap = new TerrainChannel();
m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
} }
} }
catch (Exception e) catch (Exception e)
@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
public void loadAllLandObjectsFromStorage(UUID regionID) public void loadAllLandObjectsFromStorage(UUID regionID)
{ {
m_log.Info("[SCENE]: Loading land objects from storage"); 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) if (LandChannel != null)
{ {
@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
LoadingPrims = true; LoadingPrims = true;
m_log.Info("[SCENE]: Loading objects from datastore"); 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"); 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>(); List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
lock (Entities) lock (Entities)
{ {
ICollection<EntityBase> entities = new List<EntityBase>(Entities); EntityBase[] entities = Entities.GetEntities();
foreach (EntityBase e in entities) foreach (EntityBase e in entities)
{ {
if (e is SceneObjectGroup) if (e is SceneObjectGroup)
@ -2191,7 +2208,7 @@ namespace OpenSim.Region.Framework.Scenes
// to the DB. // to the DB.
ForceSceneObjectBackup(so); ForceSceneObjectBackup(so);
so.DetachFromBackup(); 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. // We need to keep track of this state in case this group is still queued for further backup.
@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
#region Other Methods #region Other Methods
protected override IConfigSource GetConfig()
{
return m_config;
}
#endregion #endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 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> /// </summary>
public void ForceClientUpdate() public void ForceClientUpdate()
{ {
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
/// will not affect the original list of objects in the scene. /// will not affect the original list of objects in the scene.
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public List<EntityBase> GetEntities() public EntityBase[] GetEntities()
{ {
return m_sceneGraph.GetEntities(); return m_sceneGraph.GetEntities();
} }
@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
public void CleanTempObjects() public void CleanTempObjects()
{ {
List<EntityBase> objs = GetEntities(); EntityBase[] entities = GetEntities();
foreach (EntityBase obj in entities)
foreach (EntityBase obj in objs)
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
public void DeleteFromStorage(UUID uuid) public void DeleteFromStorage(UUID uuid)
{ {
m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
} }
public int GetHealth() public int GetHealth()
@ -4963,18 +4982,22 @@ namespace OpenSim.Region.Framework.Scenes
public List<UUID> GetEstateRegions(int estateID) public List<UUID> GetEstateRegions(int estateID)
{ {
if (m_storageManager.EstateDataStore == null) IEstateDataService estateDataService = EstateDataService;
return new List<UUID>(); if (estateDataService == null)
return new List<UUID>(0);
return m_storageManager.EstateDataStore.GetRegions(estateID); return estateDataService.GetRegions(estateID);
} }
public void ReloadEstateData() public void ReloadEstateData()
{ {
m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); IEstateDataService estateDataService = EstateDataService;
if (estateDataService != null)
{
m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
TriggerEstateSunUpdate(); TriggerEstateSunUpdate();
} }
}
public void 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 Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
protected List<ScenePresence> m_scenePresenceArray = new List<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 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 internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
protected RegionInfo m_regInfo; protected RegionInfo m_regInfo;
@ -370,25 +367,17 @@ namespace OpenSim.Region.Framework.Scenes
if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
return false; return false;
lock (sceneObject)
{
if (Entities.ContainsKey(sceneObject.UUID)) if (Entities.ContainsKey(sceneObject.UUID))
{
// 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; return false;
}
// m_log.DebugFormat(
// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
List<SceneObjectPart> children;
lock (sceneObject.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 (m_parentScene.m_clampPrimSize)
{ {
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in children)
{ {
Vector3 scale = part.Shape.Scale; Vector3 scale = part.Shape.Scale;
@ -402,9 +391,7 @@ namespace OpenSim.Region.Framework.Scenes
part.Shape.Scale = scale; part.Shape.Scale = scale;
} }
} }
m_numPrim += children.Count;
m_numPrim += sceneObject.Children.Count;
}
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
@ -422,17 +409,16 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullID)
{ {
SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in children)
SceneObjectGroupsByFullID[part.UUID] = sceneObject; SceneObjectGroupsByFullID[part.UUID] = sceneObject;
} }
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalID)
{ {
SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
foreach (SceneObjectPart part in sceneObject.Children.Values) foreach (SceneObjectPart part in children)
SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
} }
}
return true; return true;
} }
@ -443,9 +429,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>true if the object was deleted, false if there was no object to delete</returns> /// <returns>true if the object was deleted, false if there was no object to delete</returns>
public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
{ {
if (Entities.ContainsKey(uuid)) EntityBase entity;
{ if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; return false;
SceneObjectGroup grp = (SceneObjectGroup)entity;
if (!resultOfObjectLinked) if (!resultOfObjectLinked)
{ {
@ -464,6 +452,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByFullID.Remove(part.UUID); SceneObjectGroupsByFullID.Remove(part.UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
} }
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalID)
{ {
foreach (SceneObjectPart part in grp.Children.Values) foreach (SceneObjectPart part in grp.Children.Values)
@ -471,14 +460,7 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
} }
Entities.Remove(uuid); return Entities.Remove(uuid);
//SceneObjectGroup part;
//((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
return true;
}
return false;
} }
/// <summary> /// <summary>
@ -490,10 +472,8 @@ namespace OpenSim.Region.Framework.Scenes
protected internal void AddToUpdateList(SceneObjectGroup obj) protected internal void AddToUpdateList(SceneObjectGroup obj)
{ {
lock (m_updateList) lock (m_updateList)
{
m_updateList[obj.UUID] = obj; m_updateList[obj.UUID] = obj;
} }
}
public void FireAttachToBackup(SceneObjectGroup obj) public void FireAttachToBackup(SceneObjectGroup obj)
{ {
@ -526,7 +506,8 @@ namespace OpenSim.Region.Framework.Scenes
{ {
if (!Monitor.TryEnter(m_updateLock)) if (!Monitor.TryEnter(m_updateLock))
return; return;
try
{
List<SceneObjectGroup> updates; List<SceneObjectGroup> updates;
// Some updates add more updates to the updateList. // Some updates add more updates to the updateList.
@ -553,8 +534,12 @@ namespace OpenSim.Region.Framework.Scenes
"[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
} }
} }
}
finally
{
Monitor.Exit(m_updateLock); Monitor.Exit(m_updateLock);
} }
}
protected internal void AddPhysicalPrim(int number) 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> /// <returns>null if no scene object group containing that prim is found</returns>
public SceneObjectGroup GetGroupByPrim(uint localID) public SceneObjectGroup GetGroupByPrim(uint localID)
{ {
if (Entities.ContainsKey(localID)) EntityBase entity;
return Entities[localID] as SceneObjectGroup; if (Entities.TryGetValue(localID, out entity))
return entity as SceneObjectGroup;
//m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByLocalID) lock (SceneObjectGroupsByLocalID)
{ SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog))
if (sog != null)
{ {
if (sog.HasChildPrim(localID)) if (sog.HasChildPrim(localID))
return sog; return sog;
SceneObjectGroupsByLocalID.Remove(localID); SceneObjectGroupsByLocalID.Remove(localID);
} }
}
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in entityList)
{ {
//m_log.DebugFormat("Looking at entity {0}", ent.UUID); //m_log.DebugFormat("Looking at entity {0}", ent.UUID);
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(localID))
{ {
sog = (SceneObjectGroup)ent; sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByLocalID) if (sog.HasChildPrim(localID))
{ {
lock (SceneObjectGroupsByLocalID)
SceneObjectGroupsByLocalID[localID] = sog; SceneObjectGroupsByLocalID[localID] = sog;
}
return sog; return sog;
} }
} }
} }
return null; return null;
} }
@ -964,8 +949,9 @@ namespace OpenSim.Region.Framework.Scenes
{ {
SceneObjectGroup sog; SceneObjectGroup sog;
lock (SceneObjectGroupsByFullID) lock (SceneObjectGroupsByFullID)
{ SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog))
if (sog != null)
{ {
lock (sog.Children) lock (sog.Children)
{ {
@ -973,27 +959,25 @@ namespace OpenSim.Region.Framework.Scenes
return sog; return sog;
} }
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID); SceneObjectGroupsByFullID.Remove(fullID);
} }
}
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in entityList)
foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{
if (((SceneObjectGroup)ent).HasChildPrim(fullID))
{ {
sog = (SceneObjectGroup)ent; sog = (SceneObjectGroup)ent;
lock (SceneObjectGroupsByFullID) if (sog.HasChildPrim(fullID))
{ {
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID[fullID] = sog; SceneObjectGroupsByFullID[fullID] = sog;
}
return sog; return sog;
} }
} }
} }
return null; return null;
} }
@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes
// Primitive Ray Tracing // Primitive Ray Tracing
float closestDistance = 280f; float closestDistance = 280f;
EntityIntersection result = new EntityIntersection(); EntityIntersection result = new EntityIntersection();
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns>null if the part was not found</returns> /// <returns>null if the part was not found</returns>
protected internal SceneObjectPart GetSceneObjectPart(string name) protected internal SceneObjectPart GetSceneObjectPart(string name)
{ {
List<EntityBase> EntityList = GetEntities(); SceneObjectPart sop = null;
// FIXME: use a dictionary here Entities.Find(
foreach (EntityBase ent in EntityList) delegate(EntityBase entity)
{ {
if (ent is SceneObjectGroup) if (entity is SceneObjectGroup)
{ {
foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
{ {
if (p.Name == name) if (p.Name == name)
{ {
return p; sop = p;
return true;
} }
} }
} }
return false;
} }
return null; );
return sop;
} }
/// <summary> /// <summary>
@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
/// it /// it
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
protected internal List<EntityBase> GetEntities() protected internal EntityBase[] GetEntities()
{ {
return Entities.GetEntities(); return Entities.GetEntities();
} }
@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
List<EntityBase> EntityList = GetEntities(); EntityBase[] EntityList = GetEntities();
int limit = 0; int limit = 0;
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in EntityList)
{ {
@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="action"></param> /// <param name="action"></param>
protected internal void ForEachSOG(Action<SceneObjectGroup> action) protected internal void ForEachSOG(Action<SceneObjectGroup> action)
{ {
List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>(); EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
foreach (EntityBase ent in objlist) foreach (EntityBase ent in objlist)
{ {
SceneObjectGroup obj = (SceneObjectGroup)ent; SceneObjectGroup obj = (SceneObjectGroup)ent;
@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes
UUID objid = UUID.Zero; UUID objid = UUID.Zero;
SceneObjectPart obj = null; SceneObjectPart obj = null;
List<EntityBase> EntityList = GetEntities(); EntityBase[] entityList = GetEntities();
foreach (EntityBase ent in EntityList) foreach (EntityBase ent in entityList)
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {

View File

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

View File

@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
public UUID UUID public UUID UUID
{ {
get { return m_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 public uint LocalId
@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random(); UUID = UUID.Random();
LinkNum = linkNum; LinkNum = linkNum;
LocalId = 0; LocalId = 0;
Inventory.ResetInventoryIDs();
} }
/// <summary> /// <summary>

View File

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

View File

@ -75,7 +75,8 @@ namespace OpenSim.Region.Framework.Scenes
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) if (e != null && e is SceneObjectGroup)
m_pendingObjects.Enqueue((SceneObjectGroup)e); m_pendingObjects.Enqueue((SceneObjectGroup)e);

View File

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

View File

@ -292,7 +292,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// scene backup thread. // scene backup thread.
scene.Backup(true); 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.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); 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); SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
scene.DeleteSceneObject(groupToDelete, 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.Count, Is.EqualTo(1));
Assert.That(storedObjects[0].Children.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) 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 ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
AssetBase ncAsset 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() private void IRC_SendNamesReply()
{ {
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users) foreach (EntityBase user in users)
{ {
SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
private void IRC_SendWhoReply() private void IRC_SendWhoReply()
{ {
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
foreach (EntityBase user in users) foreach (EntityBase user in users)
{ {
/*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, /*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() private void IRC_SendReplyUsers()
{ {
List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
SendServerCommand("392 :UserID Terminal Host"); SendServerCommand("392 :UserID Terminal Host");
if (users.Count == 0) if (users.Length == 0)
{ {
SendServerCommand("395 :Nobody logged in"); SendServerCommand("395 :Nobody logged in");
return; return;

View File

@ -1353,16 +1353,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
// Check if this is an update or a request // Check if this is an update or a request
if (requestArgs["RequestMethod"] == "RemoveGeneric" if (requestArgs["RequestMethod"] == "RemoveGeneric"
|| requestArgs["RequestMethod"] == "AddGeneric" || requestArgs["RequestMethod"] == "AddGeneric")
)
{ {
// Any and all updates cause the cache to clear // Any and all updates cause the cache to clear
m_memoryCache.Clear(); m_memoryCache.Clear();
// Send update to server, return the response without caching it // Send update to server, return the response without caching it
return WebUtil.PostToService(m_groupsServerURI, requestArgs); return WebUtil.PostToService(m_groupsServerURI, requestArgs);
} }
// If we're not doing an update, we must be requesting data // If we're not doing an update, we must be requesting data

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 // 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(); System.Collections.ArrayList missingList = new System.Collections.ArrayList();
SceneObjectGroup temp = null; SceneObjectGroup temp = null;

View File

@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary> /// </summary>
public void FindDifferences() 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; DiffersFromSceneGroup = false;
// if group is not contained in scene's list // if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) 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 Scene m_scene;
private readonly IEnumerator<EntityBase> m_sogEnum; private readonly IEnumerator<EntityBase> m_sogEnum;
private readonly ISecurityCredential m_security; private readonly ISecurityCredential m_security;
private readonly List<EntityBase> m_entities;
public IObjEnum(Scene scene, ISecurityCredential security) public IObjEnum(Scene scene, ISecurityCredential security)
{ {
m_scene = scene; m_scene = scene;
m_security = security; 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() public void Dispose()

View File

@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
{ {
get get
{ {
List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
IAvatar[] rets = new IAvatar[ents.Count]; 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]; EntityBase ent = ents[i];
rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); 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>(); m_copse = new List<Copse>();
List<EntityBase> objs = m_scene.GetEntities(); EntityBase[] objs = m_scene.GetEntities();
foreach (EntityBase obj in objs) foreach (EntityBase obj in objs)
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)

View File

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

View File

@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
} }
else else
{ {
Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); Entities = new List<EntityBase>(m_CmdManager.m_ScriptEngine.World.GetEntities());
} }
SceneObjectPart SensePoint = ts.host; SceneObjectPart SensePoint = ts.host;

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

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;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
public void OnMakeRootAgent(ScenePresence sp) public void OnMakeRootAgent(ScenePresence sp)
{ {
m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
Util.FireAndForget(delegate(object o)
{
m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
});
} }
public void OnNewClient(IClientAPI client) public void OnNewClient(IClientAPI client)
@ -106,8 +107,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
} }
void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
{
// 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); 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); CommonInit(source);
} }
public SimianAssetServiceConnector(string url)
{
m_serverUrl = url;
}
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig moduleConfig = source.Configs["Modules"]; IConfig moduleConfig = source.Configs["Modules"];
@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
public AssetBase Get(string id) public AssetBase Get(string id)
{ {
if (String.IsNullOrEmpty(m_serverUrl))
{
m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
throw new InvalidOperationException();
}
// Cache fetch // Cache fetch
if (m_cache != null) if (m_cache != null)
{ {
@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns> /// <returns></returns>
public AssetMetadata GetMetadata(string id) 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; AssetMetadata metadata = null;
// Cache fetch // Cache fetch
@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns>True if the id was parseable, false otherwise</returns> /// <returns>True if the id was parseable, false otherwise</returns>
public bool Get(string id, Object sender, AssetRetrieved handler) 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 // Cache fetch
if (m_cache != null) if (m_cache != null)
{ {
@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns> /// <returns></returns>
public string Store(AssetBase asset) 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; bool storedInCache = false;
string errorMessage = null; string errorMessage = null;
@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
/// <returns></returns> /// <returns></returns>
public bool Delete(string id) 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 errorMessage = String.Empty;
string url = m_serverUrl + id; string url = m_serverUrl + id;

View File

@ -28,8 +28,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Addins; using Mono.Addins;
@ -37,7 +35,6 @@ using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;

View File

@ -30,13 +30,10 @@ using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Addins;
using Nini.Config; using Nini.Config;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;

View File

@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Server.Base;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
namespace OpenSim.Services.Connectors.SimianGrid namespace OpenSim.Services.Connectors.SimianGrid
@ -91,6 +90,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
CommonInit(source); CommonInit(source);
} }
public SimianInventoryServiceConnector(string url)
{
m_serverUrl = url;
}
public void Initialise(IConfigSource source) public void Initialise(IConfigSource source)
{ {
IConfig moduleConfig = source.Configs["Modules"]; IConfig moduleConfig = source.Configs["Modules"];

View File

@ -28,17 +28,14 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.Net;
using System.Reflection; using System.Reflection;
using log4net; using log4net;
using Mono.Addins; using Mono.Addins;
using Nini.Config; using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces; using OpenSim.Services.Interfaces;
using OpenSim.Server.Base;
using OpenMetaverse; using OpenMetaverse;
using OpenMetaverse.StructuredData; using OpenMetaverse.StructuredData;
@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
return null; return null;
} }
// private OSDMap GetSessionData(UUID sessionID)
// {
// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
//
// NameValueCollection requestArgs = new NameValueCollection
// {
// { "RequestMethod", "GetSession" },
// { "SessionID", sessionID.ToString() }
// };
//
// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
// if (response["Success"].AsBoolean())
// return response;
// else
// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
//
// return null;
// }
private List<PresenceInfo> GetSessions(UUID userID) private List<PresenceInfo> GetSessions(UUID userID)
{ {
List<PresenceInfo> presences = new List<PresenceInfo>(1); List<PresenceInfo> presences = new List<PresenceInfo>(1);
@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
return success; return success;
} }
///// <summary>
///// Fetch the last known avatar location with GetSession and persist it
///// as user data with AddUserData
///// </summary>
//private bool SetLastLocation(UUID sessionID)
//{
// NameValueCollection requestArgs = new NameValueCollection
// {
// { "RequestMethod", "GetSession" },
// { "SessionID", sessionID.ToString() }
// };
// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
// bool success = response["Success"].AsBoolean();
// if (success)
// {
// UUID userID = response["UserID"].AsUUID();
// UUID sceneID = response["SceneID"].AsUUID();
// Vector3 position = response["ScenePosition"].AsVector3();
// Vector3 lookAt = response["SceneLookAt"].AsVector3();
// return SetLastLocation(userID, sceneID, position, lookAt);
// }
// else
// {
// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
// " while saving last location: " + response["Message"].AsString());
// }
// return success;
//}
private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse)
{ {
if (sessionResponse == null) if (sessionResponse == null)

View File

@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
// Check if the user is online // Check if the user is online
if (client.Scene is Scene) if (client.Scene is Scene)
{ {
OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
if (presences != null && presences.Length > 0) if (presence != null)
flags |= ProfileFlags.Online; flags |= ProfileFlags.Online;
} }

View File

@ -28,7 +28,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.IO;
using System.Reflection; using System.Reflection;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
{ {
private const double CACHE_EXPIRATION_SECONDS = 120.0;
private static readonly ILog m_log = private static readonly ILog m_log =
LogManager.GetLogger( LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType); MethodBase.GetCurrentMethod().DeclaringType);
private string m_serverUrl = String.Empty; private string m_serverUrl = String.Empty;
private ExpiringCache<UUID, UserAccount> m_accountCache; private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
private bool m_Enabled = false; private bool m_Enabled;
#region ISharedRegionModule #region ISharedRegionModule
@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
{ "UserID", userID.ToString() } { "UserID", userID.ToString() }
}; };
return GetUser(requestArgs); account = GetUser(requestArgs);
if (account == null)
{
// Store null responses too, to avoid repeated lookups for missing accounts
m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
}
return account;
} }
public List<UserAccount> GetUserAccounts(UUID scopeID, string query) public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
if (success) if (success)
{ {
// Cache the user account info // Cache the user account info
m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
} }
else else
{ {
@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
// Cache the user account info // Cache the user account info
m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
return account; return account;
} }

View File

@ -0,0 +1,112 @@
/*
* 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 log4net;
using Mono.Addins;
using Nini.Config;
using System.Reflection;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Services.Connectors
{
public class EstateDataService : ServiceBase, IEstateDataService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected IEstateDataStore m_database;
public EstateDataService(IConfigSource config)
: base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
// Try reading the [DatabaseService] section, if it exists
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
dllName = dbConfig.GetString("StorageProvider", String.Empty);
connString = dbConfig.GetString("EstateConnectionString", String.Empty);
if (String.IsNullOrEmpty(connString))
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
// We tried, but this doesn't exist. We can't proceed
if (dllName == String.Empty)
throw new Exception("No StorageProvider configured");
m_database = LoadPlugin<IEstateDataStore>(dllName, new Object[] { connString });
if (m_database == null)
throw new Exception("Could not find a storage interface in the given module");
}
public EstateSettings LoadEstateSettings(UUID regionID, bool create)
{
return m_database.LoadEstateSettings(regionID, create);
}
public EstateSettings LoadEstateSettings(int estateID)
{
return m_database.LoadEstateSettings(estateID);
}
public void StoreEstateSettings(EstateSettings es)
{
m_database.StoreEstateSettings(es);
}
public List<int> GetEstates(string search)
{
return m_database.GetEstates(search);
}
public bool LinkRegion(UUID regionID, int estateID)
{
return m_database.LinkRegion(regionID, estateID);
}
public List<UUID> GetRegions(int estateID)
{
return m_database.GetRegions(estateID);
}
public bool DeleteEstate(int estateID)
{
return m_database.DeleteEstate(estateID);
}
}
}

View File

@ -0,0 +1,140 @@
/*
* 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 log4net;
using Mono.Addins;
using Nini.Config;
using System.Reflection;
using OpenSim.Services.Base;
using OpenSim.Services.Interfaces;
using OpenSim.Data;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Services.Connectors
{
public class SimulationDataService : ServiceBase, ISimulationDataService
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected ISimulationDataStore m_database;
public SimulationDataService(IConfigSource config)
: base(config)
{
string dllName = String.Empty;
string connString = String.Empty;
// Try reading the [DatabaseService] section, if it exists
IConfig dbConfig = config.Configs["DatabaseService"];
if (dbConfig != null)
{
dllName = dbConfig.GetString("StorageProvider", String.Empty);
connString = dbConfig.GetString("ConnectionString", String.Empty);
}
// We tried, but this doesn't exist. We can't proceed
if (dllName == String.Empty)
throw new Exception("No StorageProvider configured");
m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString });
if (m_database == null)
throw new Exception("Could not find a storage interface in the given module");
}
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{
m_database.StoreObject(obj, regionUUID);
}
public void RemoveObject(UUID uuid, UUID regionUUID)
{
m_database.RemoveObject(uuid, regionUUID);
}
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{
m_database.StorePrimInventory(primID, items);
}
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
{
return m_database.LoadObjects(regionUUID);
}
public void StoreTerrain(double[,] terrain, UUID regionID)
{
m_database.StoreTerrain(terrain, regionID);
}
public double[,] LoadTerrain(UUID regionID)
{
return m_database.LoadTerrain(regionID);
}
public void StoreLandObject(ILandObject Parcel)
{
m_database.StoreLandObject(Parcel);
}
public void RemoveLandObject(UUID globalID)
{
m_database.RemoveLandObject(globalID);
}
public List<LandData> LoadLandObjects(UUID regionUUID)
{
return m_database.LoadLandObjects(regionUUID);
}
public void StoreRegionSettings(RegionSettings rs)
{
m_database.StoreRegionSettings(rs);
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return m_database.LoadRegionSettings(regionUUID);
}
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
return m_database.LoadRegionWindlightSettings(regionUUID);
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
m_database.StoreRegionWindlightSettings(wl);
}
}
}

View File

@ -297,12 +297,14 @@ namespace OpenSim.Services.UserAccountService
string password; string password;
string email; string email;
List<char> excluded = new List<char>(new char[]{' '});
if (cmdparams.Length < 3) if (cmdparams.Length < 3)
firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
else firstName = cmdparams[2]; else firstName = cmdparams[2];
if (cmdparams.Length < 4) if (cmdparams.Length < 4)
lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
else lastName = cmdparams[3]; else lastName = cmdparams[3];
if (cmdparams.Length < 5) if (cmdparams.Length < 5)

View File

@ -35,11 +35,86 @@ using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Data.Null namespace OpenSim.Data.Null
{ {
public class NullDataService : ISimulationDataService
{
private NullDataStore m_store;
public NullDataService()
{
m_store = new NullDataStore();
}
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{
m_store.StoreObject(obj, regionUUID);
}
public void RemoveObject(UUID uuid, UUID regionUUID)
{
m_store.RemoveObject(uuid, regionUUID);
}
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{
m_store.StorePrimInventory(primID, items);
}
public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
{
return m_store.LoadObjects(regionUUID);
}
public void StoreTerrain(double[,] terrain, UUID regionID)
{
m_store.StoreTerrain(terrain, regionID);
}
public double[,] LoadTerrain(UUID regionID)
{
return m_store.LoadTerrain(regionID);
}
public void StoreLandObject(ILandObject Parcel)
{
m_store.StoreLandObject(Parcel);
}
public void RemoveLandObject(UUID globalID)
{
m_store.RemoveLandObject(globalID);
}
public List<LandData> LoadLandObjects(UUID regionUUID)
{
return m_store.LoadLandObjects(regionUUID);
}
public void StoreRegionSettings(RegionSettings rs)
{
m_store.StoreRegionSettings(rs);
}
public RegionSettings LoadRegionSettings(UUID regionUUID)
{
return m_store.LoadRegionSettings(regionUUID);
}
public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
{
return m_store.LoadRegionWindlightSettings(regionUUID);
}
public void StoreRegionWindlightSettings(RegionLightShareData wl)
{
m_store.StoreRegionWindlightSettings(wl);
}
}
/// <summary> /// <summary>
/// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
/// tests can check correct persistence. /// tests can check correct persistence.
/// </summary> /// </summary>
public class NullDataStore : IRegionDataStore public class NullDataStore : ISimulationDataStore
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -114,7 +189,6 @@ namespace OpenSim.Data.Null
} }
} }
// see IRegionDatastore
public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
{ {
m_primItems[primID] = items; m_primItems[primID] = items;

View File

@ -31,6 +31,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Region.Framework; using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Tests.Common.Mock namespace OpenSim.Tests.Common.Mock
@ -39,19 +40,14 @@ namespace OpenSim.Tests.Common.Mock
{ {
public TestScene( public TestScene(
RegionInfo regInfo, AgentCircuitManager authen, RegionInfo regInfo, AgentCircuitManager authen,
SceneCommunicationService sceneGridService, StorageManager storeManager, SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
: base(regInfo, authen, sceneGridService, storeManager, moduleLoader, : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader,
dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
{ {
} }
/// <summary>
/// Allow retrieval for test check purposes
/// </summary>
public StorageManager StorageManager { get { return m_storageManager; } }
/// <summary> /// <summary>
/// Temporarily override session authentication for tests (namely teleport). /// Temporarily override session authentication for tests (namely teleport).
/// </summary> /// </summary>

View File

@ -157,11 +157,12 @@ namespace OpenSim.Tests.Common.Setup
AgentCircuitManager acm = new AgentCircuitManager(); AgentCircuitManager acm = new AgentCircuitManager();
SceneCommunicationService scs = new SceneCommunicationService(); SceneCommunicationService scs = new SceneCommunicationService();
StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", ""); ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
IEstateDataService estateDataService = null;
IConfigSource configSource = new IniConfigSource(); IConfigSource configSource = new IniConfigSource();
TestScene testScene = new TestScene( TestScene testScene = new TestScene(
regInfo, acm, scs, sm, null, false, false, false, configSource, null); regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);
INonSharedRegionModule capsModule = new CapabilitiesModule(); INonSharedRegionModule capsModule = new CapabilitiesModule();
capsModule.Initialise(new IniConfigSource()); capsModule.Initialise(new IniConfigSource());
@ -559,5 +560,4 @@ namespace OpenSim.Tests.Common.Setup
sogd.InventoryDeQueueAndDelete(); sogd.InventoryDeQueueAndDelete();
} }
} }
} }

10
Prebuild/AUTHORS Normal file
View File

@ -0,0 +1,10 @@
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
Patch Contributers
lbsa71
chi11ken
sdague

65
Prebuild/COPYING Normal file
View File

@ -0,0 +1,65 @@
BSD License
Copyright (c)2004-2008
See AUTHORS file for list of copyright holders
Dave Hudson (jendave@yahoo.com),
Matthew Holmes (matthew@wildfiregames.com)
Dan Moorehead (dan05a@gmail.com)
Rob Loach (http://www.robloach.net)
C.J. Adams-Collier (cjac@colliertech.org)
http://dnpb.sourceforge.net
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. 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.
3. The names of the authors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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
COPYRIGHT OWNER OR 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.
---
Portions of src/Core/Targets/AutotoolsTarget.cs
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

461
Prebuild/ChangeLog Normal file
View File

@ -0,0 +1,461 @@
2008-12-09T02:15 D. Moonfire <d.moonfire@mfgames.com>
* src/Core/Kernel.cs
- Added a /ppi target to get the results of processing but before
processing the actual results.
* src/Core/Preprocessor.cs
- Applied the patch from kanato with formatting changes.
- Uses the <?include file="" ?> format.
* tests/
- Added some lightweight tests to test the functionality of the
include patch.
2008-06-19T09:37 John Anderson <sontek@gmail.com>
* src/Core/Kernel.cs
- Only Loop through targets that are not abstract.
* src/Core/Targets/VSGenericTarget.cs
- Marked abstract and removed the Target attribute.
2008-06-16T17:37 John Anderson <sontek@gmail.com>
* src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd
- Added the ability to hardcode guid's in the projects
2008-05-21T0737 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- catch exception when unable to compile AssemblyInfo.cs
2008-05-07T17:29 John Anderson <sontek@gmail.com>
* src/Core/Targets/VSGenericTarget.cs
- Generate asp.net output in bin\ folder (asp.net requires it there)
2008-04-30T17:29 John Anderson <sontek@gmail.com>
* src/Core/Nodes/DatabaseReferenceNode.cs,
src/Core/Nodes/Datanode.cs,
src/Core/Nodes/FileNode.cs,
src/Core/Nodes/FileNodes.cs,
src/Core/Nodes/MatchNode.cs,
src/Core/Targets/VS2008Target.cs,
src/data/prebuild-1.7.xsd
- Refactored the project generation code to handle web projects and more
logically handle embedded resources and designer files.
2008-04-30T17:29 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Nodes/SolutionNode.cs
- Had solutions inherit Configurations in the same way that Projects do.
2008-04-29T06:35 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs,
src/Core/Nodes/DatabaseProjectNode.cs,
src/Core/Nodes/DatabaseReferenceNode.cs,
src/data/prebuild-1.7.xsd
- Added database references to database projects.
- Prevented nested solutions from being written to disk.
2008-04-29T05:43 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/Targets/VS2008Target.cs
- Enabled embedded solutions to contain Files.
2008-04-29T04:13 Joseph Lombrozo <digitaljeebus@gmail.com>
* src/Core/VSVersion.cs
- Fixed spelling mistake in enum comment.
* src/Core/Attributes/DataNodeAttribute.cs
- Allowed the DataNodeAttribute to be attached to a single class
more than once, allowing one class to be used to parse more than
one node at a time.
* src/Core/Kernel.cs
- Changed CacheNodeTypes() to allow for multiple DataNodeAttribute
instances in one class. Refactored ProcessFile(...) to return Solutions,
rather than adding them to the Kernel.
* src/Core/Nodes/SolutionNode.cs
- Added Guid (for embedded folders)
- Added DatabaseProjects, Solutions and Processes to the SolutionNode
when parsing.
* src/Core/Nodes/ProjectNode.cs
- Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation.
* src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd
- Added ability to have embedded solutions, and externally referenced
prebuild scripts.
2008-04-24T04:33 John M. Anderson <sontek@gmail.com>
* src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs
- Moved the VSVersion enum into its own file.
* src/Core/Targets/VS2008Target.cs
- added support for VS2008
* src/Core/Nodes/ProjectNode.cs
- Added initial support for ASP.NET projects
* src/Core/Nodes/DatabaseProjectNode.cs
- Added support for Visual Studio database projects
2008-02-19T07:08 C.J. Adams-Collier <cjac@colliertech.org>
* TODO
- added some tasks from Sam Hocevar
* src/Core/Targets/AutotoolsTarget.cs
- added a missing end paren
* COPYING
- Removed Randy Ridge's name from the copyright. Looks to me like
his name was present only because the file was nabbed from Tao
2008-02-09T20:29 C.J. Adams-Collier <cjac@colliertech.org>
* COPYING
- added MIT/X11 license due to inclusion of code from Monodevelop
* THANKS
- added Lluis Sanchez Gual and Todd Berman - I yoinked code from
their pkg-config .pc file parser to build AutotoolsTarget.cs.
Sorry it took me so long to remember to add mention of you guys!
* src/Core/Targets/AutotoolsTarget.cs
- added MIT/X11 license. see above.
2008-02-07T08:27 C.J. Adams-Collier <cjac@colliertech.org>
* AUTHORS
- consolidated names and contact info found laying around the
source
* src/Core/Kernel.cs
- updated copyright date
- re-formatted license for 80-column editor
- updated log banner to indicate new date, new authors
* src/Core/Targets/AutotoolsTarget.cs
- clarified reasoning behind use of constants in
AutotoolsTarget.ParsePCFile
- reduced length of some long lines using newline/indent
- added log messages for parsing .pc files, emitting solutions,
projects
- robustified the inter-package dependency resolution target
- log warning when we can't find assembly for <Reference />
- clarified code for case of inability to find embedded
autotools.xml
* src/data/autotools.xml
- adding system lookup of resgen2 to configure.ac
- fixed .resource -> .resources typo
- added a rule to create <foo>.response file containing all sources
- using @<foo>.response on $(CSC) command line instead of listing
all source files
* src/Properties/AssemblyInfo.cs
- re-formatted license for an 80-column editor
- added more authors to the AssemblyCopyright attribute
- bumped version to 2.0.3
* prebuild.xml
- bumped version to 2.0.3
* scripts/autotools.sh
- if 'mono' is in the path, run Prebuild.exe with it
- using dirname to capture correct path to prebuild.xml &c
2008-02-06T17:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/NAntTarget.cs
- re-formatted the license for an 80-column editor
- added myself to the copyright
- added a fix submitted by Gryc Ueusp <gryc.ueusp@gmail.com>
* src/Core/Targets/AutotoolsTarget.cs
- updated copyright to include 2008
* THANKS
- created file, added Gryc Ueusp <gryc.ueusp@gmail.com>
2008-01-01T14:50 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- fixed .resx -> .resource compilation
- fixed failing edge case where Project is an unsigned Library
- added $(RESOURCE_SRC) to list of extra dist files
* src/Core/Targets/AutotoolsTarget.cs
- removed embeddedResources from extraDistFiles list
2007-04-18T07:49 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/prebuild-1.7.xsd
- removed default version from references
2007-04-06T12:42 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
- added support for /doc: output when XmlDocFile is not empty
- not printing \t \\n on lines that have no content
- gacutil now installs the root assembly instead of the one under
bin/Debug or whatever
2007-04-04T22:12 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- removed debugging Console.WriteLine()
* src/data/autotools.xml
- ensuring that install-sh and missing get distributed
- explicitly stating that the sources, snk, resources and binary
references live under $(srcdir)
- corrected uninstall target
- verified distcheck completes successfully
2007-04-03T21:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- added a using for System.Diagnostics
- added enum ClrVersion for use with the pkg-config parser
- added class SystemPackage for use with the pkg-config parser
- removed explicit "private" property of members since it is implied
- flushing the stream-writer before it's closed
- removed excess braces around an if statement
! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(),
GetAssembliesWithoutLibInfo(), ProcessPiece(),
GetVariableFromPkgConfig(), ParsePCFile(),
RegisterSystemAssemblies(), RunInitialization()
- pulled the above from MonoDevelop to parse the system pkgconfig
files and determine /pkg: arguments. Original sources are here:
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs
! WriteProject()
- now gathering project version from AssemblyInfo.cs if it is part
of the project
- changed the declaration of the ArrayList's in the method
- now copying assembly .config files to the project, distributing,
installing
- making sure all needed files live under the Project directory
- copying strongname keys to project directory
- parsing AssemblyInfo.cs to determine assembly version
- removing all references to ".."
- removed superfluous if(project.References.Count > 0) around
for(int refNum = 0; refNum < project.References.Count; refNum++)
- removed use of runtimeLibs
- adding hook to copy sibling project's generated assemblies to
this project during Make time
- added extra dist target to ensure all files required to build
get distributed during "make dist"
- added new xslt processing args:
-- assemblyName
-- extraDistFiles
-- pkgLibs (/pkg:foo)
-- localCopyTargets (to copy sibling assemblies at Make time)
-- projectVersion (if determined from AssemblyInfo.cs)
-- hasAssemblyConfig (if there's a assembly.exe.config present)
! Write()
- calling RunInitialization() to gather pkg-config data
* src/data/autotools.xml
- accepting new args passed from AutotoolsTarget.cs
- modernized configure.ac a bit
- using a version of tar that allows >99-char filenames
- added ASSEMBLY_NAME variable
- using assembly name rather than project name for gac installation
- generated assembly is now assembly name and not project name
- accepting /pkg: flags gathered from AutotoolsTarget.cs
- adding Makefile targets to copy sibling project assemblies to .
- fixed Debug, Release targets
- adding support for strongname key signing
- adding /unsafe support
- adding a clean make target
- only running gacutil /u if the assembly being uninstalled is in gac
- added some templates to determine each Configuration's .snk
- added explanation as to why .exe assemblies live in $prefix/lib
* src/Properties/AssemblyInfo.cs
- bumped assembly version
* prebuild.xml
- bumped assembly version
2007-03-29T18:03 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
! WriteProject()
- re-named incorrectly-named variable gacLibs to systemLibs
- added another reference list, runtimeLibs which contains the
libs we will need at runtime. we use this to build a MONO_PATH
- added monoPath to the xslt args list
* src/data/autotools.xml
! <ProjectMakefileAm />
- renamed gacLibs to systemLibs
- added the sources to the dist list
- added logic to install libs that aren't strongnamed
! <ProjectWrapperScriptIn />
- accepting a param to update the MONO_PATH
2007-03-28T19:46 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/MonoDevelopTarget.cs
! CleanProject()
- using Assembly.LoadWithPartialName to locate the assembly
* src/Core/Targets/AutotoolsTarget.cs
! WriteCombine()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
! WriteProject()
- no longer using $PWD to determine a project's source dir; this
doesn't work with <Process /> elements
- passing the solution name to all templates - fixes
multi-solution prebuild systems
- copying strongname key to the autotools directory
- using Assembly.LoadWithPartialName to locate assemblies
* src/data/autotools.xml
! <ProjectConfigureAc />
- fixed the .pc AC_CONFIG_FILES macro
! <ProjectMakefileAm />
- added solution name param
- wrapping if type=exe check around script install macro
- added type=lib check and .pc file install macro
- added support for Configuration-specific builds (Debug, Release, etc)
- added strongname keyfile code
- TODO: support non-strongnamed library installation
! <ProjectWrapperScriptIn />
- added space preservation attribute to stylesheet element
- added a lower-case project name variable
- added solution name param
- made for-each template more specific
! <SolutionAutogenSh />
- added solution name param
! <SolutionConfigureAc />
- added solution name param
! <SolutionMakefileAm />
- added solution name param
! <ProjectPcIn />
- added solution name param
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now processing the wrapper script if type is "Exe" or "WinExe"
* src/data/autotools.xml
! <ProjectConfigureAc />
- being more exact about where text escaping is used
- using the correct variable name for the GACUTIL_FLAGS template
- using correct test="" for the AC_CONFIG_FILES macros
! <ProjectMakefileAm />
- uncommented the bin_SCRIPTS section now that the script is being
generated correctly
! <ProjectWrapperScriptIn />
- fixed whitespace at beginning of file, before #!
- using lower-case packageName to indicate installation location
2007-03-27T09:33 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
* added a lcProjectName which is $projectName lower-cased
* moved autoconf template specifier near AC_OUTPUT
* AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES
* placed AC_CONFIG_FILES() calls for wrapper script or pkg-config
file in xslt project type checks
! <ProjectMakefileAm />
* commented out bin_SCRIPTS
* added a lcProjectName which is $projectName lower-cased
* using $lcProjectName instead of the longer version
2007-03-27T08:39 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectMakefileAm />
- added whitespace-preservation
- added the missing projectName param
- replaced bin_SCRIPTS with something that worked
2007-03-27T07:56 C.J. Adams-Collier <cjac@colliertech.org>
* src/data/autotools.xml
! <ProjectConfigureAc />
- cleaned up duplicate checks
- placed initialization macros above system check macros
- added some more messages about what's going on
- added GACUTIL_FLAGS variable including /package option
! <ProjectMakefileAm />
- added an incomplete bin_SCRIPTS
- RCS check says "building" instead of "compiling"
! <SolutionConfigureAc />
- removed macros that are useful only for projects
! <ProjectWrapperScriptIn />
- created this element on this revision
- this is a wrapper shell script that lives in the $PATH and runs
the CIL assembly
2007-03-26T20:18 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- creating new template arguments to contain the list of libs to
reference: source, binary & GAC
- source libs are included as part of this solution (untested)
- binary libs are distributed with the source (untested)
- GAC libs are assumed to be in the GAC or other lib path (tested)
* src/data/autotools.xml
- created new params through which to accept reference info
- created a working $(CSC) line
- added a TODO item for ordering project dependency for
AC_CONFIG_SUBDIRS code
2007-03-26T08:41 C.J. Adams-Collier <cjac@colliertech.org>
* src/Core/Targets/AutotoolsTarget.cs
- now creating list of source files in managed code and passing
them to the template via <xsl:param>s
* src/data/prebuild-1.7.xsd
- updated the header comment to 2007
* src/data/autotools.xml
! <ProjectConfigureAc>
- copied checks from Solution-level configure.ac
- copied solution-level config status
! <ProjectMakefileAm>
- added <xsl:param> elements for file list to be passed through
- made a temporary target for the assembly we're building
- added this target to the deps of "all:"
! <SolutionConfigureAc>
- changed status header/footer from "- - -" to "==="
2007-03-23T08:33 C.J. Adams-Collier <cjac@colliertech.org>
Added version attribute handling code for Property element
Added description element handling code
* prebuild.xml
- added /Prebuild/Solution/Property/@version attribute
- added /Prebuild/Solution/Property/Description element
* src/Core/Nodes/ProjectNode.cs
- added some docs where they were missing and obvious
- added code to handle @version
* src/Core/Nodes/DescriptionNode.cs
- new file. Used to handle /Prebuild/Solution/Property/Description
* src/Core/Targets/AutotoolsTarget.cs
- added mkdirDashP(), a recursive directory creation method
- WriteProject() now copies the files to autotools/
* src/data/prebuild-1.7.xsd
- added /Prebuild/Solution/Property/Description element
- added /Prebuild/Solution/Property/@version attribute
* src/data/autotools.xml
- removed excess <xsl:value-of select="$projectName"/>
- explicitly using dnpb: prefix
2007-03-23T04:31 C.J. Adams-Collier <cjac@colliertech.org>
Merged code from my stripped-down test
Adding support for the /Prebuild/Solution/Project/Author element
* prebuild.xml
- added Author elements
- cleaned up the really long Project element
* src/Core/Nodes/ProjectNode.cs
- added Author tag processing code
* src/Core/Nodes/AuthorNode.cs
- Created to process Author elements
- based off of ReferencePathNode.cs
* src/Core/Targets/AutotoolsTarget.cs
- merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs
- renamed old WriteCombine to WriteCombineOld
- renamed old WriteProject to WriteProjectOld
* src/data/prebuild-1.7.xsd
- added Author element to Project
* src/data/autotools.xml
- lower-cased utf
2007-03-22T13:58 C.J. Adams-Collier <cjac@colliertech.org>
Exposing an XmlDocument that represents the prebuild.xml file
passed to the program
* src/Core/Kernel.cs
- created an object member called XmlDocument m_CurrentDoc
- created a property to access its value
- using m_CurrentDoc to load up the prebuild.xml file rather than
a local variable called "doc"
2007-03-22 C.J. Adams-Collier <cjac@colliertech.org>
* prebuild.xml
- added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml
* src/data/autotools.xml
- the same
* src/Core/Targets/MonoDevelopTarget.cs
- fixed bug introduced in r206
2007-03-07 C.J. Adams-Collier <cjcollier@colliertech.org>
* src/data/prebuild-1.7.xsd
- added version attribute to Solution and Project elements
2006-11-04T00:38 C.J. Adams-Collier <cjcollier@colliertech.org>
* placing AssemblyInfo.cs into Properties/
* Fixed double-mention of the package name
2006-11-03T15:23 C.J. Adams-Collier <cjcollier@colliertech.org>
* corrected a problem in the Include.am generation code
* created the new .exe
* copied it to the root of the build
2006-11-03T14:57 C.J. Adams-Collier <cjcollier@colliertech.org>
* Updated the .exe file
2006-11-03 C.J. Adams-Collier <cjcollier@colliertech.org>
* Added a TODO file
* Added a ChangeLog file
* applied some fixes for autotools gac and pkg-config installation
problems

236
Prebuild/INSTALL Normal file
View File

@ -0,0 +1,236 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need
`configure.ac' if you want to change it or regenerate `configure' using
a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH'
variable, you have to compile the package for one architecture at a
time in the source code directory. After you have installed the
package for one architecture, use `make distclean' before reconfiguring
for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). Here is a another example:
/bin/bash ./configure CONFIG_SHELL=/bin/bash
Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
configuration-related scripts to be executed by `/bin/bash'.
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

200
Prebuild/NEWS Normal file
View File

@ -0,0 +1,200 @@
Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
Documentation and downloads are available at http://dnpb.sourceforge.net.
Prebuild is licensed under the BSD license.
[ XXXXXXX XX, XXX - 1.3.2 ]
+ Added Keyfile signing to NAnt target and VS2005 target
+ Updated XSD file to 1.7
+ Boo and VisualBasic Language support in VS2005 target
+ Added basic Autotools target. It creates a non-recursive Autotools system.
! Multiple files can be excluded from the Match node
! VS2005 now handles .resx files correctly.
! NAnt and Autotools now handle defines
! NAnt and Autotools now handle resources
+ Conditional XML variables can be passed through the command line.
+ Added /install and /remove command line flags to install and remove assemblies from the GAC
+ Many fixes to VS2005 target
[ July 21, 2006 - 1.3.1 ]
! VS2005 fixes from Rob Loach
! NAnt fixes from Rob Loach and David Hudson
! XML doc fixes from Rob Loach
+ Added SharpDevelop2 target (really just uses VS2005 target)
! Fixed bug with BuildEvents in Monodevelop target
+ Passing /yes will default to answering yes to any warnings
[ February 28, 2006 - 1.3 ]
+ Added MonoDevelop target.
+ Added NAnt target.
+ Lots of fixes to all targets.
* Cleaned up the code using FXCop.
* Updated schema to 1.6 to fix a typo and add a new parameter.
* jendave is now the maintainer of the project. RobLoach has been added as a developer.
* Removed references to 'dnpb'.
+ Added rudimentary support for pre- and post- build scripts
* Updated examples.
[ August 5, 2004 - 1.2 ]
+ Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
+ Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
+ Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
* Modified the removedir command line option to allow for a pipe-delimited list of directory names
! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
+ Added the GenerateXmlDocFile boolean option to the Options XML element
* Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
[ January 3, 2004 - 1.1 ]
! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
+ Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
* Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
[ December 30, 2004 - 1.1 ]
! Applied Leed's fix for SharpDevelop references
+ Rewrote much of the processing for better validation and without the use of a temp file
+ Added support for configurations at the project level which are named All. They now apply changes to all Solution level defined configs
* Changed all spaces into tabs
+ Added support for the None build action
* Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
[ December 25, 2004 - 1.0 ]
+ Added the /removedir option for cleaning directories like obj before file releases
+ Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
* Made path optional for Match elements (defaults to current directory) and updates schema for it
! Fixed XML example in the readme.txt
+ Added example xml files to docs directory
* Updated license.txt to add Dan Moorehead and update copyright years
+ Updated prebuild.xml to take advantage of the default path attribute for match elements
+ Updated Clean to delete the obj directories
[ December 25, 2004 - 0.13 ]
+ Added dnpb.exe so that it can be used to generate the project files
+ Added dnpb.ico
* Added parameterless Write statement to Log for writing a single line
* Changed scehema to version 1.3 for support of icon attribute
* Added support for All configuration name under a Project node signifying common settings for all configurations
! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
* Wrote documentation in docs/readme.txt
* Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
* Updated prebuild.xml
* Optimized Log class
* Updated OutputUsage()
* /clean targets all by default
* No log file is used by default, /log without value specified uses default file name
+ Added support for the /pause which pauses the utility after execution to observe output
[ September 27, 2004 - 0.12.2a ]
! Fixed a nasty bug when trying to delete our temp file for pre-processing.
[ September 15, 2004 - 0.12.2 ]
+ Expanded platform identification, thanks to the NAnt guys for shedding some
light on how to properly check for UNIX platforms! Thanks guys!
* POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
and "Unknown".
! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
the Project tag.
+ New command-line switch, /ppo, forces DNPB to pre-process the file and write
the pre-processed file. This allows you to test/debug your pre-processor
macros. No other processing will be done. You can specify a target file as
a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
if you do not specify a file.
+ The Match tag now has a 'buildAction' attribute which functions exactly like
the attribute of the same name for the File tag.
[ August 5, 2004 - 0.12.1 ]
+ Added environment variable expansion for all values. Environment variables
should be listed in the form ${VAR}.
[ July 30, 2004 - 0.12.0 ]
+ Added preprocessing via XML processing information tags. Available tags
are: <?if <exp> ?>, <?elseif <exp> ?>, <?else ?> and <?endif ?>. The
current expression parser is very basic, but will be replaced with a more
capable parser over time. Current operators available are: =, !=, <, >,
<=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
RuntimeMinor, RuntimeRevision.
[ July 27, 2004 - 0.11.4 ]
+ Added 'useRegex' attribute to the Match tag. Matches can now use regular
expressions to match filenames.
+ Added the 'assemblyName' attribute to the Project tag. Projects can now
set their output assembly name.
! Fixed several bugs in the way that Project tags inheirt their parent
Solutions configuration options. This operation should now work fully as
intended.
! Due to some wierdness, Project Guid's are now stored as part of the Project
node and created at parse time.
[ May 11, 2004 - 0.11.3 ]
! Fixed a bug where I was writing the wrong property name for a projects root
namespace.
! Removed a DEBUG statement I had left in the code in 0.11.2.
! Fixed a bug in the VS2002 writer which caused the version variables to not
be overriden correctly.
+ Added the rootNamespace property to the <Project> element, allowing you to
specify the root namespace.
* /target and /clean are now mutually exclusive command line switches, and
they both now take the all option. In the case of /target all, all build
file for all targets will be created. In the case of /clean all, the user
will be prompted to make sure they want to do it, and if so, will clean
all build files for all targets.
[ April 22, 2004 - 0.11.2 ]
! Fixed a bug with the /file command-line operator. Was using the unresolved
file path rather then the resolved one, was making the attempt to open the
dnpb file fail.
! Fixed a bug in the schema that required at least 1 solution and 1 reference
path. We can do just fine with 0 of either of these. Some files may be all
<Process> statements and not have any <Solution> tags.
! Fixed a bug that caused the project references not to be written with the
SharpDevelop target.
* Changed the schema to version 1.2, allowing for Configuration nodes to exist
under project nodes. The inheritance of values is hierarchical. Meaning, if
you define a configuration named Debug at the Soltion level, and one by the
same name at the Project level, the one at the Project level will first
inherit the options of the Solution level configuration, then set it's own
options. If you define a configuration at the Project level and it does not
exist at the Solution level, it will be created at the Solution level.
* Project references should now work correctly across the board. Note that due
to a restriction in Visual Studio, you can only reference projects in the same
solution.
[ April 21, 2004 - 0.11.1 ]
! Fixed a problem with resolving paths in various targets. Was not properly
setting the CWD.
* Schema updated to 1.1, moving the ReferencePath element from the Options
element to the Project element. This makes more logical sense, given that
reference paths are resolved relative to the project path. Any prebuild.xml
file referecning verison 1.0 will fail! Please update to the 1.1 schema.
[ April 19, 2004 - 0.11.0 ]
* Added several attributes across the code to make FxCop happy
! Fixed bugs in reference paths being written in the VS targets.
! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
a Push/Pop pair. Was wreaking havoc with <Process> tags.
! Fixed some bugs in the path tracking, both the Project and Solution nodes now
have a FullPath property, which is the full path to the file resolved at load
time. This should fix all path relativity problems.
+ Added new /clean switch, allowing the target to clean up any files it generated.
in accordance, the ITarget interface has been updated to support a new Clean()
method.
+ Completed addition of the <Process> tag, to allow the referencing of external
prebuild.xml files.
+ Added the runtime attribute to the Project element. This allows the developer
to specify which runtime a project should target (Mono or Microsoft). This is
of course ignored in certain targets like the Visual Studio targets.
+ Added the SharpDevelop target.
[ April 13, 2004 - 0.10.1a ]
+ Added the buildAction attribute to the File node. This is needed for dnpb
to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
[ April 13, 2004 - 0.10.1 ]
* First Release
[ Key ]
* = Change or information
+ = Addition
! = Bug Fix

274
Prebuild/README Normal file
View File

@ -0,0 +1,274 @@
Prebuild Instructions
Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
_______________________________________________________________________________
Overview
Prebuild can be either be run from the command line to generate the
project and make files or you can execute the included batch (*.bat)
and Unix Shell script (*.sh) files.
_______________________________________________________________________________
The currently supported developement tools and their associated batch
and shell script files.
Visual Studio .NET 2005 (VS2005.bat)
Visual Studio .NET 2003 (VS2003.bat)
Visual Studio .NET 2002 (VS2002.bat)
SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
Notes:
A Unix Shell script is provided for MonoDevelop, as it does not run on
Windows at this time.
Visual Studio .NET 2005 and the Visual Express IDE's can import
solutions from older versions of Visual Studio .NET.
Makefiles are not currently supported.
_______________________________________________________________________________
Command Line Syntax:
Example:
> Prebuild /target vs2003
This will generate the project files for Visual Studio.NET 2003 and
place the redirect the log to a file named PrebuildLog.txt in the
parent directory
The syntax structure is as below, where commandParameter is optional
depending on the command and you can provide several option-value
pairs.
Note: The '> ' signifies the command prompt, do not enter this literally
> Prebuild /<option> <commandParameter>
> Prebuild /target vs2003 /pause
> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
> Prebuild /target sharpdev /log
> Prebuild /removedir obj|bin
> Prebuild /target vs2003 /allowedgroups Group1|Group2
> Prebuild /clean
> Prebuild /clean /yes
> Prebuild /clean vs2003
_______________________________________________________________________________
Command Line Options:
/usage - Shows the help information on how to use Prebuild and what
the different options are and what they do
/clean - The project files generated for the target type specified as
a parameter for this option will be deleted. If no value is specified
or if 'all' is specified, then project files for all the target types
will be deleted.
/target - Specified the name of the development tool for which project
or make files will be generated. Possible parameter values include:
vs2003, vs2002, sharpdev
/file - Specifies the name of the XML which defines what files are to
be referenced by the generated project files as well as configures the
options for them. If not specified, prebuild.xml in the current
directory will be used as the default.
/log - Specified the log file that should be written to for build
errors. If this option is not specified, no log file is generated,
but if just no value is specified, then the defaul filename will be
used for the log (Prebuild.log).
/ppo - Preprocesses the xml file to test for syntax errors or problems
but doesn't generate the files
/pause - Shows the console until you press a key so that you can view
the messages written while performing the specified actions.
This allows you to check if an errors occurred and - if so - what it
was.
/showtargets - Shows a list of all the targets that can be specified
as values for the /clean and /target commands.
/allowedgroups - This is followed by a pipe-delimited list of project
group filter flags (eg. Group1|Group2) allow optional filtering of all
projects that dont have at least one of these flags
/removedir - This is followed by a pipe-delimited list of directory
names that will be deleted while recursivly searching the directory of
the prebuild application and its child directories (eg. use obj|bin to
delete all output and temporary directories before file releases)
/yes - Answer yes to any warnings (e.g. when cleaning all projects).
_______________________________________________________________________________
Example Batch Files and Shell Scripts
NOTE: Common batch and shell script files are included with Prebuild source and file releases.
______________________________
MonoDevelop
#!/bin/sh
# Generates a solution (.mds) and a set of project files (.mdp)
# for MonoDevelop, a Mono port of SharpDevelop
# (http://icsharpcode.net/OpenSource/SD/Default.aspx)
./Prebuild /target monodev /pause
______________________________
Visual Studio .NET 2003
@rem Generates a solution (.sln) and a set of project files (.csproj)
@rem for Microsoft Visual Studio .NET 2002
Prebuild /target vs2003 /pause
Notes:
Text after lines that start with @rem are comments and are not evaluated
You can also place pause on the last line instead of specifing the /pause command.
_______________________________________________________________________________
Example XML Configuration File
Note:
XML Comments (<!-- Comment -->) are used to markup the prebuild.xml
file with notes
The below file may be out-of-date, however the RealmForge Prebuild
file serves as an up-to-date and extensive example.
It can be viewed using Tigris.org's WebSVN
(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
by just clicking on the "view file" link for the latest revision.
_________________________________
<?xml version="1.0" encoding="utf-8"?>
<!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for. In this example it is the version 1.3 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
<Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
<!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these). You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
<Configuration name="Debug">
<Options>
<!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements. Note that it is not neccisary to define POSIX or WIN32 -->
<?if OS = "Win32" ?>
<CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
<?else ?>
<CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
<?endif ?>
<OptimizeCode>false</OptimizeCode>
<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
<AllowUnsafe>false</AllowUnsafe>
<WarningLevel>4</WarningLevel>
<!-The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
<WarningsAsErrors>false</WarningsAsErrors>
<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
<!-- A semicolon ';' delimited list of the warnings that are filtered and not shown in the output window during compiling a project. Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
<OutputPath>..\bin</OutputPath>
<DebugInformation>true</DebugInformation>
<RegisterComInterop>false</RegisterComInterop>
<IncrementalBuild>true</IncrementalBuild>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<XmlDocFile>Docs.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
<Options>
<CompilerDefines>TRACE</CompilerDefines>
<OptimizeCode>true</OptimizeCode>
<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
<AllowUnsafe>false</AllowUnsafe>
<WarningLevel>4</WarningLevel>
<WarningsAsErrors>false</WarningsAsErrors>
<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
<OutputPath>..\bin</OutputPath>
<DebugInformation>false</DebugInformation>
<RegisterComInterop>false</RegisterComInterop>
<IncrementalBuild>true</IncrementalBuild>
<BaseAddress>285212672</BaseAddress>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<GenerateXmlDocFile>true</GenerateXmlDocFile>
<XmlDocFile>Docs.xml</XmlDocFile>
</Options>
</Configuration>
<!-- One of the projects that is included in the Solution -->
<Project name="RealmForge.Utility" Language="VisualBasic" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
<Configuration name="Debug">
<Options>
<OutputPath>..\bin\lib\Utility</OutputPath>
<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\bin\lib\Utility</OutputPath>
<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
</Options>
</Configuration>
<ReferencePath>../bin</ReferencePath>
<Reference name="System"/>
<Reference name="System.Data"/>
<Reference name="System.Drawing"/>
<Reference name="System.Xml"/>
<Reference name="System.Runtime.Serialization.Formatters.Soap"/>
<Reference name="ICSharpCode.SharpZipLib"/>
<Files>
<Match path="." pattern="*.vb" recurse="true"/>
</Files>
</Project>
<!-- Another projects that is included in the Solution -->
<Project name="DemoGame" Language="C#" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
<!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled. This is relative to the project path -->
<!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe). WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
<Configuration name="Debug">
<Options>
<OutputPath>..\bin</OutputPath>
<XmlDocFile>DemoGame.xml</XmlDocFile>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>..\bin</OutputPath>
<XmlDocFile>DemoGame.xml</XmlDocFile>
</Options>
</Configuration>
<ReferencePath>../bin</ReferencePath>
<Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
<Reference name="ode"/> <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
<Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
<Files>
<Match path="." pattern="*.cs" recurse="true"/>
<Match path="." pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
<Match path="." pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
<!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's. Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
<!--EmbeddedResource, Content, and Compile are valid buildAction's-->
</Files>
</Project>
</Solution>
</Prebuild>

18
Prebuild/THANKS Normal file
View File

@ -0,0 +1,18 @@
Gryc Ueusp <gryc.ueusp@gmail.com>
caught a problem with the NAnt target's .build output which caused
the Ubuntu build servers to choke on prebuild-generated packages
Todd Berman <tberman@sevenl.net>
Lluis Sanchez Gual <lluis@novell.com>
pkg-config .pc file parser used in AutotoolsTarget.cs was ripped off
from work contributed to MonoDevelop by Lluis and Todd. It came
from
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemPackage.cs (Lluis)
and
src/core/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs
(Lluis && Todd)

43
Prebuild/TODO Normal file
View File

@ -0,0 +1,43 @@
* monodev target should be able to detect whether the project is 1.x
or 2.x runtime
* remove target which links ../project/foo.dll to each project's build
root
* generate .config files
* Fix the autotools target so that
sub generate_project_files { ... }
sub generate_solution_files { ... }
sub generate_multi_solution_files { ... }
sub generate_project {
...
generate_project_files();
}
sub generate_solution {
foreach $project ( @projects ){
mkdir "$project/";
pushd "$project/";
generate_project();
popd;
}
generate_solution_files();
}
sub generate_multi_solution {
foreach $solution ( @solutions ){
mkdir "$solution/";
pushd "$solution/";
generate_solution();
popd;
}
generate_multi_solution_files();
}
if(numProjects == 1){
generate_project();
}elsif(numSolutions == 1){
generate_solution();
}else{
generate_multi_solution();
}

2
Prebuild/prebuild Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
exec mono [PREFIX]/prebuild.exe "$@"

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