aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2010-09-13 16:16:40 +0100
committerMelanie2010-09-13 16:17:38 +0100
commit6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e (patch)
tree1e7bf4fddcf559886c6b2babf13cf4b2ca8829a1 /OpenSim
parentMerge branch 'careminster-presence-refactor' of ssh://melanie@3dhosting.de/va... (diff)
parentFix unit test SceneSetupHelpers to load the mock simulation data store (diff)
downloadopensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.zip
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.gz
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.bz2
opensim-SC_OLD-6a1ce17cdbf143f11262e1194b6a6d9e5bb1077e.tar.xz
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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs12
-rw-r--r--OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs4
-rw-r--r--OpenSim/Data/DBGuids.cs31
-rw-r--r--OpenSim/Data/IAssetData.cs11
-rw-r--r--OpenSim/Data/IInventoryData.cs11
-rw-r--r--OpenSim/Data/MSSQL/MSSQLEstateData.cs9
-rw-r--r--OpenSim/Data/MSSQL/MSSQLSimulationData.cs (renamed from OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs)18
-rw-r--r--OpenSim/Data/Migration.cs14
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs3
-rw-r--r--OpenSim/Data/MySQL/MySQLEstateData.cs9
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs2
-rw-r--r--OpenSim/Data/MySQL/MySQLSimulationData.cs (renamed from OpenSim/Data/MySQL/MySQLLegacyRegionData.cs)33
-rw-r--r--OpenSim/Data/Null/NullInventoryData.cs29
-rw-r--r--OpenSim/Data/Null/NullSimulationData.cs (renamed from OpenSim/Data/Null/NullDataStore.cs)3
-rw-r--r--OpenSim/Data/SQLite/SQLiteEstateData.cs9
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs6
-rw-r--r--OpenSim/Data/SQLite/SQLiteSimulationData.cs (renamed from OpenSim/Data/SQLite/SQLiteRegionData.cs)70
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs9
-rw-r--r--OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs (renamed from OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs)13
-rw-r--r--OpenSim/Data/Tests/BasicDataServiceTest.cs39
-rw-r--r--OpenSim/Data/Tests/DefaultTestConns.cs29
-rw-r--r--OpenSim/Data/Tests/RegionTests.cs12
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs2
-rw-r--r--OpenSim/Framework/ConfigSettings.cs16
-rw-r--r--OpenSim/Framework/Console/CommandConsole.cs2
-rwxr-xr-xOpenSim/Framework/Console/ConsoleBase.cs51
-rw-r--r--OpenSim/Framework/Console/LocalConsole.cs23
-rw-r--r--OpenSim/Framework/Console/MockConsole.cs29
-rw-r--r--OpenSim/Framework/LandData.cs28
-rw-r--r--OpenSim/Framework/LandUpdateArgs.cs14
-rw-r--r--OpenSim/Framework/Lazy.cs2
-rw-r--r--OpenSim/Framework/PrimitiveBaseShape.cs74
-rw-r--r--OpenSim/Framework/RegionInfo.cs28
-rw-r--r--OpenSim/Framework/SLUtil.cs10
-rw-r--r--OpenSim/Framework/Serialization/ArchiveConstants.cs20
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs121
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs2
-rw-r--r--OpenSim/Framework/TaskInventoryItem.cs10
-rw-r--r--OpenSim/Region/Application/Application.cs2
-rw-r--r--OpenSim/Region/Application/ConfigurationLoader.cs4
-rw-r--r--OpenSim/Region/Application/OpenSim.cs25
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs56
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs257
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs33
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs26
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs431
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs18
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs28
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs54
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs18
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs12
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs15
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs118
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs98
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs14
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/DataSnapshot/ObjectSnapshot.cs3
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEstateDataService.cs45
-rw-r--r--OpenSim/Region/Framework/Interfaces/IGroupsModule.cs6
-rw-r--r--OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs16
-rw-r--r--OpenSim/Region/Framework/Interfaces/IMoapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs4
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs98
-rw-r--r--OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs (renamed from OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs)2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/EntityManager.cs261
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/Prioritizer.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Permissions.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs429
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs307
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs32
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneViewer.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs23
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs18
-rw-r--r--OpenSim/Region/Framework/StorageManager.cs96
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs10
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs39
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs6
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs3
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs4
-rw-r--r--OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs2
-rw-r--r--OpenSim/Server/Base/ServerUtils.cs2
-rw-r--r--OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs79
-rw-r--r--OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs23
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs75
-rw-r--r--OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs2
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs13
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs3
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs6
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs55
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs4
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs21
-rw-r--r--OpenSim/Services/Connectors/Simulation/EstateDataService.cs112
-rw-r--r--OpenSim/Services/Connectors/Simulation/SimulationDataService.cs140
-rw-r--r--OpenSim/Services/InventoryService/InventoryService.cs4
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs2
-rw-r--r--OpenSim/Services/UserAccountService/UserAccountService.cs24
-rw-r--r--OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs84
-rw-r--r--OpenSim/Tests/Common/Mock/TestScene.cs12
-rw-r--r--OpenSim/Tests/Common/Setup/AssetHelpers.cs4
-rw-r--r--OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs42
-rw-r--r--OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs4
-rw-r--r--OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs8
151 files changed, 2526 insertions, 2001 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 0608f66..a47fc01 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -756,7 +756,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
756 // Set the estate 756 // Set the estate
757 757
758 // Check for an existing estate 758 // Check for an existing estate
759 List<int> estateIDs = m_application.StorageManager.EstateDataStore.GetEstates((string) requestData["estate_name"]); 759 List<int> estateIDs = m_application.EstateDataService.GetEstates((string) requestData["estate_name"]);
760 if (estateIDs.Count < 1) 760 if (estateIDs.Count < 1)
761 { 761 {
762 UUID userID = UUID.Zero; 762 UUID userID = UUID.Zero;
@@ -784,7 +784,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
784 } 784 }
785 785
786 // Create a new estate with the name provided 786 // Create a new estate with the name provided
787 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(region.RegionID, true); 787 region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(region.RegionID, true);
788 788
789 region.EstateSettings.EstateName = (string) requestData["estate_name"]; 789 region.EstateSettings.EstateName = (string) requestData["estate_name"];
790 region.EstateSettings.EstateOwner = userID; 790 region.EstateSettings.EstateOwner = userID;
@@ -794,10 +794,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
794 else 794 else
795 { 795 {
796 int estateID = estateIDs[0]; 796 int estateID = estateIDs[0];
797 797
798 region.EstateSettings = m_application.StorageManager.EstateDataStore.LoadEstateSettings(estateID); 798 region.EstateSettings = m_application.EstateDataService.LoadEstateSettings(estateID);
799 799
800 if (!m_application.StorageManager.EstateDataStore.LinkRegion(region.RegionID, estateID)) 800 if (!m_application.EstateDataService.LinkRegion(region.RegionID, estateID))
801 throw new Exception("Failed to join estate."); 801 throw new Exception("Failed to join estate.");
802 } 802 }
803 803
diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
index 4369216..8271d76 100644
--- a/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
+++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RestAppearanceServices.cs
@@ -384,7 +384,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
384// } 384// }
385// 385//
386// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method)); 386// rdata.Respond(String.Format("Appearance {0} : Normal completion", rdata.method));
387// 387//
388// } 388// }
389 389
390 /// <summary> 390 /// <summary>
@@ -449,7 +449,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
449// rdata.userAppearance = new AvatarAppearance(); 449// rdata.userAppearance = new AvatarAppearance();
450// rdata.userAppearance.Owner = old.Owner; 450// rdata.userAppearance.Owner = old.Owner;
451// adata = new AvatarData(rdata.userAppearance); 451// adata = new AvatarData(rdata.userAppearance);
452// 452//
453// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata); 453// Rest.AvatarServices.SetAvatar(rdata.userProfile.ID, adata);
454// 454//
455// rdata.Complete(); 455// rdata.Complete();
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs
index fb6832b..ad1c19c 100644
--- a/OpenSim/Data/DBGuids.cs
+++ b/OpenSim/Data/DBGuids.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Text; 30using System.Text;
4using OpenMetaverse; 31using OpenMetaverse;
@@ -17,7 +44,7 @@ namespace OpenSim.Data
17 /// <returns></returns> 44 /// <returns></returns>
18 public static UUID FromDB(object id) 45 public static UUID FromDB(object id)
19 { 46 {
20 if( (id == null) || (id == DBNull.Value)) 47 if ((id == null) || (id == DBNull.Value))
21 return UUID.Zero; 48 return UUID.Zero;
22 49
23 if (id.GetType() == typeof(Guid)) 50 if (id.GetType() == typeof(Guid))
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs
index 065d3a5..0c8eadd 100644
--- a/OpenSim/Data/IAssetData.cs
+++ b/OpenSim/Data/IAssetData.cs
@@ -40,15 +40,4 @@ namespace OpenSim.Data
40 void Initialise(string connect); 40 void Initialise(string connect);
41 bool Delete(string id); 41 bool Delete(string id);
42 } 42 }
43
44 public class AssetDataInitialiser : PluginInitialiserBase
45 {
46 private string connect;
47 public AssetDataInitialiser (string s) { connect = s; }
48 public override void Initialise (IPlugin plugin)
49 {
50 IAssetDataPlugin p = plugin as IAssetDataPlugin;
51 p.Initialise (connect);
52 }
53 }
54} 43}
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
index 90f74b7..74d5d37 100644
--- a/OpenSim/Data/IInventoryData.cs
+++ b/OpenSim/Data/IInventoryData.cs
@@ -155,15 +155,4 @@ namespace OpenSim.Data
155 /// </returns> 155 /// </returns>
156 List<InventoryItemBase> fetchActiveGestures(UUID avatarID); 156 List<InventoryItemBase> fetchActiveGestures(UUID avatarID);
157 } 157 }
158
159 public class InventoryDataInitialiser : PluginInitialiserBase
160 {
161 private string connect;
162 public InventoryDataInitialiser (string s) { connect = s; }
163 public override void Initialise (IPlugin plugin)
164 {
165 IInventoryDataPlugin p = plugin as IInventoryDataPlugin;
166 p.Initialise (connect);
167 }
168 }
169} 158}
diff --git a/OpenSim/Data/MSSQL/MSSQLEstateData.cs b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
index 80bf106..e9a0935 100644
--- a/OpenSim/Data/MSSQL/MSSQLEstateData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLEstateData.cs
@@ -50,6 +50,15 @@ namespace OpenSim.Data.MSSQL
50 50
51 #region Public methods 51 #region Public methods
52 52
53 public MSSQLEstateStore()
54 {
55 }
56
57 public MSSQLEstateStore(string connectionString)
58 {
59 Initialise(connectionString);
60 }
61
53 /// <summary> 62 /// <summary>
54 /// Initialises the estatedata class. 63 /// Initialises the estatedata class.
55 /// </summary> 64 /// </summary>
diff --git a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
index 77b8a10..8eae0a2 100644
--- a/OpenSim/Data/MSSQL/MSSQLLegacyRegionData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLSimulationData.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Data.MSSQL
43 /// <summary> 43 /// <summary>
44 /// A MSSQL Interface for the Region Server. 44 /// A MSSQL Interface for the Region Server.
45 /// </summary> 45 /// </summary>
46 public class MSSQLRegionDataStore : IRegionDataStore 46 public class MSSQLSimulationData : ISimulationDataStore
47 { 47 {
48 private const string _migrationStore = "RegionStore"; 48 private const string _migrationStore = "RegionStore";
49 49
@@ -55,6 +55,16 @@ namespace OpenSim.Data.MSSQL
55 /// </summary> 55 /// </summary>
56 private MSSQLManager _Database; 56 private MSSQLManager _Database;
57 private string m_connectionString; 57 private string m_connectionString;
58
59 public MSSQLSimulationData()
60 {
61 }
62
63 public MSSQLSimulationData(string connectionString)
64 {
65 Initialise(connectionString);
66 }
67
58 /// <summary> 68 /// <summary>
59 /// Initialises the region datastore 69 /// Initialises the region datastore
60 /// </summary> 70 /// </summary>
@@ -1126,7 +1136,7 @@ VALUES
1126 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]); 1136 prim.LinkNum = Convert.ToInt32(primRow["LinkNumber"]);
1127 1137
1128 if (!(primRow["MediaURL"] is System.DBNull)) 1138 if (!(primRow["MediaURL"] is System.DBNull))
1129 prim.MediaUrl = (string)primRow["MediaURL"]; 1139 prim.MediaUrl = (string)primRow["MediaURL"];
1130 1140
1131 return prim; 1141 return prim;
1132 } 1142 }
@@ -1180,7 +1190,7 @@ VALUES
1180 { 1190 {
1181 } 1191 }
1182 1192
1183 if (!(shapeRow["Media"] is System.DBNull)) 1193 if (!(shapeRow["Media"] is System.DBNull))
1184 baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]); 1194 baseShape.Media = PrimitiveBaseShape.MediaList.FromXml((string)shapeRow["Media"]);
1185 1195
1186 return baseShape; 1196 return baseShape;
@@ -1511,7 +1521,7 @@ VALUES
1511 parameters.Add(_Database.CreateParameter("PassTouches", 1)); 1521 parameters.Add(_Database.CreateParameter("PassTouches", 1));
1512 else 1522 else
1513 parameters.Add(_Database.CreateParameter("PassTouches", 0)); 1523 parameters.Add(_Database.CreateParameter("PassTouches", 0));
1514 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum)); 1524 parameters.Add(_Database.CreateParameter("LinkNumber", prim.LinkNum));
1515 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl)); 1525 parameters.Add(_Database.CreateParameter("MediaURL", prim.MediaUrl));
1516 1526
1517 return parameters.ToArray(); 1527 return parameters.ToArray();
diff --git a/OpenSim/Data/Migration.cs b/OpenSim/Data/Migration.cs
index 86531d9..fc9a142 100644
--- a/OpenSim/Data/Migration.cs
+++ b/OpenSim/Data/Migration.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Data
122 int ver = FindVersion(_conn, "migrations"); 122 int ver = FindVersion(_conn, "migrations");
123 if (ver <= 0) // -1 = no table, 0 = no version record 123 if (ver <= 0) // -1 = no table, 0 = no version record
124 { 124 {
125 if( ver < 0 ) 125 if (ver < 0)
126 ExecuteScript("create table migrations(name varchar(100), version int)"); 126 ExecuteScript("create table migrations(name varchar(100), version int)");
127 InsertVersion("migrations", 1); 127 InsertVersion("migrations", 1);
128 } 128 }
@@ -288,7 +288,7 @@ namespace OpenSim.Data
288 SortedList<int, string[]> migrations = new SortedList<int, string[]>(); 288 SortedList<int, string[]> migrations = new SortedList<int, string[]>();
289 289
290 string[] names = _assem.GetManifestResourceNames(); 290 string[] names = _assem.GetManifestResourceNames();
291 if( names.Length == 0 ) // should never happen 291 if (names.Length == 0) // should never happen
292 return migrations; 292 return migrations;
293 293
294 Array.Sort(names); // we want all the migrations ordered 294 Array.Sort(names); // we want all the migrations ordered
@@ -297,7 +297,7 @@ namespace OpenSim.Data
297 Match m = null; 297 Match m = null;
298 string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase 298 string sFile = Array.FindLast(names, nm => { m = _match_new.Match(nm); return m.Success; }); // ; nm.StartsWith(sPrefix, StringComparison.InvariantCultureIgnoreCase
299 299
300 if( (m != null) && !String.IsNullOrEmpty(sFile) ) 300 if ((m != null) && !String.IsNullOrEmpty(sFile))
301 { 301 {
302 /* The filename should be '<StoreName>.migrations[.NNN]' where NNN 302 /* The filename should be '<StoreName>.migrations[.NNN]' where NNN
303 * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip 303 * is the last version number defined in the file. If the '.NNN' part is recognized, the code can skip
@@ -312,7 +312,7 @@ namespace OpenSim.Data
312 312
313 if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound)) 313 if (m.Groups.Count > 1 && int.TryParse(m.Groups[1].Value, out nLastVerFound))
314 { 314 {
315 if( nLastVerFound <= after ) 315 if (nLastVerFound <= after)
316 goto scan_old_style; 316 goto scan_old_style;
317 } 317 }
318 318
@@ -329,7 +329,7 @@ namespace OpenSim.Data
329 sb.Length = 0; 329 sb.Length = 0;
330 } 330 }
331 331
332 if ( (nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list 332 if ((nVersion > 0) && (nVersion > after) && (script.Count > 0) && !migrations.ContainsKey(nVersion)) // script to the versioned script list
333 { 333 {
334 migrations[nVersion] = script.ToArray(); 334 migrations[nVersion] = script.ToArray();
335 } 335 }
@@ -345,7 +345,7 @@ namespace OpenSim.Data
345 string sLine = resourceReader.ReadLine(); 345 string sLine = resourceReader.ReadLine();
346 nLineNo++; 346 nLineNo++;
347 347
348 if( String.IsNullOrEmpty(sLine) || sLine.StartsWith("#") ) // ignore a comment or empty line 348 if (String.IsNullOrEmpty(sLine) || sLine.StartsWith("#")) // ignore a comment or empty line
349 continue; 349 continue;
350 350
351 if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase)) 351 if (sLine.Trim().Equals(":GO", StringComparison.InvariantCultureIgnoreCase))
@@ -392,7 +392,7 @@ scan_old_style:
392 if (m.Success) 392 if (m.Success)
393 { 393 {
394 int version = int.Parse(m.Groups[1].ToString()); 394 int version = int.Parse(m.Groups[1].ToString());
395 if ( (version > after) && !migrations.ContainsKey(version) ) 395 if ((version > after) && !migrations.ContainsKey(version))
396 { 396 {
397 using (Stream resource = _assem.GetManifestResourceStream(s)) 397 using (Stream resource = _assem.GetManifestResourceStream(s))
398 { 398 {
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index f9ce3d9..0b0a638 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -216,9 +216,6 @@ namespace OpenSim.Data.MySQL
216 216
217 private void UpdateAccessTime(AssetBase asset) 217 private void UpdateAccessTime(AssetBase asset)
218 { 218 {
219 // Writing to the database every time Get() is called on an asset is killing us. Seriously. -jph
220 return;
221
222 lock (m_dbLock) 219 lock (m_dbLock)
223 { 220 {
224 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 221 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
diff --git a/OpenSim/Data/MySQL/MySQLEstateData.cs b/OpenSim/Data/MySQL/MySQLEstateData.cs
index 9158f7a..c42c687 100644
--- a/OpenSim/Data/MySQL/MySQLEstateData.cs
+++ b/OpenSim/Data/MySQL/MySQLEstateData.cs
@@ -54,6 +54,15 @@ namespace OpenSim.Data.MySQL
54 private Dictionary<string, FieldInfo> m_FieldMap = 54 private Dictionary<string, FieldInfo> m_FieldMap =
55 new Dictionary<string, FieldInfo>(); 55 new Dictionary<string, FieldInfo>();
56 56
57 public MySQLEstateStore()
58 {
59 }
60
61 public MySQLEstateStore(string connectionString)
62 {
63 Initialise(connectionString);
64 }
65
57 public void Initialise(string connectionString) 66 public void Initialise(string connectionString)
58 { 67 {
59 m_connectionString = connectionString; 68 m_connectionString = connectionString;
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 0aea30f..2dca3eb 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Data.MySQL
286 InventoryItemBase item = new InventoryItemBase(); 286 InventoryItemBase item = new InventoryItemBase();
287 287
288 // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these. 288 // TODO: this is to handle a case where NULLs creep in there, which we are not sure is endemic to the system, or legacy. It would be nice to live fix these.
289 // ( DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero ) 289 // (DBGuid.FromDB() reads db NULLs as well, returns UUID.Zero)
290 item.CreatorId = reader["creatorID"].ToString(); 290 item.CreatorId = reader["creatorID"].ToString();
291 291
292 // Be a bit safer in parsing these because the 292 // Be a bit safer in parsing these because the
diff --git a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs
index a39e68d..87f6d07 100644
--- a/OpenSim/Data/MySQL/MySQLLegacyRegionData.cs
+++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs
@@ -45,13 +45,22 @@ namespace OpenSim.Data.MySQL
45 /// <summary> 45 /// <summary>
46 /// A MySQL Interface for the Region Server 46 /// A MySQL Interface for the Region Server
47 /// </summary> 47 /// </summary>
48 public class MySQLDataStore : IRegionDataStore 48 public class MySQLSimulationData : ISimulationDataStore
49 { 49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 private string m_connectionString; 52 private string m_connectionString;
53 private object m_dbLock = new object(); 53 private object m_dbLock = new object();
54 54
55 public MySQLSimulationData()
56 {
57 }
58
59 public MySQLSimulationData(string connectionString)
60 {
61 Initialise(connectionString);
62 }
63
55 public void Initialise(string connectionString) 64 public void Initialise(string connectionString)
56 { 65 {
57 m_connectionString = connectionString; 66 m_connectionString = connectionString;
@@ -680,7 +689,7 @@ namespace OpenSim.Data.MySQL
680 "UserLocationX, UserLocationY, UserLocationZ, " + 689 "UserLocationX, UserLocationY, UserLocationZ, " +
681 "UserLookAtX, UserLookAtY, UserLookAtZ, " + 690 "UserLookAtX, UserLookAtY, UserLookAtZ, " +
682 "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " + 691 "AuthbuyerID, OtherCleanTime, MediaType, MediaDescription, " +
683 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" + 692 "MediaSize, MediaLoop, ObscureMusic, ObscureMedia) values (" +
684 "?UUID, ?RegionUUID, " + 693 "?UUID, ?RegionUUID, " +
685 "?LocalLandID, ?Bitmap, ?Name, ?Description, " + 694 "?LocalLandID, ?Bitmap, ?Name, ?Description, " +
686 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " + 695 "?OwnerUUID, ?IsGroupOwned, ?Area, ?AuctionID, " +
@@ -691,7 +700,7 @@ namespace OpenSim.Data.MySQL
691 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " + 700 "?UserLocationX, ?UserLocationY, ?UserLocationZ, " +
692 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " + 701 "?UserLookAtX, ?UserLookAtY, ?UserLookAtZ, " +
693 "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+ 702 "?AuthbuyerID, ?OtherCleanTime, ?MediaType, ?MediaDescription, "+
694 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)"; 703 "CONCAT(?MediaWidth, ',', ?MediaHeight), ?MediaLoop, ?ObscureMusic, ?ObscureMedia)";
695 704
696 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID); 705 FillLandCommand(cmd, parcel.LandData, parcel.RegionUUID);
697 706
@@ -728,7 +737,7 @@ namespace OpenSim.Data.MySQL
728 737
729 string command = "select * from `regionwindlight` where region_id = ?regionID"; 738 string command = "select * from `regionwindlight` where region_id = ?regionID";
730 739
731 using(MySqlCommand cmd = new MySqlCommand(command)) 740 using (MySqlCommand cmd = new MySqlCommand(command))
732 { 741 {
733 cmd.Connection = dbcon; 742 cmd.Connection = dbcon;
734 743
@@ -1350,13 +1359,13 @@ namespace OpenSim.Data.MySQL
1350 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); 1359 m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
1351 } 1360 }
1352 1361
1353 newData.MediaDescription = (string) row["MediaDescription"]; 1362 newData.MediaDescription = (string) row["MediaDescription"];
1354 newData.MediaType = (string) row["MediaType"]; 1363 newData.MediaType = (string) row["MediaType"];
1355 newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]); 1364 newData.MediaWidth = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[0]);
1356 newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]); 1365 newData.MediaHeight = Convert.ToInt32((((string) row["MediaSize"]).Split(','))[1]);
1357 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]); 1366 newData.MediaLoop = Convert.ToBoolean(row["MediaLoop"]);
1358 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]); 1367 newData.ObscureMusic = Convert.ToBoolean(row["ObscureMusic"]);
1359 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]); 1368 newData.ObscureMedia = Convert.ToBoolean(row["ObscureMedia"]);
1360 1369
1361 newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); 1370 newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
1362 1371
@@ -1724,7 +1733,7 @@ namespace OpenSim.Data.MySQL
1724 1733
1725 s.State = (byte)(int)row["State"]; 1734 s.State = (byte)(int)row["State"];
1726 1735
1727 if (!(row["Media"] is System.DBNull)) 1736 if (!(row["Media"] is System.DBNull))
1728 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 1737 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
1729 1738
1730 return s; 1739 return s;
diff --git a/OpenSim/Data/Null/NullInventoryData.cs b/OpenSim/Data/Null/NullInventoryData.cs
index 8f196e2..fe9ed01 100644
--- a/OpenSim/Data/Null/NullInventoryData.cs
+++ b/OpenSim/Data/Null/NullInventoryData.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3 30
4using OpenMetaverse; 31using OpenMetaverse;
diff --git a/OpenSim/Data/Null/NullDataStore.cs b/OpenSim/Data/Null/NullSimulationData.cs
index 3ba44bb..34d3a4e 100644
--- a/OpenSim/Data/Null/NullDataStore.cs
+++ b/OpenSim/Data/Null/NullSimulationData.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Data.Null
36 /// <summary> 36 /// <summary>
37 /// NULL DataStore, do not store anything 37 /// NULL DataStore, do not store anything
38 /// </summary> 38 /// </summary>
39 public class NullDataStore : IRegionDataStore 39 public class NullSimulationData : ISimulationDataStore
40 { 40 {
41 public void Initialise(string dbfile) 41 public void Initialise(string dbfile)
42 { 42 {
@@ -73,7 +73,6 @@ namespace OpenSim.Data.Null
73 { 73 {
74 } 74 }
75 75
76 // see IRegionDatastore
77 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 76 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
78 { 77 {
79 } 78 }
diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs
index fcf041e..d1d67eb 100644
--- a/OpenSim/Data/SQLite/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLite
49 private Dictionary<string, FieldInfo> m_FieldMap = 49 private Dictionary<string, FieldInfo> m_FieldMap =
50 new Dictionary<string, FieldInfo>(); 50 new Dictionary<string, FieldInfo>();
51 51
52 public SQLiteEstateStore()
53 {
54 }
55
56 public SQLiteEstateStore(string connectionString)
57 {
58 Initialise(connectionString);
59 }
60
52 public void Initialise(string connectionString) 61 public void Initialise(string connectionString)
53 { 62 {
54 m_connectionString = connectionString; 63 m_connectionString = connectionString;
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index ece2495..ecf8e02 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -731,12 +731,12 @@ namespace OpenSim.Data.SQLite
731 **********************************************************************/ 731 **********************************************************************/
732 732
733 protected void CreateDataSetMapping(IDataAdapter da, string tableName) 733 protected void CreateDataSetMapping(IDataAdapter da, string tableName)
734 { 734 {
735 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName); 735 ITableMapping dbMapping = da.TableMappings.Add(tableName, tableName);
736 foreach (DataColumn col in ds.Tables[tableName].Columns) 736 foreach (DataColumn col in ds.Tables[tableName].Columns)
737 { 737 {
738 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName); 738 dbMapping.ColumnMappings.Add(col.ColumnName, col.ColumnName);
739 } 739 }
740 } 740 }
741 741
742 /// <summary> 742 /// <summary>
diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
index 88699a7..3e9bc3f 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs
@@ -44,7 +44,7 @@ namespace OpenSim.Data.SQLite
44 /// <summary> 44 /// <summary>
45 /// A RegionData Interface to the SQLite database 45 /// A RegionData Interface to the SQLite database
46 /// </summary> 46 /// </summary>
47 public class SQLiteRegionData : IRegionDataStore 47 public class SQLiteSimulationData : ISimulationDataStore
48 { 48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50 50
@@ -70,6 +70,15 @@ namespace OpenSim.Data.SQLite
70 70
71 private String m_connectionString; 71 private String m_connectionString;
72 72
73 public SQLiteSimulationData()
74 {
75 }
76
77 public SQLiteSimulationData(string connectionString)
78 {
79 Initialise(connectionString);
80 }
81
73 // Temporary attribute while this is experimental 82 // Temporary attribute while this is experimental
74 83
75 /*********************************************************************** 84 /***********************************************************************
@@ -79,7 +88,6 @@ namespace OpenSim.Data.SQLite
79 **********************************************************************/ 88 **********************************************************************/
80 89
81 /// <summary> 90 /// <summary>
82 /// See IRegionDataStore
83 /// <list type="bullet"> 91 /// <list type="bullet">
84 /// <item>Initialises RegionData Interface</item> 92 /// <item>Initialises RegionData Interface</item>
85 /// <item>Loads and initialises a new SQLite connection and maintains it.</item> 93 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@@ -177,7 +185,7 @@ namespace OpenSim.Data.SQLite
177 { 185 {
178 m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table"); 186 m_log.Info("[SQLITE REGION DB]: Caught fill error on primitems table");
179 } 187 }
180 188
181 try 189 try
182 { 190 {
183 terrainDa.Fill(ds.Tables["terrain"]); 191 terrainDa.Fill(ds.Tables["terrain"]);
@@ -511,7 +519,7 @@ namespace OpenSim.Data.SQLite
511 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape"); 519 "[SQLITE REGION DB]: No shape found for prim in storage, so setting default box shape");
512 prim.Shape = PrimitiveBaseShape.Default; 520 prim.Shape = PrimitiveBaseShape.Default;
513 } 521 }
514 522
515 createdObjects[new UUID(objID)].AddPart(prim); 523 createdObjects[new UUID(objID)].AddPart(prim);
516 LoadItems(prim); 524 LoadItems(prim);
517 } 525 }
@@ -535,17 +543,17 @@ namespace OpenSim.Data.SQLite
535 /// </summary> 543 /// </summary>
536 /// <param name="prim">the prim</param> 544 /// <param name="prim">the prim</param>
537 private void LoadItems(SceneObjectPart prim) 545 private void LoadItems(SceneObjectPart prim)
538 { 546 {
539// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID); 547// m_log.DebugFormat("[SQLITE REGION DB]: Loading inventory for {0} {1}", prim.Name, prim.UUID);
540 548
541 DataTable dbItems = ds.Tables["primitems"]; 549 DataTable dbItems = ds.Tables["primitems"];
542 String sql = String.Format("primID = '{0}'", prim.UUID.ToString()); 550 String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
543 DataRow[] dbItemRows = dbItems.Select(sql); 551 DataRow[] dbItemRows = dbItems.Select(sql);
544 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); 552 IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
545 553
546// m_log.DebugFormat( 554// m_log.DebugFormat(
547// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID); 555// "[SQLITE REGION DB]: Found {0} items for {1} {2}", dbItemRows.Length, prim.Name, prim.UUID);
548 556
549 foreach (DataRow row in dbItemRows) 557 foreach (DataRow row in dbItemRows)
550 { 558 {
551 TaskInventoryItem item = buildItem(row); 559 TaskInventoryItem item = buildItem(row);
@@ -694,8 +702,6 @@ namespace OpenSim.Data.SQLite
694 { 702 {
695 landaccesslist.Rows.Remove(rowsToDelete[iter]); 703 landaccesslist.Rows.Remove(rowsToDelete[iter]);
696 } 704 }
697
698
699 } 705 }
700 Commit(); 706 Commit();
701 } 707 }
@@ -805,7 +811,7 @@ namespace OpenSim.Data.SQLite
805 try 811 try
806 { 812 {
807 regionSettingsDa.Update(ds, "regionsettings"); 813 regionSettingsDa.Update(ds, "regionsettings");
808 } 814 }
809 catch (SqliteException SqlEx) 815 catch (SqliteException SqlEx)
810 { 816 {
811 throw new Exception( 817 throw new Exception(
@@ -975,7 +981,7 @@ namespace OpenSim.Data.SQLite
975 createCol(prims, "CollisionSoundVolume", typeof(Double)); 981 createCol(prims, "CollisionSoundVolume", typeof(Double));
976 982
977 createCol(prims, "VolumeDetect", typeof(Int16)); 983 createCol(prims, "VolumeDetect", typeof(Int16));
978 984
979 createCol(prims, "MediaURL", typeof(String)); 985 createCol(prims, "MediaURL", typeof(String));
980 986
981 // Add in contraints 987 // Add in contraints
@@ -1192,10 +1198,10 @@ namespace OpenSim.Data.SQLite
1192 private SceneObjectPart buildPrim(DataRow row) 1198 private SceneObjectPart buildPrim(DataRow row)
1193 { 1199 {
1194 // Code commented. Uncomment to test the unit test inline. 1200 // Code commented. Uncomment to test the unit test inline.
1195 1201
1196 // The unit test mentions this commented code for the purposes 1202 // The unit test mentions this commented code for the purposes
1197 // of debugging a unit test failure 1203 // of debugging a unit test failure
1198 1204
1199 // SceneObjectGroup sog = new SceneObjectGroup(); 1205 // SceneObjectGroup sog = new SceneObjectGroup();
1200 // SceneObjectPart sop = new SceneObjectPart(); 1206 // SceneObjectPart sop = new SceneObjectPart();
1201 // sop.LocalId = 1; 1207 // sop.LocalId = 1;
@@ -1212,7 +1218,7 @@ namespace OpenSim.Data.SQLite
1212 // TODO: this doesn't work yet because something more 1218 // TODO: this doesn't work yet because something more
1213 // interesting has to be done to actually get these values 1219 // interesting has to be done to actually get these values
1214 // back out. Not enough time to figure it out yet. 1220 // back out. Not enough time to figure it out yet.
1215 1221
1216 SceneObjectPart prim = new SceneObjectPart(); 1222 SceneObjectPart prim = new SceneObjectPart();
1217 prim.UUID = new UUID((String) row["UUID"]); 1223 prim.UUID = new UUID((String) row["UUID"]);
1218 // explicit conversion of integers is required, which sort 1224 // explicit conversion of integers is required, which sort
@@ -1342,7 +1348,7 @@ namespace OpenSim.Data.SQLite
1342 1348
1343 if (Convert.ToInt16(row["VolumeDetect"]) != 0) 1349 if (Convert.ToInt16(row["VolumeDetect"]) != 0)
1344 prim.VolumeDetectActive = true; 1350 prim.VolumeDetectActive = true;
1345 1351
1346 if (!(row["MediaURL"] is System.DBNull)) 1352 if (!(row["MediaURL"] is System.DBNull))
1347 { 1353 {
1348 //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType()); 1354 //m_log.DebugFormat("[SQLITE]: MediaUrl type [{0}]", row["MediaURL"].GetType());
@@ -1681,7 +1687,7 @@ namespace OpenSim.Data.SQLite
1681 row["VolumeDetect"] = 1; 1687 row["VolumeDetect"] = 1;
1682 else 1688 else
1683 row["VolumeDetect"] = 0; 1689 row["VolumeDetect"] = 0;
1684 1690
1685 row["MediaURL"] = prim.MediaUrl; 1691 row["MediaURL"] = prim.MediaUrl;
1686 } 1692 }
1687 1693
@@ -1759,12 +1765,12 @@ namespace OpenSim.Data.SQLite
1759 row["UserLookAtZ"] = land.UserLookAt.Z; 1765 row["UserLookAtZ"] = land.UserLookAt.Z;
1760 row["AuthbuyerID"] = land.AuthBuyerID.ToString(); 1766 row["AuthbuyerID"] = land.AuthBuyerID.ToString();
1761 row["OtherCleanTime"] = land.OtherCleanTime; 1767 row["OtherCleanTime"] = land.OtherCleanTime;
1762 row["MediaType"] = land.MediaType; 1768 row["MediaType"] = land.MediaType;
1763 row["MediaDescription"] = land.MediaDescription; 1769 row["MediaDescription"] = land.MediaDescription;
1764 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString(); 1770 row["MediaSize"] = land.MediaWidth.ToString() + "," + land.MediaHeight.ToString();
1765 row["MediaLoop"] = land.MediaLoop.ToString(); 1771 row["MediaLoop"] = land.MediaLoop.ToString();
1766 row["ObscureMusic"] = land.ObscureMusic.ToString(); 1772 row["ObscureMusic"] = land.ObscureMusic.ToString();
1767 row["ObscureMedia"] = land.ObscureMedia.ToString(); 1773 row["ObscureMedia"] = land.ObscureMedia.ToString();
1768 } 1774 }
1769 1775
1770 /// <summary> 1776 /// <summary>
@@ -1862,10 +1868,10 @@ namespace OpenSim.Data.SQLite
1862 s.TextureEntry = textureEntry; 1868 s.TextureEntry = textureEntry;
1863 1869
1864 s.ExtraParams = (byte[]) row["ExtraParams"]; 1870 s.ExtraParams = (byte[]) row["ExtraParams"];
1865 1871
1866 if (!(row["Media"] is System.DBNull)) 1872 if (!(row["Media"] is System.DBNull))
1867 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]); 1873 s.Media = PrimitiveBaseShape.MediaList.FromXml((string)row["Media"]);
1868 1874
1869 return s; 1875 return s;
1870 } 1876 }
1871 1877
@@ -1909,7 +1915,7 @@ namespace OpenSim.Data.SQLite
1909 1915
1910 row["Texture"] = s.TextureEntry; 1916 row["Texture"] = s.TextureEntry;
1911 row["ExtraParams"] = s.ExtraParams; 1917 row["ExtraParams"] = s.ExtraParams;
1912 1918
1913 if (s.Media != null) 1919 if (s.Media != null)
1914 row["Media"] = s.Media.ToXml(); 1920 row["Media"] = s.Media.ToXml();
1915 } 1921 }
@@ -1951,7 +1957,6 @@ namespace OpenSim.Data.SQLite
1951 } 1957 }
1952 1958
1953 /// <summary> 1959 /// <summary>
1954 /// see IRegionDatastore
1955 /// </summary> 1960 /// </summary>
1956 /// <param name="primID"></param> 1961 /// <param name="primID"></param>
1957 /// <param name="items"></param> 1962 /// <param name="items"></param>
@@ -2248,7 +2253,6 @@ namespace OpenSim.Data.SQLite
2248 delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String))); 2253 delete.Parameters.Add(createSqliteParameter("AccessUUID", typeof(String)));
2249 da.DeleteCommand = delete; 2254 da.DeleteCommand = delete;
2250 da.DeleteCommand.Connection = conn; 2255 da.DeleteCommand.Connection = conn;
2251
2252 } 2256 }
2253 2257
2254 private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn) 2258 private void setupRegionSettingsCommands(SqliteDataAdapter da, SqliteConnection conn)
@@ -2320,7 +2324,7 @@ namespace OpenSim.Data.SQLite
2320 return DbType.String; 2324 return DbType.String;
2321 } 2325 }
2322 } 2326 }
2323 2327
2324 static void PrintDataSet(DataSet ds) 2328 static void PrintDataSet(DataSet ds)
2325 { 2329 {
2326 // Print out any name and extended properties. 2330 // Print out any name and extended properties.
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
index bf8ee14..547ea6b 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteEstateData.cs
@@ -49,6 +49,15 @@ namespace OpenSim.Data.SQLiteLegacy
49 private Dictionary<string, FieldInfo> m_FieldMap = 49 private Dictionary<string, FieldInfo> m_FieldMap =
50 new Dictionary<string, FieldInfo>(); 50 new Dictionary<string, FieldInfo>();
51 51
52 public SQLiteEstateStore()
53 {
54 }
55
56 public SQLiteEstateStore(string connectionString)
57 {
58 Initialise(connectionString);
59 }
60
52 public void Initialise(string connectionString) 61 public void Initialise(string connectionString)
53 { 62 {
54 m_connectionString = connectionString; 63 m_connectionString = connectionString;
diff --git a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
index b5ce4c0..2dde926 100644
--- a/OpenSim/Data/SQLiteLegacy/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLiteLegacy/SQLiteSimulationData.cs
@@ -43,7 +43,7 @@ namespace OpenSim.Data.SQLiteLegacy
43 /// <summary> 43 /// <summary>
44 /// A RegionData Interface to the SQLite database 44 /// A RegionData Interface to the SQLite database
45 /// </summary> 45 /// </summary>
46 public class SQLiteRegionData : IRegionDataStore 46 public class SQLiteSimulationData : ISimulationDataStore
47 { 47 {
48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 49
@@ -69,6 +69,15 @@ namespace OpenSim.Data.SQLiteLegacy
69 69
70 private String m_connectionString; 70 private String m_connectionString;
71 71
72 public SQLiteSimulationData()
73 {
74 }
75
76 public SQLiteSimulationData(string connectionString)
77 {
78 Initialise(connectionString);
79 }
80
72 // Temporary attribute while this is experimental 81 // Temporary attribute while this is experimental
73 82
74 /*********************************************************************** 83 /***********************************************************************
@@ -78,7 +87,6 @@ namespace OpenSim.Data.SQLiteLegacy
78 **********************************************************************/ 87 **********************************************************************/
79 88
80 /// <summary> 89 /// <summary>
81 /// See IRegionDataStore
82 /// <list type="bullet"> 90 /// <list type="bullet">
83 /// <item>Initialises RegionData Interface</item> 91 /// <item>Initialises RegionData Interface</item>
84 /// <item>Loads and initialises a new SQLite connection and maintains it.</item> 92 /// <item>Loads and initialises a new SQLite connection and maintains it.</item>
@@ -1888,7 +1896,6 @@ namespace OpenSim.Data.SQLiteLegacy
1888 } 1896 }
1889 1897
1890 /// <summary> 1898 /// <summary>
1891 /// see IRegionDatastore
1892 /// </summary> 1899 /// </summary>
1893 /// <param name="primID"></param> 1900 /// <param name="primID"></param>
1894 /// <param name="items"></param> 1901 /// <param name="items"></param>
diff --git a/OpenSim/Data/Tests/BasicDataServiceTest.cs b/OpenSim/Data/Tests/BasicDataServiceTest.cs
index c261126..7d85f0c 100644
--- a/OpenSim/Data/Tests/BasicDataServiceTest.cs
+++ b/OpenSim/Data/Tests/BasicDataServiceTest.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.IO; 29using System.IO;
3using System.Collections.Generic; 30using System.Collections.Generic;
4using log4net.Config; 31using log4net.Config;
@@ -41,13 +68,13 @@ namespace OpenSim.Data.Tests
41 { 68 {
42 m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn)); 69 m_connStr = !String.IsNullOrEmpty(conn) ? conn : DefaultTestConns.Get(typeof(TConn));
43 70
44 m_log = LogManager.GetLogger(this.GetType()); 71 m_log = LogManager.GetLogger(this.GetType());
45 OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right? 72 OpenSim.Tests.Common.TestLogging.LogToConsole(); // TODO: Is that right?
46 } 73 }
47 74
48 /// <summary> 75 /// <summary>
49 /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it. 76 /// To be overridden in derived classes. Do whatever init with the m_service, like setting the conn string to it.
50 /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var. 77 /// You'd probably want to to cast the 'service' to a more specific type and store it in a member var.
51 /// This framework takes care of disposing it, if it's disposable. 78 /// This framework takes care of disposing it, if it's disposable.
52 /// </summary> 79 /// </summary>
53 /// <param name="service">The service being tested</param> 80 /// <param name="service">The service being tested</param>
@@ -118,12 +145,12 @@ namespace OpenSim.Data.Tests
118 { 145 {
119 if (m_service != null) 146 if (m_service != null)
120 { 147 {
121 if( m_service is IDisposable) 148 if (m_service is IDisposable)
122 ((IDisposable)m_service).Dispose(); 149 ((IDisposable)m_service).Dispose();
123 m_service = null; 150 m_service = null;
124 } 151 }
125 152
126 if( !String.IsNullOrEmpty(m_file) && File.Exists(m_file) ) 153 if (!String.IsNullOrEmpty(m_file) && File.Exists(m_file))
127 File.Delete(m_file); 154 File.Delete(m_file);
128 } 155 }
129 156
@@ -204,7 +231,7 @@ namespace OpenSim.Data.Tests
204 lst += ", " + s; 231 lst += ", " + s;
205 } 232 }
206 233
207 string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst); 234 string sCond = stores.Length > 1 ? ("in (" + lst + ")") : ("=" + lst);
208 try 235 try
209 { 236 {
210 ExecuteSql("DELETE FROM migrations where name " + sCond); 237 ExecuteSql("DELETE FROM migrations where name " + sCond);
diff --git a/OpenSim/Data/Tests/DefaultTestConns.cs b/OpenSim/Data/Tests/DefaultTestConns.cs
index 7b52af5..7c47bdd 100644
--- a/OpenSim/Data/Tests/DefaultTestConns.cs
+++ b/OpenSim/Data/Tests/DefaultTestConns.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using System.Linq; 30using System.Linq;
4using System.Text; 31using System.Text;
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs
index 29bf5a3..a081462 100644
--- a/OpenSim/Data/Tests/RegionTests.cs
+++ b/OpenSim/Data/Tests/RegionTests.cs
@@ -61,17 +61,17 @@ namespace OpenSim.Data.Tests
61#else 61#else
62 62
63 [TestFixture(Description = "Region store tests (SQLite)")] 63 [TestFixture(Description = "Region store tests (SQLite)")]
64 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteRegionData> 64 public class SQLiteRegionTests : RegionTests<SqliteConnection, SQLiteSimulationData>
65 { 65 {
66 } 66 }
67 67
68 [TestFixture(Description = "Region store tests (MySQL)")] 68 [TestFixture(Description = "Region store tests (MySQL)")]
69 public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLDataStore> 69 public class MySqlRegionTests : RegionTests<MySqlConnection, MySQLSimulationData>
70 { 70 {
71 } 71 }
72 72
73 [TestFixture(Description = "Region store tests (MS SQL Server)")] 73 [TestFixture(Description = "Region store tests (MS SQL Server)")]
74 public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLRegionDataStore> 74 public class MSSQLRegionTests : RegionTests<SqlConnection, MSSQLSimulationData>
75 { 75 {
76 } 76 }
77 77
@@ -79,11 +79,11 @@ namespace OpenSim.Data.Tests
79 79
80 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore> 80 public class RegionTests<TConn, TRegStore> : BasicDataServiceTest<TConn, TRegStore>
81 where TConn : DbConnection, new() 81 where TConn : DbConnection, new()
82 where TRegStore : class, IRegionDataStore, new() 82 where TRegStore : class, ISimulationDataStore, new()
83 { 83 {
84 bool m_rebuildDB; 84 bool m_rebuildDB;
85 85
86 public IRegionDataStore db; 86 public ISimulationDataStore db;
87 public UUID zero = UUID.Zero; 87 public UUID zero = UUID.Zero;
88 public UUID region1 = UUID.Random(); 88 public UUID region1 = UUID.Random();
89 public UUID region2 = UUID.Random(); 89 public UUID region2 = UUID.Random();
@@ -122,7 +122,7 @@ namespace OpenSim.Data.Tests
122 protected override void InitService(object service) 122 protected override void InitService(object service)
123 { 123 {
124 ClearDB(); 124 ClearDB();
125 db = (IRegionDataStore)service; 125 db = (ISimulationDataStore)service;
126 db.Initialise(m_connStr); 126 db.Initialise(m_connStr);
127 } 127 }
128 128
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 8a339fe..6f32adf 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -760,7 +760,7 @@ namespace OpenSim.Framework.Capabilities
760 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 760 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
761 761
762 BakedTextureUploader uploader = 762 BakedTextureUploader uploader =
763 new BakedTextureUploader( capsBase + uploaderPath, 763 new BakedTextureUploader(capsBase + uploaderPath,
764 m_httpListener); 764 m_httpListener);
765 uploader.OnUpLoad += BakedTextureUploaded; 765 uploader.OnUpLoad += BakedTextureUploaded;
766 766
diff --git a/OpenSim/Framework/ConfigSettings.cs b/OpenSim/Framework/ConfigSettings.cs
index 8feaa37..be77341 100644
--- a/OpenSim/Framework/ConfigSettings.cs
+++ b/OpenSim/Framework/ConfigSettings.cs
@@ -124,22 +124,6 @@ namespace OpenSim.Framework
124 set { m_standaloneUserSource = value; } 124 set { m_standaloneUserSource = value; }
125 } 125 }
126 126
127 protected string m_storageConnectionString;
128
129 public string StorageConnectionString
130 {
131 get { return m_storageConnectionString; }
132 set { m_storageConnectionString = value; }
133 }
134
135 protected string m_estateConnectionString;
136
137 public string EstateConnectionString
138 {
139 get { return m_estateConnectionString; }
140 set { m_estateConnectionString = value; }
141 }
142
143 protected string m_librariesXMLFile; 127 protected string m_librariesXMLFile;
144 public string LibrariesXMLFile 128 public string LibrariesXMLFile
145 { 129 {
diff --git a/OpenSim/Framework/Console/CommandConsole.cs b/OpenSim/Framework/Console/CommandConsole.cs
index b17dbc0..52bcd55 100644
--- a/OpenSim/Framework/Console/CommandConsole.cs
+++ b/OpenSim/Framework/Console/CommandConsole.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Console
151 help.Add(commandInfo.descriptive_help); 151 help.Add(commandInfo.descriptive_help);
152 152
153 if (descriptiveHelp != string.Empty) 153 if (descriptiveHelp != string.Empty)
154 help.Add(string.Empty); 154 help.Add(string.Empty);
155 } 155 }
156 else 156 else
157 { 157 {
diff --git a/OpenSim/Framework/Console/ConsoleBase.cs b/OpenSim/Framework/Console/ConsoleBase.cs
index aab920b..22ce880 100755
--- a/OpenSim/Framework/Console/ConsoleBase.cs
+++ b/OpenSim/Framework/Console/ConsoleBase.cs
@@ -89,6 +89,57 @@ namespace OpenSim.Framework.Console
89 89
90 return ret; 90 return ret;
91 } 91 }
92
93 public string CmdPrompt(string p, List<char> excludedCharacters)
94 {
95 bool itisdone = false;
96 string ret = String.Empty;
97 while (!itisdone)
98 {
99 itisdone = true;
100 ret = CmdPrompt(p);
101
102 foreach (char c in excludedCharacters)
103 {
104 if (ret.Contains(c.ToString()))
105 {
106 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
107 itisdone = false;
108 }
109 }
110 }
111
112 return ret;
113 }
114
115 public string CmdPrompt(string p, string def, List<char> excludedCharacters)
116 {
117 bool itisdone = false;
118 string ret = String.Empty;
119 while (!itisdone)
120 {
121 itisdone = true;
122 ret = CmdPrompt(p, def);
123
124 if (ret == String.Empty)
125 {
126 ret = def;
127 }
128 else
129 {
130 foreach (char c in excludedCharacters)
131 {
132 if (ret.Contains(c.ToString()))
133 {
134 System.Console.WriteLine("The character \"" + c.ToString() + "\" is not permitted.");
135 itisdone = false;
136 }
137 }
138 }
139 }
140
141 return ret;
142 }
92 143
93 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options 144 // Displays a command prompt and returns a default value, user may only enter 1 of 2 options
94 public string CmdPrompt(string prompt, string defaultresponse, List<string> options) 145 public string CmdPrompt(string prompt, string defaultresponse, List<string> options)
diff --git a/OpenSim/Framework/Console/LocalConsole.cs b/OpenSim/Framework/Console/LocalConsole.cs
index a3036d0..6043094 100644
--- a/OpenSim/Framework/Console/LocalConsole.cs
+++ b/OpenSim/Framework/Console/LocalConsole.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Console
38{ 38{
39 /// <summary> 39 /// <summary>
40 /// A console that uses cursor control and color 40 /// A console that uses cursor control and color
41 /// </summary> 41 /// </summary>
42 public class LocalConsole : CommandConsole 42 public class LocalConsole : CommandConsole
43 { 43 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -100,8 +100,8 @@ namespace OpenSim.Framework.Console
100 private int SetCursorTop(int top) 100 private int SetCursorTop(int top)
101 { 101 {
102 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try 102 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
103 // to set a cursor row position with a currently invalid column, mono will throw an exception. 103 // to set a cursor row position with a currently invalid column, mono will throw an exception.
104 // Therefore, we need to make sure that the column position is valid first. 104 // Therefore, we need to make sure that the column position is valid first.
105 int left = System.Console.CursorLeft; 105 int left = System.Console.CursorLeft;
106 106
107 if (left < 0) 107 if (left < 0)
@@ -121,7 +121,7 @@ namespace OpenSim.Framework.Console
121 { 121 {
122 top = 0; 122 top = 0;
123 } 123 }
124 else 124 else
125 { 125 {
126 int bh = System.Console.BufferHeight; 126 int bh = System.Console.BufferHeight;
127 127
@@ -133,7 +133,7 @@ namespace OpenSim.Framework.Console
133 System.Console.CursorTop = top; 133 System.Console.CursorTop = top;
134 134
135 return top; 135 return top;
136 } 136 }
137 137
138 /// <summary> 138 /// <summary>
139 /// Set the cursor column. 139 /// Set the cursor column.
@@ -145,12 +145,12 @@ namespace OpenSim.Framework.Console
145 /// </param> 145 /// </param>
146 /// <returns> 146 /// <returns>
147 /// The new cursor column. 147 /// The new cursor column.
148 /// </returns> 148 /// </returns>
149 private int SetCursorLeft(int left) 149 private int SetCursorLeft(int left)
150 { 150 {
151 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try 151 // From at least mono 2.4.2.3, window resizing can give mono an invalid row and column values. If we try
152 // to set a cursor column position with a currently invalid row, mono will throw an exception. 152 // to set a cursor column position with a currently invalid row, mono will throw an exception.
153 // Therefore, we need to make sure that the row position is valid first. 153 // Therefore, we need to make sure that the row position is valid first.
154 int top = System.Console.CursorTop; 154 int top = System.Console.CursorTop;
155 155
156 if (top < 0) 156 if (top < 0)
@@ -214,7 +214,7 @@ namespace OpenSim.Framework.Console
214 System.Console.Write("{0}", prompt); 214 System.Console.Write("{0}", prompt);
215 215
216 SetCursorTop(new_y); 216 SetCursorTop(new_y);
217 SetCursorLeft(new_x); 217 SetCursorLeft(new_x);
218 } 218 }
219 } 219 }
220 220
@@ -461,7 +461,8 @@ namespace OpenSim.Framework.Console
461 SetCursorLeft(0); 461 SetCursorLeft(0);
462 y = SetCursorTop(y); 462 y = SetCursorTop(y);
463 463
464 System.Console.WriteLine("{0}{1}", prompt, cmdline); 464 System.Console.WriteLine();
465 //Show();
465 466
466 lock (cmdline) 467 lock (cmdline)
467 { 468 {
@@ -486,7 +487,7 @@ namespace OpenSim.Framework.Console
486 } 487 }
487 } 488 }
488 489
489 AddToHistory(cmdline.ToString()); 490 //AddToHistory(cmdline.ToString());
490 return cmdline.ToString(); 491 return cmdline.ToString();
491 default: 492 default:
492 break; 493 break;
diff --git a/OpenSim/Framework/Console/MockConsole.cs b/OpenSim/Framework/Console/MockConsole.cs
index 9eb1977..a29b370 100644
--- a/OpenSim/Framework/Console/MockConsole.cs
+++ b/OpenSim/Framework/Console/MockConsole.cs
@@ -1,4 +1,31 @@
1using System; 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
2using System.Threading; 29using System.Threading;
3using System.Collections.Generic; 30using System.Collections.Generic;
4using System.Text; 31using System.Text;
diff --git a/OpenSim/Framework/LandData.cs b/OpenSim/Framework/LandData.cs
index 5bb0413..3fb2fd6 100644
--- a/OpenSim/Framework/LandData.cs
+++ b/OpenSim/Framework/LandData.cs
@@ -89,13 +89,13 @@ namespace OpenSim.Framework
89 private Vector3 _userLocation = new Vector3(); 89 private Vector3 _userLocation = new Vector3();
90 private Vector3 _userLookAt = new Vector3(); 90 private Vector3 _userLookAt = new Vector3();
91 private int _otherCleanTime = 0; 91 private int _otherCleanTime = 0;
92 private string _mediaType = "none/none"; 92 private string _mediaType = "none/none";
93 private string _mediaDescription = ""; 93 private string _mediaDescription = "";
94 private int _mediaHeight = 0; 94 private int _mediaHeight = 0;
95 private int _mediaWidth = 0; 95 private int _mediaWidth = 0;
96 private bool _mediaLoop = false; 96 private bool _mediaLoop = false;
97 private bool _obscureMusic = false; 97 private bool _obscureMusic = false;
98 private bool _obscureMedia = false; 98 private bool _obscureMedia = false;
99 99
100 /// <summary> 100 /// <summary>
101 /// Whether to obscure parcel media URL 101 /// Whether to obscure parcel media URL
@@ -690,13 +690,13 @@ namespace OpenSim.Framework
690 landData._userLocation = _userLocation; 690 landData._userLocation = _userLocation;
691 landData._userLookAt = _userLookAt; 691 landData._userLookAt = _userLookAt;
692 landData._otherCleanTime = _otherCleanTime; 692 landData._otherCleanTime = _otherCleanTime;
693 landData._mediaType = _mediaType; 693 landData._mediaType = _mediaType;
694 landData._mediaDescription = _mediaDescription; 694 landData._mediaDescription = _mediaDescription;
695 landData._mediaWidth = _mediaWidth; 695 landData._mediaWidth = _mediaWidth;
696 landData._mediaHeight = _mediaHeight; 696 landData._mediaHeight = _mediaHeight;
697 landData._mediaLoop = _mediaLoop; 697 landData._mediaLoop = _mediaLoop;
698 landData._obscureMusic = _obscureMusic; 698 landData._obscureMusic = _obscureMusic;
699 landData._obscureMedia = _obscureMedia; 699 landData._obscureMedia = _obscureMedia;
700 700
701 landData._parcelAccessList.Clear(); 701 landData._parcelAccessList.Clear();
702 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList) 702 foreach (ParcelManager.ParcelAccessEntry entry in _parcelAccessList)
diff --git a/OpenSim/Framework/LandUpdateArgs.cs b/OpenSim/Framework/LandUpdateArgs.cs
index ed496a1..7d6c4f2 100644
--- a/OpenSim/Framework/LandUpdateArgs.cs
+++ b/OpenSim/Framework/LandUpdateArgs.cs
@@ -49,12 +49,12 @@ namespace OpenSim.Framework
49 public UUID SnapshotID; 49 public UUID SnapshotID;
50 public Vector3 UserLocation; 50 public Vector3 UserLocation;
51 public Vector3 UserLookAt; 51 public Vector3 UserLookAt;
52 public string MediaType; 52 public string MediaType;
53 public string MediaDescription; 53 public string MediaDescription;
54 public int MediaHeight; 54 public int MediaHeight;
55 public int MediaWidth; 55 public int MediaWidth;
56 public bool MediaLoop; 56 public bool MediaLoop;
57 public bool ObscureMusic; 57 public bool ObscureMusic;
58 public bool ObscureMedia; 58 public bool ObscureMedia;
59 } 59 }
60} 60}
diff --git a/OpenSim/Framework/Lazy.cs b/OpenSim/Framework/Lazy.cs
index 8a417ac..91de4bd 100644
--- a/OpenSim/Framework/Lazy.cs
+++ b/OpenSim/Framework/Lazy.cs
@@ -1,4 +1,4 @@
1// 1//
2// Lazy.cs 2// Lazy.cs
3// 3//
4// Authors: 4// Authors:
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs
index a4587d8..f07ab7c 100644
--- a/OpenSim/Framework/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/PrimitiveBaseShape.cs
@@ -175,7 +175,7 @@ namespace OpenSim.Framework
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 /// <summary> 179 /// <summary>
180 /// Entries to store media textures on each face 180 /// Entries to store media textures on each face
181 /// </summary> 181 /// </summary>
@@ -1216,28 +1216,28 @@ namespace OpenSim.Framework
1216 prim.Properties.Permissions = new Permissions(); 1216 prim.Properties.Permissions = new Permissions();
1217 prim.Properties.SalePrice = 10; 1217 prim.Properties.SalePrice = 10;
1218 prim.Properties.SaleType = new SaleType(); 1218 prim.Properties.SaleType = new SaleType();
1219 1219
1220 return prim; 1220 return prim;
1221 } 1221 }
1222 1222
1223 /// <summary> 1223 /// <summary>
1224 /// Encapsulates a list of media entries. 1224 /// Encapsulates a list of media entries.
1225 /// </summary> 1225 /// </summary>
1226 /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more 1226 /// This class is necessary because we want to replace auto-serialization of MediaEntry with something more
1227 /// OSD like and less vulnerable to change. 1227 /// OSD like and less vulnerable to change.
1228 public class MediaList : List<MediaEntry>, IXmlSerializable 1228 public class MediaList : List<MediaEntry>, IXmlSerializable
1229 { 1229 {
1230 public const string MEDIA_TEXTURE_TYPE = "sl"; 1230 public const string MEDIA_TEXTURE_TYPE = "sl";
1231 1231
1232 public MediaList() : base() {} 1232 public MediaList() : base() {}
1233 public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {} 1233 public MediaList(IEnumerable<MediaEntry> collection) : base(collection) {}
1234 public MediaList(int capacity) : base(capacity) {} 1234 public MediaList(int capacity) : base(capacity) {}
1235 1235
1236 public XmlSchema GetSchema() 1236 public XmlSchema GetSchema()
1237 { 1237 {
1238 return null; 1238 return null;
1239 } 1239 }
1240 1240
1241 public string ToXml() 1241 public string ToXml()
1242 { 1242 {
1243 lock (this) 1243 lock (this)
@@ -1245,78 +1245,78 @@ namespace OpenSim.Framework
1245 using (StringWriter sw = new StringWriter()) 1245 using (StringWriter sw = new StringWriter())
1246 { 1246 {
1247 using (XmlTextWriter xtw = new XmlTextWriter(sw)) 1247 using (XmlTextWriter xtw = new XmlTextWriter(sw))
1248 { 1248 {
1249 xtw.WriteStartElement("OSMedia"); 1249 xtw.WriteStartElement("OSMedia");
1250 xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE); 1250 xtw.WriteAttributeString("type", MEDIA_TEXTURE_TYPE);
1251 xtw.WriteAttributeString("version", "0.1"); 1251 xtw.WriteAttributeString("version", "0.1");
1252 1252
1253 OSDArray meArray = new OSDArray(); 1253 OSDArray meArray = new OSDArray();
1254 foreach (MediaEntry me in this) 1254 foreach (MediaEntry me in this)
1255 { 1255 {
1256 OSD osd = (null == me ? new OSD() : me.GetOSD()); 1256 OSD osd = (null == me ? new OSD() : me.GetOSD());
1257 meArray.Add(osd); 1257 meArray.Add(osd);
1258 } 1258 }
1259 1259
1260 xtw.WriteStartElement("OSData"); 1260 xtw.WriteStartElement("OSData");
1261 xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray)); 1261 xtw.WriteRaw(OSDParser.SerializeLLSDXmlString(meArray));
1262 xtw.WriteEndElement(); 1262 xtw.WriteEndElement();
1263 1263
1264 xtw.WriteEndElement(); 1264 xtw.WriteEndElement();
1265 1265
1266 xtw.Flush(); 1266 xtw.Flush();
1267 return sw.ToString(); 1267 return sw.ToString();
1268 } 1268 }
1269 } 1269 }
1270 } 1270 }
1271 } 1271 }
1272 1272
1273 public void WriteXml(XmlWriter writer) 1273 public void WriteXml(XmlWriter writer)
1274 { 1274 {
1275 writer.WriteRaw(ToXml()); 1275 writer.WriteRaw(ToXml());
1276 } 1276 }
1277 1277
1278 public static MediaList FromXml(string rawXml) 1278 public static MediaList FromXml(string rawXml)
1279 { 1279 {
1280 MediaList ml = new MediaList(); 1280 MediaList ml = new MediaList();
1281 ml.ReadXml(rawXml); 1281 ml.ReadXml(rawXml);
1282 return ml; 1282 return ml;
1283 } 1283 }
1284 1284
1285 public void ReadXml(string rawXml) 1285 public void ReadXml(string rawXml)
1286 { 1286 {
1287 using (StringReader sr = new StringReader(rawXml)) 1287 using (StringReader sr = new StringReader(rawXml))
1288 { 1288 {
1289 using (XmlTextReader xtr = new XmlTextReader(sr)) 1289 using (XmlTextReader xtr = new XmlTextReader(sr))
1290 { 1290 {
1291 xtr.MoveToContent(); 1291 xtr.MoveToContent();
1292 1292
1293 string type = xtr.GetAttribute("type"); 1293 string type = xtr.GetAttribute("type");
1294 //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); 1294 //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type);
1295 1295
1296 if (type != MEDIA_TEXTURE_TYPE) 1296 if (type != MEDIA_TEXTURE_TYPE)
1297 return; 1297 return;
1298 1298
1299 xtr.ReadStartElement("OSMedia"); 1299 xtr.ReadStartElement("OSMedia");
1300 1300
1301 OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); 1301 OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml());
1302 foreach (OSD osdMe in osdMeArray) 1302 foreach (OSD osdMe in osdMeArray)
1303 { 1303 {
1304 MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); 1304 MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry());
1305 Add(me); 1305 Add(me);
1306 } 1306 }
1307 1307
1308 xtr.ReadEndElement(); 1308 xtr.ReadEndElement();
1309 } 1309 }
1310 } 1310 }
1311 } 1311 }
1312 1312
1313 public void ReadXml(XmlReader reader) 1313 public void ReadXml(XmlReader reader)
1314 { 1314 {
1315 if (reader.IsEmptyElement) 1315 if (reader.IsEmptyElement)
1316 return; 1316 return;
1317 1317
1318 ReadXml(reader.ReadInnerXml()); 1318 ReadXml(reader.ReadInnerXml());
1319 } 1319 }
1320 } 1320 }
1321 } 1321 }
1322} \ No newline at end of file 1322}
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index e36a72b..a006f3e 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -98,9 +98,9 @@ namespace OpenSim.Framework
98 98
99 [Serializable] 99 [Serializable]
100 public class SimpleRegionInfo 100 public class SimpleRegionInfo
101 { 101 {
102// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 102// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
103 103
104 /// <summary> 104 /// <summary>
105 /// The port by which http communication occurs with the region (most noticeably, CAPS communication) 105 /// The port by which http communication occurs with the region (most noticeably, CAPS communication)
106 /// </summary> 106 /// </summary>
@@ -345,7 +345,7 @@ namespace OpenSim.Framework
345 public string proxyUrl = ""; 345 public string proxyUrl = "";
346 public int ProxyOffset = 0; 346 public int ProxyOffset = 0;
347 public string regionSecret = UUID.Random().ToString(); 347 public string regionSecret = UUID.Random().ToString();
348 348
349 public string osSecret; 349 public string osSecret;
350 350
351 public UUID lastMapUUID = UUID.Zero; 351 public UUID lastMapUUID = UUID.Zero;
@@ -700,7 +700,7 @@ namespace OpenSim.Framework
700 700
701 RegionID = new UUID(regionUUID); 701 RegionID = new UUID(regionUUID);
702 originRegionID = RegionID; // What IS this?! 702 originRegionID = RegionID; // What IS this?!
703 703
704 RegionName = name; 704 RegionName = name;
705 string location = config.GetString("Location", String.Empty); 705 string location = config.GetString("Location", String.Empty);
706 706
@@ -721,7 +721,7 @@ namespace OpenSim.Framework
721 721
722 // Internal IP 722 // Internal IP
723 IPAddress address; 723 IPAddress address;
724 724
725 if (config.Contains("InternalAddress")) 725 if (config.Contains("InternalAddress"))
726 { 726 {
727 address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty)); 727 address = IPAddress.Parse(config.GetString("InternalAddress", String.Empty));
@@ -775,7 +775,7 @@ namespace OpenSim.Framework
775 { 775 {
776 m_externalHostName = Util.GetLocalHost().ToString(); 776 m_externalHostName = Util.GetLocalHost().ToString();
777 m_log.InfoFormat( 777 m_log.InfoFormat(
778 "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}", 778 "[REGIONINFO]: Resolving SYSTEMIP to {0} for external hostname of region {1}",
779 m_externalHostName, name); 779 m_externalHostName, name);
780 } 780 }
781 else 781 else
@@ -910,16 +910,16 @@ namespace OpenSim.Framework
910 910
911 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 911 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
912 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); 912 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
913 913
914 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 914 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
915 "Maximum size for physical prims", m_physPrimMax.ToString(), true); 915 "Maximum size for physical prims", m_physPrimMax.ToString(), true);
916 916
917 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, 917 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
918 "Clamp prims to max size", m_clampPrimSize.ToString(), true); 918 "Clamp prims to max size", m_clampPrimSize.ToString(), true);
919 919
920 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 920 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
921 "Max objects this sim will hold", m_objectCapacity.ToString(), true); 921 "Max objects this sim will hold", m_objectCapacity.ToString(), true);
922 922
923 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID, 923 configMember.addConfigurationOption("scope_id", ConfigurationOption.ConfigurationTypes.TYPE_UUID,
924 "Scope ID for this region", ScopeID.ToString(), true); 924 "Scope ID for this region", ScopeID.ToString(), true);
925 925
@@ -957,16 +957,16 @@ namespace OpenSim.Framework
957 957
958 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 958 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
959 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); 959 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
960 960
961 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 961 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
962 "Maximum size for nonphysical prims", "0", true); 962 "Maximum size for nonphysical prims", "0", true);
963 963
964 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 964 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
965 "Maximum size for physical prims", "0", true); 965 "Maximum size for physical prims", "0", true);
966 966
967 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, 967 configMember.addConfigurationOption("clamp_prim_size", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
968 "Clamp prims to max size", "false", true); 968 "Clamp prims to max size", "false", true);
969 969
970 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 970 configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
971 "Max objects this sim will hold", "0", true); 971 "Max objects this sim will hold", "0", true);
972 972
diff --git a/OpenSim/Framework/SLUtil.cs b/OpenSim/Framework/SLUtil.cs
index a489806..9941a7f 100644
--- a/OpenSim/Framework/SLUtil.cs
+++ b/OpenSim/Framework/SLUtil.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Framework
46 case AssetType.Texture: 46 case AssetType.Texture:
47 return "image/x-j2c"; 47 return "image/x-j2c";
48 case AssetType.Sound: 48 case AssetType.Sound:
49 return "application/ogg"; 49 return "audio/ogg";
50 case AssetType.CallingCard: 50 case AssetType.CallingCard:
51 return "application/vnd.ll.callingcard"; 51 return "application/vnd.ll.callingcard";
52 case AssetType.Landmark: 52 case AssetType.Landmark:
@@ -98,8 +98,6 @@ namespace OpenSim.Framework
98 return "application/vnd.ll.outfitfolder"; 98 return "application/vnd.ll.outfitfolder";
99 case AssetType.MyOutfitsFolder: 99 case AssetType.MyOutfitsFolder:
100 return "application/vnd.ll.myoutfitsfolder"; 100 return "application/vnd.ll.myoutfitsfolder";
101 case AssetType.InboxFolder:
102 return "application/vnd.ll.inboxfolder";
103 case AssetType.Unknown: 101 case AssetType.Unknown:
104 default: 102 default:
105 return "application/octet-stream"; 103 return "application/octet-stream";
@@ -128,7 +126,7 @@ namespace OpenSim.Framework
128 case InventoryType.Object: 126 case InventoryType.Object:
129 return "application/vnd.ll.primitive"; 127 return "application/vnd.ll.primitive";
130 case InventoryType.Sound: 128 case InventoryType.Sound:
131 return "application/ogg"; 129 return "audio/ogg";
132 case InventoryType.Snapshot: 130 case InventoryType.Snapshot:
133 case InventoryType.Texture: 131 case InventoryType.Texture:
134 return "image/x-j2c"; 132 return "image/x-j2c";
@@ -147,6 +145,7 @@ namespace OpenSim.Framework
147 case "image/jp2": 145 case "image/jp2":
148 return (sbyte)AssetType.Texture; 146 return (sbyte)AssetType.Texture;
149 case "application/ogg": 147 case "application/ogg":
148 case "audio/ogg":
150 return (sbyte)AssetType.Sound; 149 return (sbyte)AssetType.Sound;
151 case "application/vnd.ll.callingcard": 150 case "application/vnd.ll.callingcard":
152 case "application/x-metaverse-callingcard": 151 case "application/x-metaverse-callingcard":
@@ -209,8 +208,6 @@ namespace OpenSim.Framework
209 return (sbyte)AssetType.OutfitFolder; 208 return (sbyte)AssetType.OutfitFolder;
210 case "application/vnd.ll.myoutfitsfolder": 209 case "application/vnd.ll.myoutfitsfolder":
211 return (sbyte)AssetType.MyOutfitsFolder; 210 return (sbyte)AssetType.MyOutfitsFolder;
212 case "application/vnd.ll.inboxfolder":
213 return (sbyte)AssetType.InboxFolder;
214 case "application/octet-stream": 211 case "application/octet-stream":
215 default: 212 default:
216 return (sbyte)AssetType.Unknown; 213 return (sbyte)AssetType.Unknown;
@@ -227,6 +224,7 @@ namespace OpenSim.Framework
227 case "image/jpeg": 224 case "image/jpeg":
228 return (sbyte)InventoryType.Texture; 225 return (sbyte)InventoryType.Texture;
229 case "application/ogg": 226 case "application/ogg":
227 case "audio/ogg":
230 case "audio/x-wav": 228 case "audio/x-wav":
231 return (sbyte)InventoryType.Sound; 229 return (sbyte)InventoryType.Sound;
232 case "application/vnd.ll.callingcard": 230 case "application/vnd.ll.callingcard":
diff --git a/OpenSim/Framework/Serialization/ArchiveConstants.cs b/OpenSim/Framework/Serialization/ArchiveConstants.cs
index 3143e3b..7a9b33d 100644
--- a/OpenSim/Framework/Serialization/ArchiveConstants.cs
+++ b/OpenSim/Framework/Serialization/ArchiveConstants.cs
@@ -157,9 +157,9 @@ namespace OpenSim.Framework.Serialization
157 public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos) 157 public static string CreateOarObjectFilename(string objectName, UUID uuid, Vector3 pos)
158 { 158 {
159 return string.Format( 159 return string.Format(
160 OAR_OBJECT_FILENAME_TEMPLATE, objectName, 160 OAR_OBJECT_FILENAME_TEMPLATE, objectName,
161 Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z), 161 Math.Round(pos.X), Math.Round(pos.Y), Math.Round(pos.Z),
162 uuid); 162 uuid);
163 } 163 }
164 164
165 /// <summary> 165 /// <summary>
@@ -171,9 +171,9 @@ namespace OpenSim.Framework.Serialization
171 /// <returns></returns> 171 /// <returns></returns>
172 public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos) 172 public static string CreateOarObjectPath(string objectName, UUID uuid, Vector3 pos)
173 { 173 {
174 return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos); 174 return OBJECTS_PATH + CreateOarObjectFilename(objectName, uuid, pos);
175 } 175 }
176 176
177 /// <summary> 177 /// <summary>
178 /// Extract a plain path from an IAR path 178 /// Extract a plain path from an IAR path
179 /// </summary> 179 /// </summary>
@@ -184,18 +184,18 @@ namespace OpenSim.Framework.Serialization
184 List<string> plainDirs = new List<string>(); 184 List<string> plainDirs = new List<string>();
185 185
186 string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries); 186 string[] iarDirs = iarPath.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
187 187
188 foreach (string iarDir in iarDirs) 188 foreach (string iarDir in iarDirs)
189 { 189 {
190 if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR)) 190 if (!iarDir.Contains(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR))
191 plainDirs.Add(iarDir); 191 plainDirs.Add(iarDir);
192 192
193 int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR); 193 int i = iarDir.LastIndexOf(ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR);
194 194
195 plainDirs.Add(iarDir.Remove(i)); 195 plainDirs.Add(iarDir.Remove(i));
196 } 196 }
197 197
198 return string.Join("/", plainDirs.ToArray()); 198 return string.Join("/", plainDirs.ToArray());
199 } 199 }
200 } 200 }
201} \ No newline at end of file 201}
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index d20f8c9..452df38 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -51,7 +51,7 @@ namespace OpenSim.Framework.Servers.HttpServer
51 { 51 {
52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 52 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
53 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); 53 private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
54 54
55 private volatile int NotSocketErrors = 0; 55 private volatile int NotSocketErrors = 0;
56 public volatile bool HTTPDRunning = false; 56 public volatile bool HTTPDRunning = false;
57 57
@@ -160,7 +160,7 @@ namespace OpenSim.Framework.Servers.HttpServer
160 m_rpcHandlers[method] = handler; 160 m_rpcHandlers[method] = handler;
161 m_rpcHandlersKeepAlive[method] = keepAlive; // default 161 m_rpcHandlersKeepAlive[method] = keepAlive; // default
162 } 162 }
163 163
164 return true; 164 return true;
165 } 165 }
166 166
@@ -182,7 +182,7 @@ namespace OpenSim.Framework.Servers.HttpServer
182 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler) 182 public bool AddHTTPHandler(string methodName, GenericHTTPMethod handler)
183 { 183 {
184 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName); 184 //m_log.DebugFormat("[BASE HTTP SERVER]: Registering {0}", methodName);
185 185
186 lock (m_HTTPHandlers) 186 lock (m_HTTPHandlers)
187 { 187 {
188 if (!m_HTTPHandlers.ContainsKey(methodName)) 188 if (!m_HTTPHandlers.ContainsKey(methodName))
@@ -204,14 +204,14 @@ namespace OpenSim.Framework.Servers.HttpServer
204 if (!m_pollHandlers.ContainsKey(methodName)) 204 if (!m_pollHandlers.ContainsKey(methodName))
205 { 205 {
206 m_pollHandlers.Add(methodName,args); 206 m_pollHandlers.Add(methodName,args);
207 pollHandlerResult = true; 207 pollHandlerResult = true;
208 } 208 }
209 } 209 }
210 210
211 if (pollHandlerResult) 211 if (pollHandlerResult)
212 return AddHTTPHandler(methodName, handler); 212 return AddHTTPHandler(methodName, handler);
213 213
214 return false; 214 return false;
215 } 215 }
216 216
217 // Note that the agent string is provided simply to differentiate 217 // Note that the agent string is provided simply to differentiate
@@ -257,51 +257,51 @@ namespace OpenSim.Framework.Servers.HttpServer
257 { 257 {
258 IHttpClientContext context = (IHttpClientContext)source; 258 IHttpClientContext context = (IHttpClientContext)source;
259 IHttpRequest request = args.Request; 259 IHttpRequest request = args.Request;
260 260
261 PollServiceEventArgs psEvArgs; 261 PollServiceEventArgs psEvArgs;
262 262
263 if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) 263 if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
264 { 264 {
265 PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); 265 PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
266 266
267 if (psEvArgs.Request != null) 267 if (psEvArgs.Request != null)
268 { 268 {
269 OSHttpRequest req = new OSHttpRequest(context, request); 269 OSHttpRequest req = new OSHttpRequest(context, request);
270 270
271 Stream requestStream = req.InputStream; 271 Stream requestStream = req.InputStream;
272 272
273 Encoding encoding = Encoding.UTF8; 273 Encoding encoding = Encoding.UTF8;
274 StreamReader reader = new StreamReader(requestStream, encoding); 274 StreamReader reader = new StreamReader(requestStream, encoding);
275 275
276 string requestBody = reader.ReadToEnd(); 276 string requestBody = reader.ReadToEnd();
277 277
278 Hashtable keysvals = new Hashtable(); 278 Hashtable keysvals = new Hashtable();
279 Hashtable headervals = new Hashtable(); 279 Hashtable headervals = new Hashtable();
280 280
281 string[] querystringkeys = req.QueryString.AllKeys; 281 string[] querystringkeys = req.QueryString.AllKeys;
282 string[] rHeaders = req.Headers.AllKeys; 282 string[] rHeaders = req.Headers.AllKeys;
283 283
284 keysvals.Add("body", requestBody); 284 keysvals.Add("body", requestBody);
285 keysvals.Add("uri", req.RawUrl); 285 keysvals.Add("uri", req.RawUrl);
286 keysvals.Add("content-type", req.ContentType); 286 keysvals.Add("content-type", req.ContentType);
287 keysvals.Add("http-method", req.HttpMethod); 287 keysvals.Add("http-method", req.HttpMethod);
288 288
289 foreach (string queryname in querystringkeys) 289 foreach (string queryname in querystringkeys)
290 { 290 {
291 keysvals.Add(queryname, req.QueryString[queryname]); 291 keysvals.Add(queryname, req.QueryString[queryname]);
292 } 292 }
293 293
294 foreach (string headername in rHeaders) 294 foreach (string headername in rHeaders)
295 { 295 {
296 headervals[headername] = req.Headers[headername]; 296 headervals[headername] = req.Headers[headername];
297 } 297 }
298 298
299 keysvals.Add("headers", headervals); 299 keysvals.Add("headers", headervals);
300 keysvals.Add("querystringkeys", querystringkeys); 300 keysvals.Add("querystringkeys", querystringkeys);
301 301
302 psEvArgs.Request(psreq.RequestID, keysvals); 302 psEvArgs.Request(psreq.RequestID, keysvals);
303 } 303 }
304 304
305 m_PollServiceManager.Enqueue(psreq); 305 m_PollServiceManager.Enqueue(psreq);
306 } 306 }
307 else 307 else
@@ -348,10 +348,10 @@ namespace OpenSim.Framework.Servers.HttpServer
348 { 348 {
349 try 349 try
350 { 350 {
351// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); 351// m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl);
352 352
353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true); 353 Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
354 354
355 // This is the REST agent interface. We require an agent to properly identify 355 // This is the REST agent interface. We require an agent to properly identify
356 // itself. If the REST handler recognizes the prefix it will attempt to 356 // itself. If the REST handler recognizes the prefix it will attempt to
357 // satisfy the request. If it is not recognizable, and no damage has occurred 357 // satisfy the request. If it is not recognizable, and no damage has occurred
@@ -456,7 +456,7 @@ namespace OpenSim.Framework.Servers.HttpServer
456 } 456 }
457 457
458 request.InputStream.Close(); 458 request.InputStream.Close();
459 459
460 // HTTP IN support. The script engine taes it from here 460 // HTTP IN support. The script engine taes it from here
461 // Nothing to worry about for us. 461 // Nothing to worry about for us.
462 // 462 //
@@ -540,7 +540,7 @@ namespace OpenSim.Framework.Servers.HttpServer
540 HandleLLSDRequests(request, response); 540 HandleLLSDRequests(request, response);
541 return; 541 return;
542 } 542 }
543 543
544// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); 544// m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl);
545 if (DoWeHaveAHTTPHandler(request.RawUrl)) 545 if (DoWeHaveAHTTPHandler(request.RawUrl))
546 { 546 {
@@ -594,7 +594,7 @@ namespace OpenSim.Framework.Servers.HttpServer
594 } 594 }
595 } 595 }
596 } 596 }
597 597
598 if (String.IsNullOrEmpty(bestMatch)) 598 if (String.IsNullOrEmpty(bestMatch))
599 { 599 {
600 streamHandler = null; 600 streamHandler = null;
@@ -641,7 +641,7 @@ namespace OpenSim.Framework.Servers.HttpServer
641 private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) 641 private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler)
642 { 642 {
643// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); 643// m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey);
644 644
645 string bestMatch = null; 645 string bestMatch = null;
646 646
647 lock (m_HTTPHandlers) 647 lock (m_HTTPHandlers)
@@ -727,14 +727,14 @@ namespace OpenSim.Framework.Servers.HttpServer
727 { 727 {
728 xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1] 728 xmlRprcRequest.Params.Add(request.RemoteIPEndPoint); // Param[1]
729 XmlRpcResponse xmlRpcResponse; 729 XmlRpcResponse xmlRpcResponse;
730 730
731 XmlRpcMethod method; 731 XmlRpcMethod method;
732 bool methodWasFound; 732 bool methodWasFound;
733 lock (m_rpcHandlers) 733 lock (m_rpcHandlers)
734 { 734 {
735 methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); 735 methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
736 } 736 }
737 737
738 if (methodWasFound) 738 if (methodWasFound)
739 { 739 {
740 xmlRprcRequest.Params.Add(request.Url); // Param[2] 740 xmlRprcRequest.Params.Add(request.Url); // Param[2]
@@ -766,10 +766,10 @@ namespace OpenSim.Framework.Servers.HttpServer
766 else 766 else
767 { 767 {
768 xmlRpcResponse = new XmlRpcResponse(); 768 xmlRpcResponse = new XmlRpcResponse();
769 769
770 // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php 770 // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
771 xmlRpcResponse.SetFault( 771 xmlRpcResponse.SetFault(
772 XmlRpcErrorCodes.SERVER_ERROR_METHOD, 772 XmlRpcErrorCodes.SERVER_ERROR_METHOD,
773 String.Format("Requested method [{0}] not found", methodName)); 773 String.Format("Requested method [{0}] not found", methodName));
774 } 774 }
775 775
@@ -786,11 +786,11 @@ namespace OpenSim.Framework.Servers.HttpServer
786 response.KeepAlive = false; 786 response.KeepAlive = false;
787 787
788 m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl); 788 m_log.ErrorFormat("[BASE HTTP SERVER]: Handler not found for http request {0}", request.RawUrl);
789 789
790 response.SendChunked = false; 790 response.SendChunked = false;
791 response.ContentLength64 = buf.Length; 791 response.ContentLength64 = buf.Length;
792 response.ContentEncoding = Encoding.UTF8; 792 response.ContentEncoding = Encoding.UTF8;
793 793
794 try 794 try
795 { 795 {
796 response.OutputStream.Write(buf, 0, buf.Length); 796 response.OutputStream.Write(buf, 0, buf.Length);
@@ -872,13 +872,13 @@ namespace OpenSim.Framework.Servers.HttpServer
872 872
873 OSD llsdRequest = null; 873 OSD llsdRequest = null;
874 OSD llsdResponse = null; 874 OSD llsdResponse = null;
875 875
876 bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest")); 876 bool LegacyLLSDLoginLibOMV = (requestBody.Contains("passwd") && requestBody.Contains("mac") && requestBody.Contains("viewer_digest"));
877 877
878 if (requestBody.Length == 0) 878 if (requestBody.Length == 0)
879 // Get Request 879 // Get Request
880 { 880 {
881 requestBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd><map><key>request</key><string>get</string></map></llsd>"; 881 requestBody = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><llsd><map><key>request</key><string>get</string></map></llsd>";
882 } 882 }
883 try 883 try
884 { 884 {
@@ -1090,7 +1090,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1090 string bestMatch = null; 1090 string bestMatch = null;
1091 1091
1092 //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery); 1092 //m_log.DebugFormat("[BASE HTTP HANDLER]: Checking if we have an HTTP handler for {0}", searchquery);
1093 1093
1094 lock (m_HTTPHandlers) 1094 lock (m_HTTPHandlers)
1095 { 1095 {
1096 foreach (string pattern in m_HTTPHandlers.Keys) 1096 foreach (string pattern in m_HTTPHandlers.Keys)
@@ -1156,7 +1156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1156 // You have to specifically register for '/' and to get it, you must specificaly request it 1156 // You have to specifically register for '/' and to get it, you must specificaly request it
1157 // 1157 //
1158 if (pattern == "/" && searchquery == "/" || pattern != "/") 1158 if (pattern == "/" && searchquery == "/" || pattern != "/")
1159 bestMatch = pattern; 1159 bestMatch = pattern;
1160 } 1160 }
1161 } 1161 }
1162 } 1162 }
@@ -1236,11 +1236,11 @@ namespace OpenSim.Framework.Servers.HttpServer
1236 } 1236 }
1237 1237
1238 public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) 1238 public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
1239 { 1239 {
1240// m_log.DebugFormat( 1240// m_log.DebugFormat(
1241// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", 1241// "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}",
1242// request.RawUrl, request.HttpMethod); 1242// request.RawUrl, request.HttpMethod);
1243 1243
1244 switch (request.HttpMethod) 1244 switch (request.HttpMethod)
1245 { 1245 {
1246 case "OPTIONS": 1246 case "OPTIONS":
@@ -1256,7 +1256,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1256 private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) 1256 private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
1257 { 1257 {
1258// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl); 1258// m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl);
1259 1259
1260 // This is a test. There's a workable alternative.. as this way sucks. 1260 // This is a test. There's a workable alternative.. as this way sucks.
1261 // We'd like to put this into a text file parhaps that's easily editable. 1261 // We'd like to put this into a text file parhaps that's easily editable.
1262 // 1262 //
@@ -1391,7 +1391,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1391 1391
1392// m_log.DebugFormat( 1392// m_log.DebugFormat(
1393// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery); 1393// "[BASE HTTP HANDLER]: TryGetHTTPHandlerPathBased() looking for HTTP handler to match {0}", searchquery);
1394 1394
1395 lock (m_HTTPHandlers) 1395 lock (m_HTTPHandlers)
1396 { 1396 {
1397 foreach (string pattern in m_HTTPHandlers.Keys) 1397 foreach (string pattern in m_HTTPHandlers.Keys)
@@ -1452,7 +1452,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1452 1452
1453 //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this 1453 //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
1454 //and should check for NullReferenceExceptions 1454 //and should check for NullReferenceExceptions
1455 1455
1456 if (string.IsNullOrEmpty(contentType)) 1456 if (string.IsNullOrEmpty(contentType))
1457 { 1457 {
1458 contentType = "text/html"; 1458 contentType = "text/html";
@@ -1472,8 +1472,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1472 1472
1473 byte[] buffer; 1473 byte[] buffer;
1474 1474
1475 if (!(contentType.Contains("image") 1475 if (!(contentType.Contains("image")
1476 || contentType.Contains("x-shockwave-flash") 1476 || contentType.Contains("x-shockwave-flash")
1477 || contentType.Contains("application/x-oar"))) 1477 || contentType.Contains("application/x-oar")))
1478 { 1478 {
1479 // Text 1479 // Text
@@ -1504,7 +1504,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1504 { 1504 {
1505 response.OutputStream.Flush(); 1505 response.OutputStream.Flush();
1506 response.Send(); 1506 response.Send();
1507 1507
1508 //if (!response.KeepAlive && response.ReuseContext) 1508 //if (!response.KeepAlive && response.ReuseContext)
1509 // response.FreeContext(); 1509 // response.FreeContext();
1510 } 1510 }
@@ -1611,11 +1611,11 @@ namespace OpenSim.Framework.Servers.HttpServer
1611 m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port); 1611 m_httpListener2 = CoolHTTPListener.Create(m_listenIPAddress, (int)m_port);
1612 m_httpListener2.ExceptionThrown += httpServerException; 1612 m_httpListener2.ExceptionThrown += httpServerException;
1613 m_httpListener2.LogWriter = httpserverlog; 1613 m_httpListener2.LogWriter = httpserverlog;
1614 1614
1615 // Uncomment this line in addition to those in HttpServerLogWriter 1615 // Uncomment this line in addition to those in HttpServerLogWriter
1616 // if you want more detailed trace information from the HttpServer 1616 // if you want more detailed trace information from the HttpServer
1617 //m_httpListener2.UseTraceLogs = true; 1617 //m_httpListener2.UseTraceLogs = true;
1618 1618
1619 //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; 1619 //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
1620 } 1620 }
1621 else 1621 else
@@ -1643,8 +1643,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1643 { 1643 {
1644 m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message); 1644 m_log.Error("[BASE HTTP SERVER]: Error - " + e.Message);
1645 m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?"); 1645 m_log.Error("[BASE HTTP SERVER]: Tip: Do you have permission to listen on port " + m_port + ", " + m_sslport + "?");
1646 1646
1647 // We want this exception to halt the entire server since in current configurations we aren't too 1647 // We want this exception to halt the entire server since in current configurations we aren't too
1648 // useful without inbound HTTP. 1648 // useful without inbound HTTP.
1649 throw e; 1649 throw e;
1650 } 1650 }
@@ -1656,7 +1656,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1656 { 1656 {
1657 case SocketError.NotSocket: 1657 case SocketError.NotSocket:
1658 NotSocketErrors++; 1658 NotSocketErrors++;
1659 1659
1660 break; 1660 break;
1661 } 1661 }
1662 } 1662 }
@@ -1686,12 +1686,11 @@ namespace OpenSim.Framework.Servers.HttpServer
1686 m_httpListener2.LogWriter = null; 1686 m_httpListener2.LogWriter = null;
1687 m_httpListener2.RequestReceived -= OnRequest; 1687 m_httpListener2.RequestReceived -= OnRequest;
1688 m_httpListener2.Stop(); 1688 m_httpListener2.Stop();
1689 } 1689 }
1690 catch (NullReferenceException) 1690 catch (NullReferenceException)
1691 { 1691 {
1692 m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer."); 1692 m_log.Warn("[BASE HTTP SERVER]: Null Reference when stopping HttpServer.");
1693 } 1693 }
1694
1695 } 1694 }
1696 1695
1697 public void RemoveStreamHandler(string httpMethod, string path) 1696 public void RemoveStreamHandler(string httpMethod, string path)
@@ -1712,7 +1711,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1712 m_HTTPHandlers.Remove(path); 1711 m_HTTPHandlers.Remove(path);
1713 return; 1712 return;
1714 } 1713 }
1715 1714
1716 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); 1715 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
1717 } 1716 }
1718 } 1717 }
@@ -1728,7 +1727,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1728 } 1727 }
1729 1728
1730 RemoveHTTPHandler(httpMethod, path); 1729 RemoveHTTPHandler(httpMethod, path);
1731
1732 } 1730 }
1733 1731
1734 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler) 1732 public bool RemoveAgentHandler(string agent, IHttpAgentHandler handler)
@@ -1759,7 +1757,6 @@ namespace OpenSim.Framework.Servers.HttpServer
1759 } 1757 }
1760 } 1758 }
1761 1759
1762
1763 public bool RemoveLLSDHandler(string path, LLSDMethod handler) 1760 public bool RemoveLLSDHandler(string path, LLSDMethod handler)
1764 { 1761 {
1765 try 1762 try
@@ -1833,7 +1830,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1833 oresp = osresp; 1830 oresp = osresp;
1834 } 1831 }
1835 } 1832 }
1836 1833
1837 /// <summary> 1834 /// <summary>
1838 /// Relays HttpServer log messages to our own logging mechanism. 1835 /// Relays HttpServer log messages to our own logging mechanism.
1839 /// </summary> 1836 /// </summary>
@@ -1852,7 +1849,7 @@ namespace OpenSim.Framework.Servers.HttpServer
1852 { 1849 {
1853 case LogPrio.Trace: 1850 case LogPrio.Trace:
1854 m_log.DebugFormat("[{0}]: {1}", source, message); 1851 m_log.DebugFormat("[{0}]: {1}", source, message);
1855 break; 1852 break;
1856 case LogPrio.Debug: 1853 case LogPrio.Debug:
1857 m_log.DebugFormat("[{0}]: {1}", source, message); 1854 m_log.DebugFormat("[{0}]: {1}", source, message);
1858 break; 1855 break;
@@ -1872,8 +1869,8 @@ namespace OpenSim.Framework.Servers.HttpServer
1872 break; 1869 break;
1873 } 1870 }
1874 */ 1871 */
1875 1872
1876 return; 1873 return;
1877 } 1874 }
1878 } 1875 }
1879} \ No newline at end of file 1876}
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index f3ac191..4ae370b 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -49,7 +49,7 @@ namespace OpenSim
49 49
50 public static string GetVersionString(string versionNumber, Flavour flavour) 50 public static string GetVersionString(string versionNumber, Flavour flavour)
51 { 51 {
52 string versionString = "OpenSim " + versionNumber + " (" + flavour + ")"; 52 string versionString = "OpenSim " + versionNumber + " " + flavour;
53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH); 53 return versionString.PadRight(VERSIONINFO_VERSION_LENGTH);
54 } 54 }
55 55
diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs
index 2cb7895..df5b936 100644
--- a/OpenSim/Framework/TaskInventoryItem.cs
+++ b/OpenSim/Framework/TaskInventoryItem.cs
@@ -348,15 +348,15 @@ namespace OpenSim.Framework
348 /// <param name="partID">The new part ID to which this item belongs</param> 348 /// <param name="partID">The new part ID to which this item belongs</param>
349 public void ResetIDs(UUID partID) 349 public void ResetIDs(UUID partID)
350 { 350 {
351 _oldID = _itemID; 351 OldItemID = ItemID;
352 _itemID = UUID.Random(); 352 ItemID = UUID.Random();
353 _parentPartID = partID; 353 ParentPartID = partID;
354 _parentID = partID; 354 ParentID = partID;
355 } 355 }
356 356
357 public TaskInventoryItem() 357 public TaskInventoryItem()
358 { 358 {
359 _creationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; 359 CreationDate = (uint)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
360 } 360 }
361 } 361 }
362} 362}
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs
index b860cf6..d120f03 100644
--- a/OpenSim/Region/Application/Application.cs
+++ b/OpenSim/Region/Application/Application.cs
@@ -225,7 +225,7 @@ namespace OpenSim
225 } 225 }
226 } 226 }
227 MainConsole.Instance = null; 227 MainConsole.Instance = null;
228 } 228 }
229 */ 229 */
230 configSource.Alias.AddAlias("On", true); 230 configSource.Alias.AddAlias("On", true);
231 configSource.Alias.AddAlias("Off", false); 231 configSource.Alias.AddAlias("Off", false);
diff --git a/OpenSim/Region/Application/ConfigurationLoader.cs b/OpenSim/Region/Application/ConfigurationLoader.cs
index e69e3fc..e2e0640 100644
--- a/OpenSim/Region/Application/ConfigurationLoader.cs
+++ b/OpenSim/Region/Application/ConfigurationLoader.cs
@@ -345,10 +345,6 @@ namespace OpenSim
345 345
346 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin"); 346 m_configSettings.StorageDll = startupConfig.GetString("storage_plugin");
347 347
348 m_configSettings.StorageConnectionString
349 = startupConfig.GetString("storage_connection_string");
350 m_configSettings.EstateConnectionString
351 = startupConfig.GetString("estate_connection_string", m_configSettings.StorageConnectionString);
352 m_configSettings.ClientstackDll 348 m_configSettings.ClientstackDll
353 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll"); 349 = startupConfig.GetString("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
354 } 350 }
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 945da7d..6094bad 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -152,7 +152,7 @@ namespace OpenSim
152 RegisterConsoleCommands(); 152 RegisterConsoleCommands();
153 153
154 base.StartupSpecific(); 154 base.StartupSpecific();
155 155
156 MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler()); 156 MainServer.Instance.AddStreamHandler(new OpenSim.SimStatusHandler());
157 MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this)); 157 MainServer.Instance.AddStreamHandler(new OpenSim.XSimStatusHandler(this));
158 if (userStatsURI != String.Empty) 158 if (userStatsURI != String.Empty)
@@ -192,7 +192,7 @@ namespace OpenSim
192 // Hook up to the watchdog timer 192 // Hook up to the watchdog timer
193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler; 193 Watchdog.OnWatchdogTimeout += WatchdogTimeoutHandler;
194 194
195 PrintFileToConsole("startuplogo.txt"); 195 PrintFileToConsole("startuplogo.txt");
196 196
197 // For now, start at the 'root' level by default 197 // For now, start at the 'root' level by default
198 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it 198 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it
@@ -218,8 +218,8 @@ namespace OpenSim
218 218
219 m_console.Commands.AddCommand("region", false, "debug packet", 219 m_console.Commands.AddCommand("region", false, "debug packet",
220 "debug packet <level>", 220 "debug packet <level>",
221 "Turn on packet debugging", 221 "Turn on packet debugging",
222 "If level > 255 then all incoming and outgoing packets are logged.\n" 222 "If level > 255 then all incoming and outgoing packets are logged.\n"
223 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" 223 + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n"
224 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" 224 + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n"
225 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" 225 + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n"
@@ -316,7 +316,7 @@ namespace OpenSim
316 m_console.Commands.AddCommand("region", false, "create region", 316 m_console.Commands.AddCommand("region", false, "create region",
317 "create region [\"region name\"] <region_file.ini>", 317 "create region [\"region name\"] <region_file.ini>",
318 "Create a new region.", 318 "Create a new region.",
319 "The settings for \"region name\" are read from <region_file.ini>." 319 "The settings for \"region name\" are read from <region_file.ini> in your Regions directory."
320 + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine 320 + " If \"region name\" does not exist in <region_file.ini>, it will be added." + Environment.NewLine
321 + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine 321 + "Without \"region name\", the first region found in <region_file.ini> will be created." + Environment.NewLine
322 + "If <region_file.ini> does not exist, it will be created.", 322 + "If <region_file.ini> does not exist, it will be created.",
@@ -552,19 +552,20 @@ namespace OpenSim
552 regionFile = Path.Combine(regionsDir, regionFile); 552 regionFile = Path.Combine(regionsDir, regionFile);
553 } 553 }
554 554
555 RegionInfo regInfo; 555 RegionInfo regInfo;
556 if (isXml) 556 if (isXml)
557 { 557 {
558 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source); 558 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source);
559 } 559 }
560 else 560 else
561 { 561 {
562 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName); 562 regInfo = new RegionInfo(regionName, regionFile, false, ConfigSource.Source, regionName);
563 } 563 }
564
564 IScene scene; 565 IScene scene;
565 PopulateRegionEstateInfo(regInfo); 566 PopulateRegionEstateInfo(regInfo);
566 CreateRegion(regInfo, true, out scene); 567 CreateRegion(regInfo, true, out scene);
567 regInfo.EstateSettings.Save(); 568 regInfo.EstateSettings.Save();
568 } 569 }
569 570
570 /// <summary> 571 /// <summary>
@@ -942,7 +943,7 @@ namespace OpenSim
942 delegate(Scene scene) 943 delegate(Scene scene)
943 { 944 {
944 MainConsole.Instance.Output(String.Format( 945 MainConsole.Instance.Output(String.Format(
945 "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}", 946 "Region Name: {0}, Region XLoc: {1}, Region YLoc: {2}, Region Port: {3}",
946 scene.RegionInfo.RegionName, 947 scene.RegionInfo.RegionName,
947 scene.RegionInfo.RegionLocX, 948 scene.RegionInfo.RegionLocX,
948 scene.RegionInfo.RegionLocY, 949 scene.RegionInfo.RegionLocY,
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs
index ec3193c..c5ee385 100644
--- a/OpenSim/Region/Application/OpenSimBase.cs
+++ b/OpenSim/Region/Application/OpenSimBase.cs
@@ -45,6 +45,7 @@ using OpenSim.Region.Framework;
45using OpenSim.Region.Framework.Interfaces; 45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Region.Framework.Scenes; 46using OpenSim.Region.Framework.Scenes;
47using OpenSim.Region.Physics.Manager; 47using OpenSim.Region.Physics.Manager;
48using OpenSim.Server.Base;
48 49
49namespace OpenSim 50namespace OpenSim
50{ 51{
@@ -195,6 +196,24 @@ namespace OpenSim
195 m_permsModules = new List<string>(permissionModules.Split(',')); 196 m_permsModules = new List<string>(permissionModules.Split(','));
196 } 197 }
197 198
199 // Load the simulation data service
200 IConfig simDataConfig = m_config.Source.Configs["SimulationDataStore"];
201 if (simDataConfig == null)
202 throw new Exception("Configuration file is missing the [SimulationDataStore] section");
203 string module = simDataConfig.GetString("LocalServiceModule", String.Empty);
204 if (String.IsNullOrEmpty(module))
205 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [SimulationDataStore] section");
206 m_simulationDataService = ServerUtils.LoadPlugin<ISimulationDataService>(module, new object[] { m_config.Source });
207
208 // Load the estate data service
209 IConfig estateDataConfig = m_config.Source.Configs["EstateDataStore"];
210 if (estateDataConfig == null)
211 throw new Exception("Configuration file is missing the [EstateDataStore] section");
212 module = estateDataConfig.GetString("LocalServiceModule", String.Empty);
213 if (String.IsNullOrEmpty(module))
214 throw new Exception("Configuration file is missing the LocalServiceModule parameter in the [EstateDataStore] section");
215 m_estateDataService = ServerUtils.LoadPlugin<IEstateDataService>(module, new object[] { m_config.Source });
216
198 base.StartupSpecific(); 217 base.StartupSpecific();
199 218
200 m_stats = StatsManager.StartCollectingSimExtraStats(); 219 m_stats = StatsManager.StartCollectingSimExtraStats();
@@ -612,7 +631,7 @@ namespace OpenSim
612 631
613 regionInfo.InternalEndPoint.Port = (int) port; 632 regionInfo.InternalEndPoint.Port = (int) port;
614 633
615 Scene scene = CreateScene(regionInfo, m_storageManager, circuitManager); 634 Scene scene = CreateScene(regionInfo, m_simulationDataService, m_estateDataService, circuitManager);
616 635
617 if (m_autoCreateClientStack) 636 if (m_autoCreateClientStack)
618 { 637 {
@@ -628,30 +647,19 @@ namespace OpenSim
628 return scene; 647 return scene;
629 } 648 }
630 649
631 protected override StorageManager CreateStorageManager()
632 {
633 return
634 CreateStorageManager(m_configSettings.StorageConnectionString, m_configSettings.EstateConnectionString);
635 }
636
637 protected StorageManager CreateStorageManager(string connectionstring, string estateconnectionstring)
638 {
639 return new StorageManager(m_configSettings.StorageDll, connectionstring, estateconnectionstring);
640 }
641
642 protected override ClientStackManager CreateClientStackManager() 650 protected override ClientStackManager CreateClientStackManager()
643 { 651 {
644 return new ClientStackManager(m_configSettings.ClientstackDll); 652 return new ClientStackManager(m_configSettings.ClientstackDll);
645 } 653 }
646 654
647 protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 655 protected override Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService,
648 AgentCircuitManager circuitManager) 656 IEstateDataService estateDataService, AgentCircuitManager circuitManager)
649 { 657 {
650 SceneCommunicationService sceneGridService = new SceneCommunicationService(); 658 SceneCommunicationService sceneGridService = new SceneCommunicationService();
651 659
652 return new Scene( 660 return new Scene(
653 regionInfo, circuitManager, sceneGridService, 661 regionInfo, circuitManager, sceneGridService,
654 storageManager, m_moduleLoader, false, m_configSettings.PhysicalPrim, 662 simDataService, estateDataService, m_moduleLoader, false, m_configSettings.PhysicalPrim,
655 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version); 663 m_configSettings.See_into_region_from_neighbor, m_config.Source, m_version);
656 } 664 }
657 665
@@ -868,21 +876,23 @@ namespace OpenSim
868 /// </param> 876 /// </param>
869 public void PopulateRegionEstateInfo(RegionInfo regInfo) 877 public void PopulateRegionEstateInfo(RegionInfo regInfo)
870 { 878 {
871 if (m_storageManager.EstateDataStore != null) 879 IEstateDataService estateDataService = EstateDataService;
880
881 if (estateDataService != null)
872 { 882 {
873 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, false); 883 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, false);
874 } 884 }
875 885
876 if (regInfo.EstateSettings.EstateID == 0) // No record at all 886 if (regInfo.EstateSettings.EstateID == 0) // No record at all
877 { 887 {
878 MainConsole.Instance.Output("Your region is not part of an estate."); 888 MainConsole.Instance.Output("Your region is not part of an estate.");
879 while (true) 889 while (true)
880 { 890 {
881 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() {"yes", "no"}); 891 string response = MainConsole.Instance.CmdPrompt("Do you wish to join an existing estate?", "no", new List<string>() { "yes", "no" });
882 if (response == "no") 892 if (response == "no")
883 { 893 {
884 // Create a new estate 894 // Create a new estate
885 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(regInfo.RegionID, true); 895 regInfo.EstateSettings = estateDataService.LoadEstateSettings(regInfo.RegionID, true);
886 896
887 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName); 897 regInfo.EstateSettings.EstateName = MainConsole.Instance.CmdPrompt("New estate name", regInfo.EstateSettings.EstateName);
888 //regInfo.EstateSettings.Save(); 898 //regInfo.EstateSettings.Save();
@@ -894,7 +904,7 @@ namespace OpenSim
894 if (response == "None") 904 if (response == "None")
895 continue; 905 continue;
896 906
897 List<int> estateIDs = m_storageManager.EstateDataStore.GetEstates(response); 907 List<int> estateIDs = estateDataService.GetEstates(response);
898 if (estateIDs.Count < 1) 908 if (estateIDs.Count < 1)
899 { 909 {
900 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again"); 910 MainConsole.Instance.Output("The name you have entered matches no known estate. Please try again");
@@ -903,9 +913,9 @@ namespace OpenSim
903 913
904 int estateID = estateIDs[0]; 914 int estateID = estateIDs[0];
905 915
906 regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(estateID); 916 regInfo.EstateSettings = estateDataService.LoadEstateSettings(estateID);
907 917
908 if (m_storageManager.EstateDataStore.LinkRegion(regInfo.RegionID, estateID)) 918 if (estateDataService.LinkRegion(regInfo.RegionID, estateID))
909 break; 919 break;
910 920
911 MainConsole.Instance.Output("Joining the estate failed. Please try again."); 921 MainConsole.Instance.Output("Joining the estate failed. Please try again.");
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 8a96389..0e17496 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
63 /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details. 63 /// Debug packet level. See OpenSim.RegisterConsoleCommands() for more details.
64 /// </value> 64 /// </value>
65 protected int m_debugPacketLevel = 0; 65 protected int m_debugPacketLevel = 0;
66 66
67 #region Events 67 #region Events
68 68
69 public event GenericMessage OnGenericMessage; 69 public event GenericMessage OnGenericMessage;
@@ -288,7 +288,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
288 public event MuteListEntryRemove OnRemoveMuteListEntry; 288 public event MuteListEntryRemove OnRemoveMuteListEntry;
289 public event GodlikeMessage onGodlikeMessage; 289 public event GodlikeMessage onGodlikeMessage;
290 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 290 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
291
292 291
293 #endregion Events 292 #endregion Events
294 293
@@ -330,12 +329,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
330 /// ownerless phantom. 329 /// ownerless phantom.
331 /// 330 ///
332 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock 331 /// All manipulation of this set has to occur under an m_entityUpdates.SyncRoot lock
333 /// 332 ///
334 /// </value> 333 /// </value>
335 protected HashSet<uint> m_killRecord; 334 protected HashSet<uint> m_killRecord;
336 335
337// protected HashSet<uint> m_attachmentsSent; 336// protected HashSet<uint> m_attachmentsSent;
338 337
339 private int m_moneyBalance; 338 private int m_moneyBalance;
340 private bool m_deliverPackets = true; 339 private bool m_deliverPackets = true;
341 private int m_animationSequenceNumber = 1; 340 private int m_animationSequenceNumber = 1;
@@ -395,22 +394,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
395 public string ActiveGroupName { get { return m_activeGroupName; } } 394 public string ActiveGroupName { get { return m_activeGroupName; } }
396 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } } 395 public ulong ActiveGroupPowers { get { return m_activeGroupPowers; } }
397 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); } 396 public bool IsGroupMember(UUID groupID) { return m_groupPowers.ContainsKey(groupID); }
398 397
399 /// <summary> 398 /// <summary>
400 /// First name of the agent/avatar represented by the client 399 /// First name of the agent/avatar represented by the client
401 /// </summary> 400 /// </summary>
402 public string FirstName { get { return m_firstName; } } 401 public string FirstName { get { return m_firstName; } }
403 402
404 /// <summary> 403 /// <summary>
405 /// Last name of the agent/avatar represented by the client 404 /// Last name of the agent/avatar represented by the client
406 /// </summary> 405 /// </summary>
407 public string LastName { get { return m_lastName; } } 406 public string LastName { get { return m_lastName; } }
408 407
409 /// <summary> 408 /// <summary>
410 /// Full name of the client (first name and last name) 409 /// Full name of the client (first name and last name)
411 /// </summary> 410 /// </summary>
412 public string Name { get { return FirstName + " " + LastName; } } 411 public string Name { get { return FirstName + " " + LastName; } }
413 412
414 public uint CircuitCode { get { return m_circuitCode; } } 413 public uint CircuitCode { get { return m_circuitCode; } }
415 public int MoneyBalance { get { return m_moneyBalance; } } 414 public int MoneyBalance { get { return m_moneyBalance; } }
416 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } } 415 public int NextAnimationSequenceNumber { get { return m_animationSequenceNumber++; } }
@@ -453,7 +452,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
453 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count); 452 m_entityUpdates = new PriorityQueue(m_scene.Entities.Count);
454 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>(); 453 m_fullUpdateDataBlocksBuilder = new List<ObjectUpdatePacket.ObjectDataBlock>();
455 m_killRecord = new HashSet<uint>(); 454 m_killRecord = new HashSet<uint>();
456// m_attachmentsSent = new HashSet<uint>(); 455// m_attachmentsSent = new HashSet<uint>();
457 456
458 m_assetService = m_scene.RequestModuleInterface<IAssetService>(); 457 m_assetService = m_scene.RequestModuleInterface<IAssetService>();
459 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>(); 458 m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
@@ -679,7 +678,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
679 // Make sure that we see any exception caused by the asynchronous operation. 678 // Make sure that we see any exception caused by the asynchronous operation.
680 m_log.Error( 679 m_log.Error(
681 string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e); 680 string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e);
682 } 681 }
683 } 682 }
684 683
685 #endregion Packet Handling 684 #endregion Packet Handling
@@ -890,7 +889,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
890 foreach (GroupActiveProposals Proposal in Proposals) 889 foreach (GroupActiveProposals Proposal in Proposals)
891 { 890 {
892 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); 891 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
893 892
894 GAPIRP.AgentData.AgentID = AgentId; 893 GAPIRP.AgentData.AgentID = AgentId;
895 GAPIRP.AgentData.GroupID = groupID; 894 GAPIRP.AgentData.GroupID = groupID;
896 GAPIRP.TransactionData.TransactionID = transactionID; 895 GAPIRP.TransactionData.TransactionID = transactionID;
@@ -914,7 +913,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
914 if (Proposals.Length == 0) 913 if (Proposals.Length == 0)
915 { 914 {
916 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket(); 915 GroupActiveProposalItemReplyPacket GAPIRP = new GroupActiveProposalItemReplyPacket();
917 916
918 GAPIRP.AgentData.AgentID = AgentId; 917 GAPIRP.AgentData.AgentID = AgentId;
919 GAPIRP.AgentData.GroupID = groupID; 918 GAPIRP.AgentData.GroupID = groupID;
920 GAPIRP.TransactionData.TransactionID = transactionID; 919 GAPIRP.TransactionData.TransactionID = transactionID;
@@ -969,7 +968,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
969 if (Votes.Length == 0) 968 if (Votes.Length == 0)
970 { 969 {
971 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket(); 970 GroupVoteHistoryItemReplyPacket GVHIRP = new GroupVoteHistoryItemReplyPacket();
972 971
973 GVHIRP.AgentData.AgentID = AgentId; 972 GVHIRP.AgentData.AgentID = AgentId;
974 GVHIRP.AgentData.GroupID = groupID; 973 GVHIRP.AgentData.GroupID = groupID;
975 GVHIRP.TransactionData.TransactionID = transactionID; 974 GVHIRP.TransactionData.TransactionID = transactionID;
@@ -993,7 +992,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
993 OutPacket(GVHIRP, ThrottleOutPacketType.Task); 992 OutPacket(GVHIRP, ThrottleOutPacketType.Task);
994 } 993 }
995 } 994 }
996 995
997 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) 996 public void SendGroupAccountingDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
998 { 997 {
999 GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket(); 998 GroupAccountDetailsReplyPacket GADRP = new GroupAccountDetailsReplyPacket();
@@ -1012,13 +1011,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1012 GADRP.HistoryData[0] = History; 1011 GADRP.HistoryData[0] = History;
1013 OutPacket(GADRP, ThrottleOutPacketType.Task); 1012 OutPacket(GADRP, ThrottleOutPacketType.Task);
1014 } 1013 }
1015 1014
1016 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier) 1015 public void SendGroupAccountingSummary(IClientAPI sender,UUID groupID, uint moneyAmt, int totalTier, int usedTier)
1017 { 1016 {
1018 GroupAccountSummaryReplyPacket GASRP = 1017 GroupAccountSummaryReplyPacket GASRP =
1019 (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket( 1018 (GroupAccountSummaryReplyPacket)PacketPool.Instance.GetPacket(
1020 PacketType.GroupAccountSummaryReply); 1019 PacketType.GroupAccountSummaryReply);
1021 1020
1022 GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock(); 1021 GASRP.AgentData = new GroupAccountSummaryReplyPacket.AgentDataBlock();
1023 GASRP.AgentData.AgentID = sender.AgentId; 1022 GASRP.AgentData.AgentID = sender.AgentId;
1024 GASRP.AgentData.GroupID = groupID; 1023 GASRP.AgentData.GroupID = groupID;
@@ -1045,13 +1044,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1045 GASRP.MoneyData.LightTaxEstimate = 0; 1044 GASRP.MoneyData.LightTaxEstimate = 0;
1046 OutPacket(GASRP, ThrottleOutPacketType.Task); 1045 OutPacket(GASRP, ThrottleOutPacketType.Task);
1047 } 1046 }
1048 1047
1049 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt) 1048 public void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID, int amt)
1050 { 1049 {
1051 GroupAccountTransactionsReplyPacket GATRP = 1050 GroupAccountTransactionsReplyPacket GATRP =
1052 (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket( 1051 (GroupAccountTransactionsReplyPacket)PacketPool.Instance.GetPacket(
1053 PacketType.GroupAccountTransactionsReply); 1052 PacketType.GroupAccountTransactionsReply);
1054 1053
1055 GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock(); 1054 GATRP.AgentData = new GroupAccountTransactionsReplyPacket.AgentDataBlock();
1056 GATRP.AgentData.AgentID = sender.AgentId; 1055 GATRP.AgentData.AgentID = sender.AgentId;
1057 GATRP.AgentData.GroupID = groupID; 1056 GATRP.AgentData.GroupID = groupID;
@@ -1520,7 +1519,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
1520 public void SendKillObject(ulong regionHandle, uint localID) 1519 public void SendKillObject(ulong regionHandle, uint localID)
1521 { 1520 {
1522// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle); 1521// m_log.DebugFormat("[CLIENT]: Sending KillObjectPacket to {0} for {1} in {2}", Name, localID, regionHandle);
1523 1522
1524 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject); 1523 KillObjectPacket kill = (KillObjectPacket)PacketPool.Instance.GetPacket(PacketType.KillObject);
1525 // TODO: don't create new blocks if recycling an old packet 1524 // TODO: don't create new blocks if recycling an old packet
1526 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1]; 1525 kill.ObjectData = new KillObjectPacket.ObjectDataBlock[1];
@@ -3488,9 +3487,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3488 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence); 3487 objupdate.ObjectData[0] = CreateAvatarUpdateBlock(presence);
3489 3488
3490 OutPacket(objupdate, ThrottleOutPacketType.Task); 3489 OutPacket(objupdate, ThrottleOutPacketType.Task);
3491 3490
3492 // We need to record the avatar local id since the root prim of an attachment points to this. 3491 // We need to record the avatar local id since the root prim of an attachment points to this.
3493// m_attachmentsSent.Add(avatar.LocalId); 3492// m_attachmentsSent.Add(avatar.LocalId);
3494 } 3493 }
3495 3494
3496 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations) 3495 public void SendCoarseLocationUpdate(List<UUID> users, List<Vector3> CoarseLocations)
@@ -3538,7 +3537,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3538 #region Primitive Packet/Data Sending Methods 3537 #region Primitive Packet/Data Sending Methods
3539 3538
3540 /// <summary> 3539 /// <summary>
3541 /// Generate one of the object update packets based on PrimUpdateFlags 3540 /// Generate one of the object update packets based on PrimUpdateFlags
3542 /// and broadcast the packet to clients 3541 /// and broadcast the packet to clients
3543 /// </summary> 3542 /// </summary>
3544 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags) 3543 public void SendPrimUpdate(ISceneEntity entity, PrimUpdateFlags updateFlags)
@@ -3555,14 +3554,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3555 double priority = m_prioritizer.GetUpdatePriority(this, entity); 3554 double priority = m_prioritizer.GetUpdatePriority(this, entity);
3556 3555
3557 lock (m_entityUpdates.SyncRoot) 3556 lock (m_entityUpdates.SyncRoot)
3558 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId); 3557 m_entityUpdates.Enqueue(priority, new EntityUpdate(entity, updateFlags), entity.LocalId);
3559 } 3558 }
3560 3559
3561 private void ProcessEntityUpdates(int maxUpdates) 3560 private void ProcessEntityUpdates(int maxUpdates)
3562 { 3561 {
3563 Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>(); 3562 OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>> objectUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdatePacket.ObjectDataBlock>>();
3564 Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>(); 3563 OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>> compressedUpdateBlocks = new OpenSim.Framework.Lazy<List<ObjectUpdateCompressedPacket.ObjectDataBlock>>();
3565 Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>(); 3564 OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>> terseUpdateBlocks = new OpenSim.Framework.Lazy<List<ImprovedTerseObjectUpdatePacket.ObjectDataBlock>>();
3566 3565
3567 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue; 3566 if (maxUpdates <= 0) maxUpdates = Int32.MaxValue;
3568 int updatesThisCall = 0; 3567 int updatesThisCall = 0;
@@ -3660,28 +3659,28 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3660// string text = sop.Text; 3659// string text = sop.Text;
3661// if (text.IndexOf("\n") >= 0) 3660// if (text.IndexOf("\n") >= 0)
3662// text = text.Remove(text.IndexOf("\n")); 3661// text = text.Remove(text.IndexOf("\n"));
3663// 3662//
3664// if (m_attachmentsSent.Contains(sop.ParentID)) 3663// if (m_attachmentsSent.Contains(sop.ParentID))
3665// { 3664// {
3666//// m_log.DebugFormat( 3665//// m_log.DebugFormat(
3667//// "[CLIENT]: Sending full info about attached prim {0} text {1}", 3666//// "[CLIENT]: Sending full info about attached prim {0} text {1}",
3668//// sop.LocalId, text); 3667//// sop.LocalId, text);
3669// 3668//
3670// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId)); 3669// objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock(sop, this.m_agentId));
3671// 3670//
3672// m_attachmentsSent.Add(sop.LocalId); 3671// m_attachmentsSent.Add(sop.LocalId);
3673// } 3672// }
3674// else 3673// else
3675// { 3674// {
3676// m_log.DebugFormat( 3675// m_log.DebugFormat(
3677// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet", 3676// "[CLIENT]: Requeueing full update of prim {0} text {1} since we haven't sent its parent {2} yet",
3678// sop.LocalId, text, sop.ParentID); 3677// sop.LocalId, text, sop.ParentID);
3679// 3678//
3680// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId); 3679// m_entityUpdates.Enqueue(double.MaxValue, update, sop.LocalId);
3681// } 3680// }
3682// } 3681// }
3683// else 3682// else
3684// { 3683// {
3685 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId)); 3684 objectUpdateBlocks.Value.Add(CreatePrimUpdateBlock((SceneObjectPart)update.Entity, this.m_agentId));
3686// } 3685// }
3687 } 3686 }
@@ -3995,7 +3994,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3995 m_propertiesPacketTimer.Stop(); 3994 m_propertiesPacketTimer.Stop();
3996 return; 3995 return;
3997 } 3996 }
3998 3997
3999 m_propertiesPacketTimer.Stop(); 3998 m_propertiesPacketTimer.Stop();
4000 m_propertiesPacketTimer.Start(); 3999 m_propertiesPacketTimer.Start();
4001 } 4000 }
@@ -4229,7 +4228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4229 4228
4230 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) 4229 public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, LandData landData, float simObjectBonusFactor, int parcelObjectCapacity, int simObjectCapacity, uint regionFlags)
4231 { 4230 {
4232 ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage(); 4231 ParcelPropertiesMessage updateMessage = new ParcelPropertiesMessage();
4233 4232
4234 updateMessage.AABBMax = landData.AABBMax; 4233 updateMessage.AABBMax = landData.AABBMax;
4235 updateMessage.AABBMin = landData.AABBMin; 4234 updateMessage.AABBMin = landData.AABBMin;
@@ -4273,7 +4272,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4273 updateMessage.PassHours = landData.PassHours; 4272 updateMessage.PassHours = landData.PassHours;
4274 updateMessage.PassPrice = landData.PassPrice; 4273 updateMessage.PassPrice = landData.PassPrice;
4275 updateMessage.PublicCount = 0; //TODO: Unimplemented 4274 updateMessage.PublicCount = 0; //TODO: Unimplemented
4276 4275
4277 updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0; 4276 updateMessage.RegionPushOverride = (regionFlags & (uint)RegionFlags.RestrictPushObject) > 0;
4278 updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0; 4277 updateMessage.RegionDenyAnonymous = (regionFlags & (uint)RegionFlags.DenyAnonymous) > 0;
4279 4278
@@ -4303,13 +4302,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4303 updateMessage.UserLocation = landData.UserLocation; 4302 updateMessage.UserLocation = landData.UserLocation;
4304 updateMessage.UserLookAt = landData.UserLookAt; 4303 updateMessage.UserLookAt = landData.UserLookAt;
4305 4304
4306 updateMessage.MediaType = landData.MediaType; 4305 updateMessage.MediaType = landData.MediaType;
4307 updateMessage.MediaDesc = landData.MediaDescription; 4306 updateMessage.MediaDesc = landData.MediaDescription;
4308 updateMessage.MediaWidth = landData.MediaWidth; 4307 updateMessage.MediaWidth = landData.MediaWidth;
4309 updateMessage.MediaHeight = landData.MediaHeight; 4308 updateMessage.MediaHeight = landData.MediaHeight;
4310 updateMessage.MediaLoop = landData.MediaLoop; 4309 updateMessage.MediaLoop = landData.MediaLoop;
4311 updateMessage.ObscureMusic = landData.ObscureMusic; 4310 updateMessage.ObscureMusic = landData.ObscureMusic;
4312 updateMessage.ObscureMedia = landData.ObscureMedia; 4311 updateMessage.ObscureMedia = landData.ObscureMedia;
4313 4312
4314 try 4313 try
4315 { 4314 {
@@ -4318,8 +4317,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4318 { 4317 {
4319 eq.ParcelProperties(updateMessage, this.AgentId); 4318 eq.ParcelProperties(updateMessage, this.AgentId);
4320 } else { 4319 } else {
4321 m_log.Warn("No EQ Interface when sending parcel data."); 4320 m_log.Warn("No EQ Interface when sending parcel data.");
4322 } 4321 }
4323 } 4322 }
4324 catch (Exception ex) 4323 catch (Exception ex)
4325 { 4324 {
@@ -4692,9 +4691,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4692 } 4691 }
4693 4692
4694// m_log.DebugFormat( 4693// m_log.DebugFormat(
4695// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}", 4694// "[LLCLIENTVIEW]: Constructing client update for part {0} {1} with flags {2}, localId {3}",
4696// data.Name, update.FullID, flags, update.ID); 4695// data.Name, update.FullID, flags, update.ID);
4697 4696
4698 update.UpdateFlags = (uint)flags; 4697 update.UpdateFlags = (uint)flags;
4699 4698
4700 #endregion PrimFlags 4699 #endregion PrimFlags
@@ -4827,11 +4826,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
4827 AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale); 4826 AddLocalPacketHandler(PacketType.ObjectScale, HandleObjectScale);
4828 AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation); 4827 AddLocalPacketHandler(PacketType.ObjectRotation, HandleObjectRotation);
4829 AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate); 4828 AddLocalPacketHandler(PacketType.ObjectFlagUpdate, HandleObjectFlagUpdate);
4830 4829
4831 // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once, 4830 // Handle ObjectImage (TextureEntry) updates synchronously, since when updating multiple prim faces at once,
4832 // some clients will send out a separate ObjectImage packet for each face 4831 // some clients will send out a separate ObjectImage packet for each face
4833 AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false); 4832 AddLocalPacketHandler(PacketType.ObjectImage, HandleObjectImage, false);
4834 4833
4835 AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false); 4834 AddLocalPacketHandler(PacketType.ObjectGrab, HandleObjectGrab, false);
4836 AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false); 4835 AddLocalPacketHandler(PacketType.ObjectGrabUpdate, HandleObjectGrabUpdate, false);
4837 AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab); 4836 AddLocalPacketHandler(PacketType.ObjectDeGrab, HandleObjectDeGrab);
@@ -5088,12 +5087,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5088 5087
5089 return false; 5088 return false;
5090 } 5089 }
5091 5090
5092 private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet) 5091 private bool HandleParcelGodMarkAsContent(IClientAPI client, Packet Packet)
5093 { 5092 {
5094 ParcelGodMarkAsContentPacket ParcelGodMarkAsContent = 5093 ParcelGodMarkAsContentPacket ParcelGodMarkAsContent =
5095 (ParcelGodMarkAsContentPacket)Packet; 5094 (ParcelGodMarkAsContentPacket)Packet;
5096 5095
5097 ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark; 5096 ParcelGodMark ParcelGodMarkAsContentHandler = OnParcelGodMark;
5098 if (ParcelGodMarkAsContentHandler != null) 5097 if (ParcelGodMarkAsContentHandler != null)
5099 { 5098 {
@@ -5104,11 +5103,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5104 } 5103 }
5105 return false; 5104 return false;
5106 } 5105 }
5107 5106
5108 private bool HandleFreezeUser(IClientAPI client, Packet Packet) 5107 private bool HandleFreezeUser(IClientAPI client, Packet Packet)
5109 { 5108 {
5110 FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet; 5109 FreezeUserPacket FreezeUser = (FreezeUserPacket)Packet;
5111 5110
5112 FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser; 5111 FreezeUserUpdate FreezeUserHandler = OnParcelFreezeUser;
5113 if (FreezeUserHandler != null) 5112 if (FreezeUserHandler != null)
5114 { 5113 {
@@ -5120,12 +5119,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5120 } 5119 }
5121 return false; 5120 return false;
5122 } 5121 }
5123 5122
5124 private bool HandleEjectUser(IClientAPI client, Packet Packet) 5123 private bool HandleEjectUser(IClientAPI client, Packet Packet)
5125 { 5124 {
5126 EjectUserPacket EjectUser = 5125 EjectUserPacket EjectUser =
5127 (EjectUserPacket)Packet; 5126 (EjectUserPacket)Packet;
5128 5127
5129 EjectUserUpdate EjectUserHandler = OnParcelEjectUser; 5128 EjectUserUpdate EjectUserHandler = OnParcelEjectUser;
5130 if (EjectUserHandler != null) 5129 if (EjectUserHandler != null)
5131 { 5130 {
@@ -5137,12 +5136,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5137 } 5136 }
5138 return false; 5137 return false;
5139 } 5138 }
5140 5139
5141 private bool HandleParcelBuyPass(IClientAPI client, Packet Packet) 5140 private bool HandleParcelBuyPass(IClientAPI client, Packet Packet)
5142 { 5141 {
5143 ParcelBuyPassPacket ParcelBuyPass = 5142 ParcelBuyPassPacket ParcelBuyPass =
5144 (ParcelBuyPassPacket)Packet; 5143 (ParcelBuyPassPacket)Packet;
5145 5144
5146 ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass; 5145 ParcelBuyPass ParcelBuyPassHandler = OnParcelBuyPass;
5147 if (ParcelBuyPassHandler != null) 5146 if (ParcelBuyPassHandler != null)
5148 { 5147 {
@@ -5153,7 +5152,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5153 } 5152 }
5154 return false; 5153 return false;
5155 } 5154 }
5156 5155
5157 private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack) 5156 private bool HandleParcelBuyRequest(IClientAPI sender, Packet Pack)
5158 { 5157 {
5159 ParcelBuyPacket parcel = (ParcelBuyPacket)Pack; 5158 ParcelBuyPacket parcel = (ParcelBuyPacket)Pack;
@@ -5375,7 +5374,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5375 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack; 5374 ScriptDialogReplyPacket rdialog = (ScriptDialogReplyPacket)Pack;
5376 5375
5377 //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID); 5376 //m_log.DebugFormat("[CLIENT]: Received ScriptDialogReply from {0}", rdialog.Data.ObjectID);
5378 5377
5379 #region Packet Session and User Check 5378 #region Packet Session and User Check
5380 if (m_checkPackets) 5379 if (m_checkPackets)
5381 { 5380 {
@@ -5521,12 +5520,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5521 } 5520 }
5522 return true; 5521 return true;
5523 } 5522 }
5524 5523
5525 private bool HandleFindAgent(IClientAPI client, Packet Packet) 5524 private bool HandleFindAgent(IClientAPI client, Packet Packet)
5526 { 5525 {
5527 FindAgentPacket FindAgent = 5526 FindAgentPacket FindAgent =
5528 (FindAgentPacket)Packet; 5527 (FindAgentPacket)Packet;
5529 5528
5530 FindAgentUpdate FindAgentHandler = OnFindAgent; 5529 FindAgentUpdate FindAgentHandler = OnFindAgent;
5531 if (FindAgentHandler != null) 5530 if (FindAgentHandler != null)
5532 { 5531 {
@@ -5535,12 +5534,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5535 } 5534 }
5536 return false; 5535 return false;
5537 } 5536 }
5538 5537
5539 private bool HandleTrackAgent(IClientAPI client, Packet Packet) 5538 private bool HandleTrackAgent(IClientAPI client, Packet Packet)
5540 { 5539 {
5541 TrackAgentPacket TrackAgent = 5540 TrackAgentPacket TrackAgent =
5542 (TrackAgentPacket)Packet; 5541 (TrackAgentPacket)Packet;
5543 5542
5544 TrackAgentUpdate TrackAgentHandler = OnTrackAgent; 5543 TrackAgentUpdate TrackAgentHandler = OnTrackAgent;
5545 if (TrackAgentHandler != null) 5544 if (TrackAgentHandler != null)
5546 { 5545 {
@@ -5551,7 +5550,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
5551 } 5550 }
5552 return false; 5551 return false;
5553 } 5552 }
5554 5553
5555 private bool HandlerRezObject(IClientAPI sender, Packet Pack) 5554 private bool HandlerRezObject(IClientAPI sender, Packet Pack)
5556 { 5555 {
5557 RezObjectPacket rezPacket = (RezObjectPacket)Pack; 5556 RezObjectPacket rezPacket = (RezObjectPacket)Pack;
@@ -7207,19 +7206,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7207 UUID requestID = new UUID(transfer.TransferInfo.Params, 80); 7206 UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
7208 7207
7209// m_log.DebugFormat( 7208// m_log.DebugFormat(
7210// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}", 7209// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
7211// requestID, itemID, taskID, Name); 7210// requestID, itemID, taskID, Name);
7212 7211
7213 if (!(((Scene)m_scene).Permissions.BypassPermissions())) 7212 if (!(((Scene)m_scene).Permissions.BypassPermissions()))
7214 { 7213 {
7215 if (taskID != UUID.Zero) // Prim 7214 if (taskID != UUID.Zero) // Prim
7216 { 7215 {
7217 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); 7216 SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
7218 7217
7219 if (part == null) 7218 if (part == null)
7220 { 7219 {
7221 m_log.WarnFormat( 7220 m_log.WarnFormat(
7222 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist", 7221 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
7223 Name, requestID, itemID, taskID); 7222 Name, requestID, itemID, taskID);
7224 return true; 7223 return true;
7225 } 7224 }
@@ -7228,11 +7227,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7228 if (tii == null) 7227 if (tii == null)
7229 { 7228 {
7230 m_log.WarnFormat( 7229 m_log.WarnFormat(
7231 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist", 7230 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
7232 Name, requestID, itemID, taskID); 7231 Name, requestID, itemID, taskID);
7233 return true; 7232 return true;
7234 } 7233 }
7235 7234
7236 if (tii.Type == (int)AssetType.LSLText) 7235 if (tii.Type == (int)AssetType.LSLText)
7237 { 7236 {
7238 if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId)) 7237 if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
@@ -7251,41 +7250,41 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7251 { 7250 {
7252 m_log.WarnFormat( 7251 m_log.WarnFormat(
7253 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}", 7252 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
7254 Name, requestID, itemID, taskID, part.OwnerID); 7253 Name, requestID, itemID, taskID, part.OwnerID);
7255 return true; 7254 return true;
7256 } 7255 }
7257 7256
7258 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) 7257 if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
7259 { 7258 {
7260 m_log.WarnFormat( 7259 m_log.WarnFormat(
7261 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set", 7260 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
7262 Name, requestID, itemID, taskID); 7261 Name, requestID, itemID, taskID);
7263 return true; 7262 return true;
7264 } 7263 }
7265 7264
7266 if (tii.OwnerID != AgentId) 7265 if (tii.OwnerID != AgentId)
7267 { 7266 {
7268 m_log.WarnFormat( 7267 m_log.WarnFormat(
7269 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}", 7268 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
7270 Name, requestID, itemID, taskID, tii.OwnerID); 7269 Name, requestID, itemID, taskID, tii.OwnerID);
7271 return true; 7270 return true;
7272 } 7271 }
7273 7272
7274 if (( 7273 if ((
7275 tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) 7274 tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7276 != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) 7275 != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
7277 { 7276 {
7278 m_log.WarnFormat( 7277 m_log.WarnFormat(
7279 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer", 7278 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
7280 Name, requestID, itemID, taskID); 7279 Name, requestID, itemID, taskID);
7281 return true; 7280 return true;
7282 } 7281 }
7283 7282
7284 if (tii.AssetID != requestID) 7283 if (tii.AssetID != requestID)
7285 { 7284 {
7286 m_log.WarnFormat( 7285 m_log.WarnFormat(
7287 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}", 7286 "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
7288 Name, requestID, itemID, taskID, tii.AssetID); 7287 Name, requestID, itemID, taskID, tii.AssetID);
7289 return true; 7288 return true;
7290 } 7289 }
7291 } 7290 }
@@ -7889,7 +7888,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7889 newTaskItem, updatetask.UpdateData.LocalID); 7888 newTaskItem, updatetask.UpdateData.LocalID);
7890 } 7889 }
7891 } 7890 }
7892 } 7891 }
7893 7892
7894 return true; 7893 return true;
7895 } 7894 }
@@ -8884,7 +8883,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8884 8883
8885// return true; 8884// return true;
8886 } 8885 }
8887 8886
8888 private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack) 8887 private bool HandleRequestRegionInfo(IClientAPI sender, Packet Pack)
8889 { 8888 {
8890 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData; 8889 RequestRegionInfoPacket.AgentDataBlock mPacket = ((RequestRegionInfoPacket)Pack).AgentData;
@@ -8905,7 +8904,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8905 } 8904 }
8906 return true; 8905 return true;
8907 } 8906 }
8908 8907
8909 private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack) 8908 private bool HandleEstateCovenantRequest(IClientAPI sender, Packet Pack)
8910 { 8909 {
8911 8910
@@ -8942,7 +8941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8942 8941
8943 return true; 8942 return true;
8944 } 8943 }
8945 8944
8946 private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet) 8945 private bool HandleGodUpdateRegionInfoUpdate(IClientAPI client, Packet Packet)
8947 { 8946 {
8948 GodUpdateRegionInfoPacket GodUpdateRegionInfo = 8947 GodUpdateRegionInfoPacket GodUpdateRegionInfo =
@@ -8962,7 +8961,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8962 } 8961 }
8963 return false; 8962 return false;
8964 } 8963 }
8965 8964
8966 private bool HandleSimWideDeletes(IClientAPI client, Packet Packet) 8965 private bool HandleSimWideDeletes(IClientAPI client, Packet Packet)
8967 { 8966 {
8968 SimWideDeletesPacket SimWideDeletesRequest = 8967 SimWideDeletesPacket SimWideDeletesRequest =
@@ -8975,7 +8974,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8975 } 8974 }
8976 return false; 8975 return false;
8977 } 8976 }
8978 8977
8979 private bool HandleGodlikeMessage(IClientAPI client, Packet Packet) 8978 private bool HandleGodlikeMessage(IClientAPI client, Packet Packet)
8980 { 8979 {
8981 GodlikeMessagePacket GodlikeMessage = 8980 GodlikeMessagePacket GodlikeMessage =
@@ -8992,7 +8991,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
8992 } 8991 }
8993 return false; 8992 return false;
8994 } 8993 }
8995 8994
8996 private bool HandleSaveStatePacket(IClientAPI client, Packet Packet) 8995 private bool HandleSaveStatePacket(IClientAPI client, Packet Packet)
8997 { 8996 {
8998 StateSavePacket SaveStateMessage = 8997 StateSavePacket SaveStateMessage =
@@ -9005,7 +9004,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9005 } 9004 }
9006 return false; 9005 return false;
9007 } 9006 }
9008 9007
9009 private bool HandleGodKickUser(IClientAPI sender, Packet Pack) 9008 private bool HandleGodKickUser(IClientAPI sender, Packet Pack)
9010 { 9009 {
9011 GodKickUserPacket gkupack = (GodKickUserPacket)Pack; 9010 GodKickUserPacket gkupack = (GodKickUserPacket)Pack;
@@ -9143,7 +9142,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9143 } 9142 }
9144 return true; 9143 return true;
9145 } 9144 }
9146 9145
9147 #endregion Economy/Transaction Packets 9146 #endregion Economy/Transaction Packets
9148 9147
9149 #region Script Packets 9148 #region Script Packets
@@ -9356,7 +9355,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9356 } 9355 }
9357 return true; 9356 return true;
9358 } 9357 }
9359 9358
9360 private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet) 9359 private bool HandleUpdateMuteListEntry(IClientAPI client, Packet Packet)
9361 { 9360 {
9362 UpdateMuteListEntryPacket UpdateMuteListEntry = 9361 UpdateMuteListEntryPacket UpdateMuteListEntry =
@@ -9372,7 +9371,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9372 } 9371 }
9373 return false; 9372 return false;
9374 } 9373 }
9375 9374
9376 private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet) 9375 private bool HandleRemoveMuteListEntry(IClientAPI client, Packet Packet)
9377 { 9376 {
9378 RemoveMuteListEntryPacket RemoveMuteListEntry = 9377 RemoveMuteListEntryPacket RemoveMuteListEntry =
@@ -9388,7 +9387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9388 } 9387 }
9389 return false; 9388 return false;
9390 } 9389 }
9391 9390
9392 private bool HandleUserReport(IClientAPI client, Packet Packet) 9391 private bool HandleUserReport(IClientAPI client, Packet Packet)
9393 { 9392 {
9394 UserReportPacket UserReport = 9393 UserReportPacket UserReport =
@@ -9413,7 +9412,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9413 } 9412 }
9414 return false; 9413 return false;
9415 } 9414 }
9416 9415
9417 private bool HandleSendPostcard(IClientAPI client, Packet packet) 9416 private bool HandleSendPostcard(IClientAPI client, Packet packet)
9418 { 9417 {
9419// SendPostcardPacket SendPostcard = 9418// SendPostcardPacket SendPostcard =
@@ -9726,7 +9725,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9726 return true; 9725 return true;
9727 9726
9728 } 9727 }
9729 9728
9730 private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet) 9729 private bool HandleGroupVoteHistoryRequest(IClientAPI client, Packet Packet)
9731 { 9730 {
9732 GroupVoteHistoryRequestPacket GroupVoteHistoryRequest = 9731 GroupVoteHistoryRequestPacket GroupVoteHistoryRequest =
@@ -9739,7 +9738,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9739 } 9738 }
9740 return false; 9739 return false;
9741 } 9740 }
9742 9741
9743 private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet) 9742 private bool HandleGroupActiveProposalsRequest(IClientAPI client, Packet Packet)
9744 { 9743 {
9745 GroupActiveProposalsRequestPacket GroupActiveProposalsRequest = 9744 GroupActiveProposalsRequestPacket GroupActiveProposalsRequest =
@@ -9752,7 +9751,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9752 } 9751 }
9753 return false; 9752 return false;
9754 } 9753 }
9755 9754
9756 private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet) 9755 private bool HandleGroupAccountDetailsRequest(IClientAPI client, Packet Packet)
9757 { 9756 {
9758 GroupAccountDetailsRequestPacket GroupAccountDetailsRequest = 9757 GroupAccountDetailsRequestPacket GroupAccountDetailsRequest =
@@ -9765,7 +9764,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9765 } 9764 }
9766 return false; 9765 return false;
9767 } 9766 }
9768 9767
9769 private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet) 9768 private bool HandleGroupAccountSummaryRequest(IClientAPI client, Packet Packet)
9770 { 9769 {
9771 GroupAccountSummaryRequestPacket GroupAccountSummaryRequest = 9770 GroupAccountSummaryRequestPacket GroupAccountSummaryRequest =
@@ -9778,7 +9777,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9778 } 9777 }
9779 return false; 9778 return false;
9780 } 9779 }
9781 9780
9782 private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet) 9781 private bool HandleGroupTransactionsDetailsRequest(IClientAPI client, Packet Packet)
9783 { 9782 {
9784 GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest = 9783 GroupAccountTransactionsRequestPacket GroupAccountTransactionsRequest =
@@ -9791,7 +9790,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
9791 } 9790 }
9792 return false; 9791 return false;
9793 } 9792 }
9794 9793
9795 private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack) 9794 private bool HandleGroupTitlesRequest(IClientAPI sender, Packet Pack)
9796 { 9795 {
9797 GroupTitlesRequestPacket groupTitlesRequest = 9796 GroupTitlesRequestPacket groupTitlesRequest =
@@ -11239,26 +11238,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11239 if (m_debugPacketLevel > 0) 11238 if (m_debugPacketLevel > 0)
11240 { 11239 {
11241 bool outputPacket = true; 11240 bool outputPacket = true;
11242 11241
11243 if (m_debugPacketLevel <= 255 11242 if (m_debugPacketLevel <= 255
11244 && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage)) 11243 && (packet.Type == PacketType.SimStats || packet.Type == PacketType.SimulatorViewerTimeMessage))
11245 outputPacket = false; 11244 outputPacket = false;
11246 11245
11247 if (m_debugPacketLevel <= 200 11246 if (m_debugPacketLevel <= 200
11248 && 11247 && (packet.Type == PacketType.ImagePacket
11249 (packet.Type == PacketType.ImagePacket
11250 || packet.Type == PacketType.ImageData 11248 || packet.Type == PacketType.ImageData
11251 || packet.Type == PacketType.LayerData 11249 || packet.Type == PacketType.LayerData
11252 || packet.Type == PacketType.CoarseLocationUpdate)) 11250 || packet.Type == PacketType.CoarseLocationUpdate))
11253 outputPacket = false; 11251 outputPacket = false;
11254 11252
11255 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect)) 11253 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.AvatarAnimation || packet.Type == PacketType.ViewerEffect))
11256 outputPacket = false; 11254 outputPacket = false;
11257 11255
11258 if (outputPacket) 11256 if (outputPacket)
11259 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type); 11257 m_log.DebugFormat("[CLIENT]: Packet OUT {0}", packet.Type);
11260 } 11258 }
11261 11259
11262 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting); 11260 m_udpServer.SendPacket(m_udpClient, packet, throttlePacketType, doAutomaticSplitting);
11263 } 11261 }
11264 11262
@@ -11348,16 +11346,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11348 if (m_debugPacketLevel > 0) 11346 if (m_debugPacketLevel > 0)
11349 { 11347 {
11350 bool outputPacket = true; 11348 bool outputPacket = true;
11351 11349
11352 if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate) 11350 if (m_debugPacketLevel <= 255 && packet.Type == PacketType.AgentUpdate)
11353 outputPacket = false; 11351 outputPacket = false;
11354 11352
11355 if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage) 11353 if (m_debugPacketLevel <= 200 && packet.Type == PacketType.RequestImage)
11356 outputPacket = false; 11354 outputPacket = false;
11357 11355
11358 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation)) 11356 if (m_debugPacketLevel <= 100 && (packet.Type == PacketType.ViewerEffect || packet.Type == PacketType.AgentAnimation))
11359 outputPacket = false; 11357 outputPacket = false;
11360 11358
11361 if (outputPacket) 11359 if (outputPacket)
11362 m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type); 11360 m_log.DebugFormat("[CLIENT]: Packet IN {0}", packet.Type);
11363 } 11361 }
@@ -11623,12 +11621,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11623 11621
11624 UUID requestID = UUID.Zero; 11622 UUID requestID = UUID.Zero;
11625 byte source = (byte)SourceType.Asset; 11623 byte source = (byte)SourceType.Asset;
11626 11624
11627 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset) 11625 if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
11628 { 11626 {
11629 requestID = new UUID(transferRequest.TransferInfo.Params, 0); 11627 requestID = new UUID(transferRequest.TransferInfo.Params, 0);
11630 } 11628 }
11631 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem) 11629 else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
11632 { 11630 {
11633 requestID = new UUID(transferRequest.TransferInfo.Params, 80); 11631 requestID = new UUID(transferRequest.TransferInfo.Params, 80);
11634 source = (byte)SourceType.SimInventoryItem; 11632 source = (byte)SourceType.SimInventoryItem;
@@ -11874,7 +11872,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11874 public PacketMethod method; 11872 public PacketMethod method;
11875 public bool Async; 11873 public bool Async;
11876 } 11874 }
11877 11875
11878 public class AsyncPacketProcess 11876 public class AsyncPacketProcess
11879 { 11877 {
11880 public bool result = false; 11878 public bool result = false;
@@ -11943,8 +11941,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11943 dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); 11941 dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName);
11944 dialog.Data.LastName = Util.StringToBytes256(ownerLastName); 11942 dialog.Data.LastName = Util.StringToBytes256(ownerLastName);
11945 dialog.Data.Message = Util.StringToBytes256(message); 11943 dialog.Data.Message = Util.StringToBytes256(message);
11946 11944
11947
11948 ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; 11945 ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1];
11949 buttons[0] = new ScriptDialogPacket.ButtonsBlock(); 11946 buttons[0] = new ScriptDialogPacket.ButtonsBlock();
11950 buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); 11947 buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!");
@@ -11958,7 +11955,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11958 { 11955 {
11959 ScenePresence presence = p as ScenePresence; 11956 ScenePresence presence = p as ScenePresence;
11960 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities 11957 // It turns out to get the agent to stop flying, you have to feed it stop flying velocities
11961 // There's no explicit message to send the client to tell it to stop flying.. it relies on the 11958 // There's no explicit message to send the client to tell it to stop flying.. it relies on the
11962 // velocity, collision plane and avatar height 11959 // velocity, collision plane and avatar height
11963 11960
11964 // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air 11961 // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air
@@ -11975,7 +11972,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
11975 11972
11976 // attach a suitable collision plane regardless of the actual situation to force the LLClient to land. 11973 // attach a suitable collision plane regardless of the actual situation to force the LLClient to land.
11977 // Collision plane below the avatar's position a 6th of the avatar's height is suitable. 11974 // Collision plane below the avatar's position a 6th of the avatar's height is suitable.
11978 // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a 11975 // Mind you, that this method doesn't get called if the avatar's velocity magnitude is greater then a
11979 // certain amount.. because the LLClient wouldn't land in that situation anyway. 11976 // certain amount.. because the LLClient wouldn't land in that situation anyway.
11980 11977
11981 // why are we still testing for this really old height value default??? 11978 // why are we still testing for this really old height value default???
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 46b68ec..ea1317a 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -36,6 +36,7 @@ using OpenSim.Framework.Communications;
36using OpenSim.Framework.Servers; 36using OpenSim.Framework.Servers;
37using OpenSim.Framework.Servers.HttpServer; 37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework; 38using OpenSim.Region.Framework;
39using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
40using OpenSim.Region.Physics.Manager; 41using OpenSim.Region.Physics.Manager;
41 42
@@ -48,28 +49,16 @@ namespace OpenSim.Region.ClientStack
48 49
49 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>(); 50 protected Dictionary<EndPoint, uint> m_clientCircuits = new Dictionary<EndPoint, uint>();
50 protected NetworkServersInfo m_networkServersInfo; 51 protected NetworkServersInfo m_networkServersInfo;
51
52 public NetworkServersInfo NetServersInfo
53 {
54 get { return m_networkServersInfo; }
55 }
56
57 protected uint m_httpServerPort; 52 protected uint m_httpServerPort;
58 53 protected ISimulationDataService m_simulationDataService;
59 protected StorageManager m_storageManager; 54 protected IEstateDataService m_estateDataService;
60
61 public StorageManager StorageManager
62 {
63 get { return m_storageManager; }
64 }
65
66 protected ClientStackManager m_clientStackManager; 55 protected ClientStackManager m_clientStackManager;
67
68 public SceneManager SceneManager
69 {
70 get { return m_sceneManager; }
71 }
72 protected SceneManager m_sceneManager = new SceneManager(); 56 protected SceneManager m_sceneManager = new SceneManager();
57
58 public SceneManager SceneManager { get { return m_sceneManager; } }
59 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
60 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
61 public IEstateDataService EstateDataService { get { return m_estateDataService; } }
73 62
74 protected abstract void Initialize(); 63 protected abstract void Initialize();
75 64
@@ -83,15 +72,11 @@ namespace OpenSim.Region.ClientStack
83 /// <returns></returns> 72 /// <returns></returns>
84 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier); 73 protected abstract PhysicsScene GetPhysicsScene(string osSceneIdentifier);
85 74
86 protected abstract StorageManager CreateStorageManager();
87 protected abstract ClientStackManager CreateClientStackManager(); 75 protected abstract ClientStackManager CreateClientStackManager();
88 protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, 76 protected abstract Scene CreateScene(RegionInfo regionInfo, ISimulationDataService simDataService, IEstateDataService estateDataService, AgentCircuitManager circuitManager);
89 AgentCircuitManager circuitManager);
90 77
91 protected override void StartupSpecific() 78 protected override void StartupSpecific()
92 { 79 {
93 m_storageManager = CreateStorageManager();
94
95 m_clientStackManager = CreateClientStackManager(); 80 m_clientStackManager = CreateClientStackManager();
96 81
97 Initialize(); 82 Initialize();
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index 100b55c..e1c0949 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
49 49
50 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51 51
52 public string Name { get { return "Attachments Module"; } } 52 public string Name { get { return "Attachments Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) {} 55 public void Initialise(IConfigSource source) {}
56 56
@@ -81,7 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
81 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory; 81 client.OnRezMultipleAttachmentsFromInv += RezMultipleAttachmentsFromInventory;
82 client.OnObjectAttach += AttachObject; 82 client.OnObjectAttach += AttachObject;
83 client.OnObjectDetach += DetachObject; 83 client.OnObjectDetach += DetachObject;
84 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory; 84 client.OnDetachAttachmentIntoInv += ShowDetachInUserInventory;
85 } 85 }
86 86
87 public void UnsubscribeFromClientEvents(IClientAPI client) 87 public void UnsubscribeFromClientEvents(IClientAPI client)
@@ -90,7 +90,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
90 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory; 90 client.OnRezMultipleAttachmentsFromInv -= RezMultipleAttachmentsFromInventory;
91 client.OnObjectAttach -= AttachObject; 91 client.OnObjectAttach -= AttachObject;
92 client.OnObjectDetach -= DetachObject; 92 client.OnObjectDetach -= DetachObject;
93 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory; 93 client.OnDetachAttachmentIntoInv -= ShowDetachInUserInventory;
94 } 94 }
95 95
96 /// <summary> 96 /// <summary>
@@ -174,12 +174,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
174 UUID itemID = UUID.Zero; 174 UUID itemID = UUID.Zero;
175 if (sp != null) 175 if (sp != null)
176 { 176 {
177 foreach(SceneObjectGroup grp in sp.GetAttachments(AttachmentPt)) 177 foreach (SceneObjectGroup grp in sp.GetAttachments(AttachmentPt))
178 { 178 {
179 itemID = grp.GetFromItemID(); 179 itemID = grp.GetFromItemID();
180 if (itemID != UUID.Zero) 180 if (itemID != UUID.Zero)
181 DetachSingleAttachmentToInv(itemID, remoteClient); 181 DetachSingleAttachmentToInv(itemID, remoteClient);
182 } 182 }
183 } 183 }
184 184
185 if (group.GetFromItemID() == UUID.Zero) 185 if (group.GetFromItemID() == UUID.Zero)
@@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
232 232
233 public UUID RezSingleAttachmentFromInventory( 233 public UUID RezSingleAttachmentFromInventory(
234 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc) 234 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, bool updateInventoryStatus, XmlDocument doc)
235 { 235 {
236 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc); 236 SceneObjectGroup att = RezSingleAttachmentFromInventoryInternal(remoteClient, itemID, AttachmentPt, doc);
237 237
238 if (updateInventoryStatus) 238 if (updateInventoryStatus)
@@ -248,8 +248,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
248 if (null == att) 248 if (null == att)
249 return UUID.Zero; 249 return UUID.Zero;
250 else 250 else
251 return att.UUID; 251 return att.UUID;
252 } 252 }
253 253
254 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal( 254 protected SceneObjectGroup RezSingleAttachmentFromInventoryInternal(
255 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc) 255 IClientAPI remoteClient, UUID itemID, uint AttachmentPt, XmlDocument doc)
@@ -311,7 +311,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
311 } 311 }
312 312
313 return null; 313 return null;
314 } 314 }
315 315
316 public UUID SetAttachmentInventoryStatus( 316 public UUID SetAttachmentInventoryStatus(
317 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt) 317 SceneObjectGroup att, IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
@@ -456,7 +456,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
456 456
457 // We can NOT use the dictionries here, as we are looking 457 // We can NOT use the dictionries here, as we are looking
458 // for an entity by the fromAssetID, which is NOT the prim UUID 458 // for an entity by the fromAssetID, which is NOT the prim UUID
459 List<EntityBase> detachEntities = m_scene.GetEntities(); 459 EntityBase[] detachEntities = m_scene.GetEntities();
460 SceneObjectGroup group; 460 SceneObjectGroup group;
461 461
462 foreach (EntityBase entity in detachEntities) 462 foreach (EntityBase entity in detachEntities)
@@ -495,7 +495,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
495 sog.RootPart.IsAttachment = false; 495 sog.RootPart.IsAttachment = false;
496 sog.AbsolutePosition = sog.RootPart.AttachedPos; 496 sog.AbsolutePosition = sog.RootPart.AttachedPos;
497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); 497 UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID);
498 sog.SetAttachmentPoint(attachmentPoint); 498 sog.SetAttachmentPoint(attachmentPoint);
499 } 499 }
500 500
501 /// <summary> 501 /// <summary>
@@ -622,7 +622,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
622 // In case it is later dropped again, don't let 622 // In case it is later dropped again, don't let
623 // it get cleaned up 623 // it get cleaned up
624 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); 624 so.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
625 so.HasGroupChanged = false; 625 so.HasGroupChanged = false;
626 } 626 }
627 } 627 }
628} 628}
diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
index 032e55a..25322a1 100644
--- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
132 try 132 try
133 { 133 {
134 deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true); 134 deadAvatar.ControllingClient.SendAgentAlertMessage(deadAvatarMessage, true);
135 if(killingAvatar != null) 135 if (killingAvatar != null)
136 killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname); 136 killingAvatar.ControllingClient.SendAlertMessage("You fragged " + deadAvatar.Firstname + " " + deadAvatar.Lastname);
137 } 137 }
138 catch (InvalidOperationException) 138 catch (InvalidOperationException)
@@ -143,7 +143,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
143 } 143 }
144 144
145 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID) 145 private void AvatarEnteringParcel(ScenePresence avatar, int localLandID, UUID regionID)
146 { 146 {
147 try 147 try
148 { 148 {
149 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y); 149 ILandObject obj = avatar.Scene.LandChannel.GetLandObject(avatar.AbsolutePosition.X, avatar.AbsolutePosition.Y);
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index ca0b7ad..a49e71e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -54,7 +54,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
54 public UUID PrincipalID; 54 public UUID PrincipalID;
55 public FriendInfo[] Friends; 55 public FriendInfo[] Friends;
56 public int Refcount; 56 public int Refcount;
57 public UUID RegionID;
58 57
59 public bool IsFriend(string friend) 58 public bool IsFriend(string friend)
60 { 59 {
@@ -68,6 +67,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
68 } 67 }
69 } 68 }
70 69
70 private static readonly FriendInfo[] EMPTY_FRIENDS = new FriendInfo[0];
71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 71 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
72 72
73 protected List<Scene> m_Scenes = new List<Scene>(); 73 protected List<Scene> m_Scenes = new List<Scene>();
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
79 protected Dictionary<UUID, UserFriendData> m_Friends = 79 protected Dictionary<UUID, UserFriendData> m_Friends =
80 new Dictionary<UUID, UserFriendData>(); 80 new Dictionary<UUID, UserFriendData>();
81 81
82 protected List<UUID> m_NeedsListOfFriends = new List<UUID>(); 82 protected HashSet<UUID> m_NeedsListOfFriends = new HashSet<UUID>();
83 83
84 protected IPresenceService PresenceService 84 protected IPresenceService PresenceService
85 { 85 {
@@ -146,7 +146,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
146 // Instantiate the request handler 146 // Instantiate the request handler
147 IHttpServer server = MainServer.GetHttpServer((uint)mPort); 147 IHttpServer server = MainServer.GetHttpServer((uint)mPort);
148 server.AddStreamHandler(new FriendsRequestHandler(this)); 148 server.AddStreamHandler(new FriendsRequestHandler(this));
149
150 } 149 }
151 150
152 if (m_FriendsService == null) 151 if (m_FriendsService == null)
@@ -173,7 +172,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
173 scene.EventManager.OnNewClient += OnNewClient; 172 scene.EventManager.OnNewClient += OnNewClient;
174 scene.EventManager.OnClientClosed += OnClientClosed; 173 scene.EventManager.OnClientClosed += OnClientClosed;
175 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; 174 scene.EventManager.OnMakeRootAgent += OnMakeRootAgent;
176 scene.EventManager.OnMakeChildAgent += OnMakeChildAgent;
177 scene.EventManager.OnClientLogin += OnClientLogin; 175 scene.EventManager.OnClientLogin += OnClientLogin;
178 } 176 }
179 177
@@ -198,17 +196,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
198 196
199 public uint GetFriendPerms(UUID principalID, UUID friendID) 197 public uint GetFriendPerms(UUID principalID, UUID friendID)
200 { 198 {
201 if (!m_Friends.ContainsKey(principalID)) 199 FriendInfo[] friends = GetFriends(principalID);
202 return 0; 200 foreach (FriendInfo fi in friends)
203
204 UserFriendData data = m_Friends[principalID];
205
206 string searchFor = friendID.ToString();
207 foreach (FriendInfo fi in data.Friends)
208 { 201 {
209 if (fi.Friend == searchFor) 202 if (fi.Friend == friendID.ToString())
210 return (uint)fi.TheirFlags; 203 return (uint)fi.TheirFlags;
211 } 204 }
205
212 return 0; 206 return 0;
213 } 207 }
214 208
@@ -218,73 +212,59 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
218 client.OnApproveFriendRequest += OnApproveFriendRequest; 212 client.OnApproveFriendRequest += OnApproveFriendRequest;
219 client.OnDenyFriendRequest += OnDenyFriendRequest; 213 client.OnDenyFriendRequest += OnDenyFriendRequest;
220 client.OnTerminateFriendship += OnTerminateFriendship; 214 client.OnTerminateFriendship += OnTerminateFriendship;
221
222 client.OnGrantUserRights += OnGrantUserRights; 215 client.OnGrantUserRights += OnGrantUserRights;
223 216
224 lock (m_Friends) 217 // Asynchronously fetch the friends list or increment the refcount for the existing
225 { 218 // friends list
226 if (m_Friends.ContainsKey(client.AgentId)) 219 Util.FireAndForget(
220 delegate(object o)
227 { 221 {
228 m_Friends[client.AgentId].Refcount++; 222 lock (m_Friends)
229 return; 223 {
230 } 224 UserFriendData friendsData;
231 225 if (m_Friends.TryGetValue(client.AgentId, out friendsData))
232 UserFriendData newFriends = new UserFriendData(); 226 {
233 227 friendsData.Refcount++;
234 newFriends.PrincipalID = client.AgentId; 228 }
235 newFriends.Friends = m_FriendsService.GetFriends(client.AgentId); 229 else
236 newFriends.Refcount = 1; 230 {
237 newFriends.RegionID = UUID.Zero; 231 friendsData = new UserFriendData();
232 friendsData.PrincipalID = client.AgentId;
233 friendsData.Friends = FriendsService.GetFriends(client.AgentId);
234 friendsData.Refcount = 1;
238 235
239 m_Friends.Add(client.AgentId, newFriends); 236 m_Friends[client.AgentId] = friendsData;
240 } 237 }
241 238 }
239 }
240 );
242 } 241 }
243 242
244 private void OnClientClosed(UUID agentID, Scene scene) 243 private void OnClientClosed(UUID agentID, Scene scene)
245 { 244 {
246 ScenePresence sp = scene.GetScenePresence(agentID); 245 ScenePresence sp = scene.GetScenePresence(agentID);
247 if (sp != null && !sp.IsChildAgent) 246 if (sp != null && !sp.IsChildAgent)
247 {
248 // do this for root agents closing out 248 // do this for root agents closing out
249 StatusChange(agentID, false); 249 StatusChange(agentID, false);
250 }
250 251
251 lock (m_Friends) 252 lock (m_Friends)
252 if (m_Friends.ContainsKey(agentID)) 253 {
254 UserFriendData friendsData;
255 if (m_Friends.TryGetValue(agentID, out friendsData))
253 { 256 {
254 if (m_Friends[agentID].Refcount == 1) 257 friendsData.Refcount--;
258 if (friendsData.Refcount <= 0)
255 m_Friends.Remove(agentID); 259 m_Friends.Remove(agentID);
256 else
257 m_Friends[agentID].Refcount--;
258 } 260 }
259 }
260
261 private void OnMakeRootAgent(ScenePresence sp)
262 {
263 UUID agentID = sp.ControllingClient.AgentId;
264
265 if (m_Friends.ContainsKey(agentID))
266 {
267 // This is probably an overkill, but just
268 // to make sure we have the latest and greatest
269 // friends list -- always pull OnMakeRoot
270 m_Friends[agentID].Friends =
271 m_FriendsService.GetFriends(agentID);
272
273 m_Friends[agentID].RegionID =
274 sp.ControllingClient.Scene.RegionInfo.RegionID;
275 } 261 }
276 } 262 }
277 263
278 264 private void OnMakeRootAgent(ScenePresence sp)
279 private void OnMakeChildAgent(ScenePresence sp)
280 { 265 {
281 UUID agentID = sp.ControllingClient.AgentId; 266 UUID agentID = sp.ControllingClient.AgentId;
282 267 UpdateFriendsCache(agentID);
283 if (m_Friends.ContainsKey(agentID))
284 {
285 if (m_Friends[agentID].RegionID == sp.ControllingClient.Scene.RegionInfo.RegionID)
286 m_Friends[agentID].RegionID = UUID.Zero;
287 }
288 } 268 }
289 269
290 private void OnClientLogin(IClientAPI client) 270 private void OnClientLogin(IClientAPI client)
@@ -296,75 +276,56 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
296 276
297 // Register that we need to send the list of online friends to this user 277 // Register that we need to send the list of online friends to this user
298 lock (m_NeedsListOfFriends) 278 lock (m_NeedsListOfFriends)
299 if (!m_NeedsListOfFriends.Contains(agentID)) 279 m_NeedsListOfFriends.Add(agentID);
300 {
301 m_NeedsListOfFriends.Add(agentID);
302 }
303 } 280 }
304 281
305 public void SendFriendsOnlineIfNeeded(IClientAPI client) 282 public void SendFriendsOnlineIfNeeded(IClientAPI client)
306 { 283 {
307 UUID agentID = client.AgentId; 284 UUID agentID = client.AgentId;
308 if (m_NeedsListOfFriends.Contains(agentID)) 285
286 // Check if the online friends list is needed
287 lock (m_NeedsListOfFriends)
309 { 288 {
310 if (!m_Friends.ContainsKey(agentID)) 289 if (!m_NeedsListOfFriends.Remove(agentID))
311 {
312 m_log.DebugFormat("[FRIENDS MODULE]: agent {0} not found in local cache", agentID);
313 return; 290 return;
314 } 291 }
315
316 //
317 // Send the friends online
318 //
319 List<UUID> online = GetOnlineFriends(agentID);
320 if (online.Count > 0)
321 {
322 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
323 client.SendAgentOnline(online.ToArray());
324 }
325
326 //
327 // Send outstanding friendship offers
328 //
329 if (m_Friends.ContainsKey(agentID))
330 {
331 List<string> outstanding = new List<string>();
332 292
333 foreach (FriendInfo fi in m_Friends[agentID].Friends) 293 // Send the friends online
334 if (fi.TheirFlags == -1) 294 List<UUID> online = GetOnlineFriends(agentID);
335 outstanding.Add(fi.Friend); 295 if (online.Count > 0)
296 {
297 m_log.DebugFormat("[FRIENDS MODULE]: User {0} in region {1} has {2} friends online", client.AgentId, client.Scene.RegionInfo.RegionName, online.Count);
298 client.SendAgentOnline(online.ToArray());
299 }
336 300
337 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, "", agentID, (byte)InstantMessageDialog.FriendshipOffered, "Will you be my friend?", true, Vector3.Zero); 301 // Send outstanding friendship offers
338 foreach (string fid in outstanding) 302 List<string> outstanding = new List<string>();
339 { 303 FriendInfo[] friends = GetFriends(agentID);
340 try 304 foreach (FriendInfo fi in friends)
341 { 305 {
342 im.fromAgentID = new Guid(fid); 306 if (fi.TheirFlags == -1)
343 } 307 outstanding.Add(fi.Friend);
344 catch 308 }
345 {
346 continue;
347 }
348 309
349 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, new UUID(im.fromAgentID)); 310 GridInstantMessage im = new GridInstantMessage(client.Scene, UUID.Zero, String.Empty, agentID, (byte)InstantMessageDialog.FriendshipOffered,
350 im.fromAgentName = account.FirstName + " " + account.LastName; 311 "Will you be my friend?", true, Vector3.Zero);
351 312
352 PresenceInfo presence = null; 313 foreach (string fid in outstanding)
353 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { fid }); 314 {
354 if (presences != null && presences.Length > 0) 315 UUID fromAgentID;
355 presence = presences[0]; 316 if (!UUID.TryParse(fid, out fromAgentID))
356 if (presence != null) 317 continue;
357 im.offline = 0;
358 318
359 im.imSessionID = im.fromAgentID; 319 UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(client.Scene.RegionInfo.ScopeID, fromAgentID);
320 PresenceInfo presence = PresenceService.GetAgent(fromAgentID);
360 321
361 // Finally 322 im.fromAgentID = fromAgentID.Guid;
362 LocalFriendshipOffered(agentID, im); 323 im.fromAgentName = account.FirstName + " " + account.LastName;
363 } 324 im.offline = (byte)((presence == null) ? 1 : 0);
364 } 325 im.imSessionID = im.fromAgentID;
365 326
366 lock (m_NeedsListOfFriends) 327 // Finally
367 m_NeedsListOfFriends.Remove(agentID); 328 LocalFriendshipOffered(agentID, im);
368 } 329 }
369 } 330 }
370 331
@@ -373,44 +334,46 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
373 List<string> friendList = new List<string>(); 334 List<string> friendList = new List<string>();
374 List<UUID> online = new List<UUID>(); 335 List<UUID> online = new List<UUID>();
375 336
376 foreach (FriendInfo fi in m_Friends[userID].Friends) 337 FriendInfo[] friends = GetFriends(userID);
338 foreach (FriendInfo fi in friends)
377 { 339 {
378 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1)) 340 if (((fi.TheirFlags & 1) != 0) && (fi.TheirFlags != -1))
379 friendList.Add(fi.Friend); 341 friendList.Add(fi.Friend);
380 } 342 }
381 343
382 if (friendList.Count == 0) 344 if (friendList.Count > 0)
383 // no friends whatsoever 345 {
384 return online; 346 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray());
385 347 foreach (PresenceInfo pi in presence)
386 PresenceInfo[] presence = PresenceService.GetAgents(friendList.ToArray()); 348 {
387 349 UUID presenceID;
388 foreach (PresenceInfo pi in presence) 350 if (UUID.TryParse(pi.UserID, out presenceID))
389 online.Add(new UUID(pi.UserID)); 351 online.Add(presenceID);
390 //m_log.DebugFormat("[XXX] {0} friend online {1}", userID, pi.UserID); 352 }
353 }
391 354
392 return online; 355 return online;
393 } 356 }
394 357
395 // 358 /// <summary>
396 // Find the client for a ID 359 /// Find the client for a ID
397 // 360 /// </summary>
398 public IClientAPI LocateClientObject(UUID agentID) 361 public IClientAPI LocateClientObject(UUID agentID)
399 { 362 {
400 Scene scene = GetClientScene(agentID); 363 Scene scene = GetClientScene(agentID);
401 if (scene == null) 364 if (scene != null)
402 return null; 365 {
403 366 ScenePresence presence = scene.GetScenePresence(agentID);
404 ScenePresence presence = scene.GetScenePresence(agentID); 367 if (presence != null)
405 if (presence == null) 368 return presence.ControllingClient;
406 return null; 369 }
407 370
408 return presence.ControllingClient; 371 return null;
409 } 372 }
410 373
411 // 374 /// <summary>
412 // Find the scene for an agent 375 /// Find the scene for an agent
413 // 376 /// </summary>
414 private Scene GetClientScene(UUID agentId) 377 private Scene GetClientScene(UUID agentId)
415 { 378 {
416 lock (m_Scenes) 379 lock (m_Scenes)
@@ -418,13 +381,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
418 foreach (Scene scene in m_Scenes) 381 foreach (Scene scene in m_Scenes)
419 { 382 {
420 ScenePresence presence = scene.GetScenePresence(agentId); 383 ScenePresence presence = scene.GetScenePresence(agentId);
421 if (presence != null) 384 if (presence != null && !presence.IsChildAgent)
422 { 385 return scene;
423 if (!presence.IsChildAgent)
424 return scene;
425 }
426 } 386 }
427 } 387 }
388
428 return null; 389 return null;
429 } 390 }
430 391
@@ -435,35 +396,33 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
435 /// <param name="online"></param> 396 /// <param name="online"></param>
436 private void StatusChange(UUID agentID, bool online) 397 private void StatusChange(UUID agentID, bool online)
437 { 398 {
438 //m_log.DebugFormat("[FRIENDS]: StatusChange {0}", online); 399 FriendInfo[] friends = GetFriends(agentID);
439 if (m_Friends.ContainsKey(agentID)) 400 if (friends.Length > 0)
440 { 401 {
441 //m_log.DebugFormat("[FRIENDS]: # of friends: {0}", m_Friends[agentID].Friends.Length);
442 List<FriendInfo> friendList = new List<FriendInfo>(); 402 List<FriendInfo> friendList = new List<FriendInfo>();
443 foreach (FriendInfo fi in m_Friends[agentID].Friends) 403 foreach (FriendInfo fi in friends)
444 { 404 {
445 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1)) 405 if (((fi.MyFlags & 1) != 0) && (fi.TheirFlags != -1))
446 friendList.Add(fi); 406 friendList.Add(fi);
447 } 407 }
448 408
449 Util.FireAndForget(delegate 409 Util.FireAndForget(
450 { 410 delegate
451 foreach (FriendInfo fi in friendList)
452 { 411 {
453 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID); 412 foreach (FriendInfo fi in friendList)
454 // Notify about this user status 413 {
455 StatusNotify(fi, agentID, online); 414 //m_log.DebugFormat("[FRIENDS]: Notifying {0}", fi.PrincipalID);
415 // Notify about this user status
416 StatusNotify(fi, agentID, online);
417 }
456 } 418 }
457 }); 419 );
458 } 420 }
459 else
460 m_log.WarnFormat("[FRIENDS]: {0} not found in cache", agentID);
461 } 421 }
462 422
463 private void StatusNotify(FriendInfo friend, UUID userID, bool online) 423 private void StatusNotify(FriendInfo friend, UUID userID, bool online)
464 { 424 {
465 UUID friendID = UUID.Zero; 425 UUID friendID;
466
467 if (UUID.TryParse(friend.Friend, out friendID)) 426 if (UUID.TryParse(friend.Friend, out friendID))
468 { 427 {
469 // Try local 428 // Try local
@@ -471,35 +430,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
471 return; 430 return;
472 431
473 // The friend is not here [as root]. Let's forward. 432 // The friend is not here [as root]. Let's forward.
474 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 433 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
475 if (friendSessions != null && friendSessions.Length > 0) 434 if (friendSession != null && friendSession.RegionID != UUID.Zero) // let's guard against sessions-gone-bad with the RegionID check
476 { 435 {
477 PresenceInfo friendSession = null; 436 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
478 foreach (PresenceInfo pinfo in friendSessions) 437 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
479 if (pinfo.RegionID != UUID.Zero) // let's guard against sessions-gone-bad 438 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
480 {
481 friendSession = pinfo;
482 break;
483 }
484
485 if (friendSession != null)
486 {
487 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
488 //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName);
489 m_FriendsSimConnector.StatusNotify(region, userID, friendID, online);
490 }
491 } 439 }
492
493 // Friend is not online. Ignore.
494 } 440 }
495 else 441 else
442 {
496 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend); 443 m_log.WarnFormat("[FRIENDS]: Error parsing friend ID {0}", friend.Friend);
444 }
497 } 445 }
498 446
499 private void OnInstantMessage(IClientAPI client, GridInstantMessage im) 447 private void OnInstantMessage(IClientAPI client, GridInstantMessage im)
500 { 448 {
501 if (im.dialog == (byte)OpenMetaverse.InstantMessageDialog.FriendshipOffered) 449 if ((InstantMessageDialog)im.dialog == InstantMessageDialog.FriendshipOffered)
502 { 450 {
503 // we got a friendship offer 451 // we got a friendship offer
504 UUID principalID = new UUID(im.fromAgentID); 452 UUID principalID = new UUID(im.fromAgentID);
505 UUID friendID = new UUID(im.toAgentID); 453 UUID friendID = new UUID(im.toAgentID);
@@ -529,15 +477,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
529 return; 477 return;
530 478
531 // The prospective friend is not here [as root]. Let's forward. 479 // The prospective friend is not here [as root]. Let's forward.
532 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 480 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
533 if (friendSessions != null && friendSessions.Length > 0) 481 if (friendSession != null)
534 { 482 {
535 PresenceInfo friendSession = friendSessions[0]; 483 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
536 if (friendSession != null) 484 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
537 {
538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
539 m_FriendsSimConnector.FriendshipOffered(region, agentID, friendID, im.message);
540 }
541 } 485 }
542 // If the prospective friend is not online, he'll get the message upon login. 486 // If the prospective friend is not online, he'll get the message upon login.
543 } 487 }
@@ -548,9 +492,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
548 492
549 FriendsService.StoreFriend(agentID, friendID.ToString(), 1); 493 FriendsService.StoreFriend(agentID, friendID.ToString(), 1);
550 FriendsService.StoreFriend(friendID, agentID.ToString(), 1); 494 FriendsService.StoreFriend(friendID, agentID.ToString(), 1);
551 // update the local cache
552 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID);
553 495
496 // Update the local cache
497 UpdateFriendsCache(agentID);
554 498
555 // 499 //
556 // Notify the friend 500 // Notify the friend
@@ -564,16 +508,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
564 } 508 }
565 509
566 // The friend is not here 510 // The friend is not here
567 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 511 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
568 if (friendSessions != null && friendSessions.Length > 0) 512 if (friendSession != null)
569 { 513 {
570 PresenceInfo friendSession = friendSessions[0]; 514 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
571 if (friendSession != null) 515 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
572 { 516 client.SendAgentOnline(new UUID[] { friendID });
573 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
574 m_FriendsSimConnector.FriendshipApproved(region, agentID, client.Name, friendID);
575 client.SendAgentOnline(new UUID[] { friendID });
576 }
577 } 517 }
578 } 518 }
579 519
@@ -592,18 +532,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
592 if (LocalFriendshipDenied(agentID, client.Name, friendID)) 532 if (LocalFriendshipDenied(agentID, client.Name, friendID))
593 return; 533 return;
594 534
595 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { friendID.ToString() }); 535 PresenceInfo friendSession = PresenceService.GetAgent(friendID);
596 if (friendSessions != null && friendSessions.Length > 0) 536 if (friendSession != null)
597 { 537 {
598 PresenceInfo friendSession = friendSessions[0]; 538 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
599 if (friendSession != null) 539 if (region != null)
600 { 540 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
601 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 541 else
602 if (region != null) 542 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
603 m_FriendsSimConnector.FriendshipDenied(region, agentID, client.Name, friendID);
604 else
605 m_log.WarnFormat("[FRIENDS]: Could not find region {0} in locating {1}", friendSession.RegionID, friendID);
606 }
607 } 543 }
608 } 544 }
609 545
@@ -613,7 +549,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
613 FriendsService.Delete(exfriendID, agentID.ToString()); 549 FriendsService.Delete(exfriendID, agentID.ToString());
614 550
615 // Update local cache 551 // Update local cache
616 m_Friends[agentID].Friends = FriendsService.GetFriends(agentID); 552 UpdateFriendsCache(agentID);
617 553
618 client.SendTerminateFriend(exfriendID); 554 client.SendTerminateFriend(exfriendID);
619 555
@@ -625,30 +561,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
625 if (LocalFriendshipTerminated(exfriendID)) 561 if (LocalFriendshipTerminated(exfriendID))
626 return; 562 return;
627 563
628 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { exfriendID.ToString() }); 564 PresenceInfo friendSession = PresenceService.GetAgent(exfriendID);
629 if (friendSessions != null && friendSessions.Length > 0) 565 if (friendSession != null)
630 { 566 {
631 PresenceInfo friendSession = friendSessions[0]; 567 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
632 if (friendSession != null) 568 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
633 {
634 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
635 m_FriendsSimConnector.FriendshipTerminated(region, agentID, exfriendID);
636 }
637 } 569 }
638 } 570 }
639 571
640 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights) 572 private void OnGrantUserRights(IClientAPI remoteClient, UUID requester, UUID target, int rights)
641 { 573 {
642 if (!m_Friends.ContainsKey(remoteClient.AgentId)) 574 FriendInfo[] friends = GetFriends(remoteClient.AgentId);
575 if (friends.Length == 0)
643 return; 576 return;
644 577
645 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target); 578 m_log.DebugFormat("[FRIENDS MODULE]: User {0} changing rights to {1} for friend {2}", requester, rights, target);
646 // Let's find the friend in this user's friend list 579 // Let's find the friend in this user's friend list
647 UserFriendData fd = m_Friends[remoteClient.AgentId];
648 FriendInfo friend = null; 580 FriendInfo friend = null;
649 foreach (FriendInfo fi in fd.Friends) 581 foreach (FriendInfo fi in friends)
582 {
650 if (fi.Friend == target.ToString()) 583 if (fi.Friend == target.ToString())
651 friend = fi; 584 friend = fi;
585 }
652 586
653 if (friend != null) // Found it 587 if (friend != null) // Found it
654 { 588 {
@@ -670,17 +604,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
670 if (LocalGrantRights(requester, target, myFlags, rights)) 604 if (LocalGrantRights(requester, target, myFlags, rights))
671 return; 605 return;
672 606
673 PresenceInfo[] friendSessions = PresenceService.GetAgents(new string[] { target.ToString() }); 607 PresenceInfo friendSession = PresenceService.GetAgent(target);
674 if (friendSessions != null && friendSessions.Length > 0) 608 if (friendSession != null)
675 { 609 {
676 PresenceInfo friendSession = friendSessions[0]; 610 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID);
677 if (friendSession != null) 611 // TODO: You might want to send the delta to save the lookup
678 { 612 // on the other end!!
679 GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); 613 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
680 // TODO: You might want to send the delta to save the lookup
681 // on the other end!!
682 m_FriendsSimConnector.GrantRights(region, requester, target, myFlags, rights);
683 }
684 } 614 }
685 } 615 }
686 } 616 }
@@ -709,8 +639,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
709 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 639 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
710 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero); 640 (byte)OpenMetaverse.InstantMessageDialog.FriendshipAccepted, userID.ToString(), false, Vector3.Zero);
711 friendClient.SendInstantMessage(im); 641 friendClient.SendInstantMessage(im);
712 // update the local cache 642
713 m_Friends[friendID].Friends = FriendsService.GetFriends(friendID); 643 // Update the local cache
644 UpdateFriendsCache(friendID);
645
714 // we're done 646 // we're done
715 return true; 647 return true;
716 } 648 }
@@ -724,7 +656,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
724 if (friendClient != null) 656 if (friendClient != null)
725 { 657 {
726 // the prospective friend in this sim as root agent 658 // the prospective friend in this sim as root agent
727
728 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID, 659 GridInstantMessage im = new GridInstantMessage(Scene, userID, userName, friendID,
729 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero); 660 (byte)OpenMetaverse.InstantMessageDialog.FriendshipDeclined, userID.ToString(), false, Vector3.Zero);
730 friendClient.SendInstantMessage(im); 661 friendClient.SendInstantMessage(im);
@@ -743,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
743 // the friend in this sim as root agent 674 // the friend in this sim as root agent
744 friendClient.SendTerminateFriend(exfriendID); 675 friendClient.SendTerminateFriend(exfriendID);
745 // update local cache 676 // update local cache
746 m_Friends[exfriendID].Friends = FriendsService.GetFriends(exfriendID); 677 UpdateFriendsCache(exfriendID);
747 // we're done 678 // we're done
748 return true; 679 return true;
749 } 680 }
@@ -772,11 +703,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
772 703
773 } 704 }
774 705
775 // update local cache 706 // Update local cache
776 //m_Friends[friendID].Friends = m_FriendsService.GetFriends(friendID); 707 lock (m_Friends)
777 foreach (FriendInfo finfo in m_Friends[friendID].Friends) 708 {
778 if (finfo.Friend == userID.ToString()) 709 FriendInfo[] friends = GetFriends(friendID);
779 finfo.TheirFlags = rights; 710 foreach (FriendInfo finfo in friends)
711 {
712 if (finfo.Friend == userID.ToString())
713 finfo.TheirFlags = rights;
714 }
715 }
780 716
781 return true; 717 return true;
782 } 718 }
@@ -802,7 +738,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
802 738
803 return false; 739 return false;
804 } 740 }
741
805 #endregion 742 #endregion
806 743
744 private FriendInfo[] GetFriends(UUID agentID)
745 {
746 UserFriendData friendsData;
747
748 lock (m_Friends)
749 {
750 if (m_Friends.TryGetValue(agentID, out friendsData))
751 return friendsData.Friends;
752 }
753
754 return EMPTY_FRIENDS;
755 }
756
757 private void UpdateFriendsCache(UUID agentID)
758 {
759 lock (m_Friends)
760 {
761 UserFriendData friendsData;
762 if (m_Friends.TryGetValue(agentID, out friendsData))
763 friendsData.Friends = FriendsService.GetFriends(agentID);
764 }
765 }
807 } 766 }
808} 767}
diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
index 4b30b0d..5ec64d5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs
@@ -58,13 +58,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods
58 public void SubscribeToClientEvents(IClientAPI client) 58 public void SubscribeToClientEvents(IClientAPI client)
59 { 59 {
60 client.OnGodKickUser += KickUser; 60 client.OnGodKickUser += KickUser;
61 client.OnRequestGodlikePowers += RequestGodlikePowers; 61 client.OnRequestGodlikePowers += RequestGodlikePowers;
62 } 62 }
63 63
64 public void UnsubscribeFromClientEvents(IClientAPI client) 64 public void UnsubscribeFromClientEvents(IClientAPI client)
65 { 65 {
66 client.OnGodKickUser -= KickUser; 66 client.OnGodKickUser -= KickUser;
67 client.OnRequestGodlikePowers -= RequestGodlikePowers; 67 client.OnRequestGodlikePowers -= RequestGodlikePowers;
68 } 68 }
69 69
70 public void RequestGodlikePowers( 70 public void RequestGodlikePowers(
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
index a49faec..a6894ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs
@@ -138,8 +138,10 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
138 if (scene.Entities.ContainsKey(toAgentID) && 138 if (scene.Entities.ContainsKey(toAgentID) &&
139 scene.Entities[toAgentID] is ScenePresence) 139 scene.Entities[toAgentID] is ScenePresence)
140 { 140 {
141 // m_log.DebugFormat("[INSTANT MESSAGE]: Looking for {0} in {1}", toAgentID.ToString(), scene.RegionInfo.RegionName); 141// m_log.DebugFormat(
142 // Local message 142// "[INSTANT MESSAGE]: Looking for root agent {0} in {1}",
143// toAgentID.ToString(), scene.RegionInfo.RegionName);
144
143 ScenePresence user = (ScenePresence) scene.Entities[toAgentID]; 145 ScenePresence user = (ScenePresence) scene.Entities[toAgentID];
144 if (!user.IsChildAgent) 146 if (!user.IsChildAgent)
145 { 147 {
@@ -495,9 +497,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
495 if (lookupAgent) 497 if (lookupAgent)
496 { 498 {
497 // Non-cached user agent lookup. 499 // Non-cached user agent lookup.
498 PresenceInfo[] presences = PresenceService.GetAgents(new string[] { toAgentID.ToString() }); 500 upd = PresenceService.GetAgent(toAgentID);
499 if (presences != null && presences.Length > 0)
500 upd = presences[0];
501 501
502 if (upd != null) 502 if (upd != null)
503 { 503 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 52342ec..c1df827 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -179,14 +179,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
179 m_log.DebugFormat( 179 m_log.DebugFormat(
180 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", 180 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
181 successfulAssetRestores, failedAssetRestores); 181 successfulAssetRestores, failedAssetRestores);
182 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores); 182 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
183 183
184 return loadedNodes; 184 return loadedNodes;
185 } 185 }
186 finally 186 finally
187 { 187 {
188 m_loadStream.Close(); 188 m_loadStream.Close();
189 } 189 }
190 } 190 }
191 191
192 public void Close() 192 public void Close()
@@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
201 /// <param name="iarPath">The item archive path to replicate</param> 201 /// <param name="iarPath">The item archive path to replicate</param>
202 /// <param name="rootDestinationFolder">The root folder for the inventory load</param> 202 /// <param name="rootDestinationFolder">The root folder for the inventory load</param>
203 /// <param name="resolvedFolders"> 203 /// <param name="resolvedFolders">
204 /// The folders that we have resolved so far for a given archive path. 204 /// The folders that we have resolved so far for a given archive path.
205 /// This method will add more folders if necessary 205 /// This method will add more folders if necessary
206 /// </param> 206 /// </param>
207 /// <param name="loadedNodes"> 207 /// <param name="loadedNodes">
@@ -246,17 +246,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
246 /// The root folder for the inventory load 246 /// The root folder for the inventory load
247 /// </param> 247 /// </param>
248 /// <param name="resolvedFolders"> 248 /// <param name="resolvedFolders">
249 /// The folders that we have resolved so far for a given archive path. 249 /// The folders that we have resolved so far for a given archive path.
250 /// </param> 250 /// </param>
251 /// <returns> 251 /// <returns>
252 /// The folder in the user's inventory that matches best the archive path given. If no such folder was found 252 /// The folder in the user's inventory that matches best the archive path given. If no such folder was found
253 /// then the passed in root destination folder is returned. 253 /// then the passed in root destination folder is returned.
254 /// </returns> 254 /// </returns>
255 protected InventoryFolderBase ResolveDestinationFolder( 255 protected InventoryFolderBase ResolveDestinationFolder(
256 InventoryFolderBase rootDestFolder, 256 InventoryFolderBase rootDestFolder,
257 ref string archivePath, 257 ref string archivePath,
258 Dictionary <string, InventoryFolderBase> resolvedFolders) 258 Dictionary <string, InventoryFolderBase> resolvedFolders)
259 { 259 {
260// string originalArchivePath = archivePath; 260// string originalArchivePath = archivePath;
261 261
262 while (archivePath.Length > 0) 262 while (archivePath.Length > 0)
@@ -370,7 +370,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
370 370
371 if (0 == i) 371 if (0 == i)
372 loadedNodes.Add(destFolder); 372 loadedNodes.Add(destFolder);
373 } 373 }
374 } 374 }
375 375
376 /// <summary> 376 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 9908018..bae5a7a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 Exception reportedException = null; 121 Exception reportedException = null;
122 bool succeeded = true; 122 bool succeeded = true;
123 123
124 try 124 try
125 { 125 {
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
136 finally 136 finally
137 { 137 {
138 m_saveStream.Close(); 138 m_saveStream.Close();
139 } 139 }
140 140
141 m_module.TriggerInventoryArchiveSaved( 141 m_module.TriggerInventoryArchiveSaved(
142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -270,7 +270,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
270 { 270 {
271 // We couldn't find the path indicated 271 // We couldn't find the path indicated
272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
273 Exception e = new InventoryArchiverException(errorMessage); 273 Exception e = new InventoryArchiverException(errorMessage);
274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); 274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
275 throw e; 275 throw e;
276 } 276 }
@@ -283,7 +283,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}", 283 "[INVENTORY ARCHIVER]: Found folder {0} {1} at {2}",
284 inventoryFolder.Name, 284 inventoryFolder.Name,
285 inventoryFolder.ID, 285 inventoryFolder.ID,
286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath ); 286 m_invPath == String.Empty ? InventoryFolderImpl.PATH_DELIMITER : m_invPath);
287 287
288 //recurse through all dirs getting dirs and files 288 //recurse through all dirs getting dirs and files
289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly); 289 SaveInvFolder(inventoryFolder, ArchiveConstants.INVENTORY_PATH, !saveFolderContentsOnly);
@@ -301,7 +301,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
301 //SaveUsers(); 301 //SaveUsers();
302 302
303 new AssetsRequest( 303 new AssetsRequest(
304 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute(); 304 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
305 } 305 }
306 catch (Exception) 306 catch (Exception)
307 { 307 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
index e07e2ca..5fd1a7e 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
33 /// Signals an inventory archiving problem 33 /// Signals an inventory archiving problem
34 /// </summary> 34 /// </summary>
35 public class InventoryArchiverException : Exception 35 public class InventoryArchiverException : Exception
36 { 36 {
37 public InventoryArchiverException(string message) : base(message) {} 37 public InventoryArchiverException(string message) : base(message) {}
38 public InventoryArchiverException(string message, Exception e) : base(message, e) {} 38 public InventoryArchiverException(string message, Exception e) : base(message, e) {}
39 } 39 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index f03f2a1..2eaca49 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -91,12 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
91 91
92 scene.AddCommand( 92 scene.AddCommand(
93 this, "load iar", 93 this, "load iar",
94 "load iar <first> <last> <inventory path> <password> [<IAR path>]", 94 "load iar <first> <last> <inventory path> <password> [<IAR path>]",
95 //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]", 95 //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]",
96 "Load user inventory archive (IAR).", 96 "Load user inventory archive (IAR).",
97 //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" 97 //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones"
98 //+ "<first> is user's first name." + Environment.NewLine 98 //+ "<first> is user's first name." + Environment.NewLine
99 "<first> is user's first name." + Environment.NewLine 99 "<first> is user's first name." + Environment.NewLine
100 + "<last> is user's last name." + Environment.NewLine 100 + "<last> is user's last name." + Environment.NewLine
101 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine 101 + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine
102 + "<password> is the user's password." + Environment.NewLine 102 + "<password> is the user's password." + Environment.NewLine
@@ -241,7 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
241 if (CheckPresence(userInfo.PrincipalID)) 241 if (CheckPresence(userInfo.PrincipalID))
242 { 242 {
243 InventoryArchiveReadRequest request; 243 InventoryArchiveReadRequest request;
244 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 244 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
245 245
246 try 246 try
247 { 247 {
@@ -286,10 +286,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
286 if (CheckPresence(userInfo.PrincipalID)) 286 if (CheckPresence(userInfo.PrincipalID))
287 { 287 {
288 InventoryArchiveReadRequest request; 288 InventoryArchiveReadRequest request;
289 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 289 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
290 290
291 try 291 try
292 { 292 {
293 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge); 293 request = new InventoryArchiveReadRequest(m_aScene, userInfo, invPath, loadPath, merge);
294 } 294 }
295 catch (EntryPointNotFoundException e) 295 catch (EntryPointNotFoundException e)
@@ -325,20 +325,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 325 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
326 { 326 {
327 try 327 try
328 { 328 {
329 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 329 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
330 330
331 Dictionary<string, object> options = new Dictionary<string, object>(); 331 Dictionary<string, object> options = new Dictionary<string, object>();
332 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 332 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
333 333
334 List<string> mainParams = optionSet.Parse(cmdparams); 334 List<string> mainParams = optionSet.Parse(cmdparams);
335 335
336 if (mainParams.Count < 6) 336 if (mainParams.Count < 6)
337 { 337 {
338 m_log.Error( 338 m_log.Error(
339 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]"); 339 "[INVENTORY ARCHIVER]: usage is load iar [--merge] <first name> <last name> <inventory path> <user password> [<load file path>]");
340 return; 340 return;
341 } 341 }
342 342
343 string firstName = mainParams[2]; 343 string firstName = mainParams[2];
344 string lastName = mainParams[3]; 344 string lastName = mainParams[3];
@@ -353,7 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
353 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) 353 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
354 m_log.InfoFormat( 354 m_log.InfoFormat(
355 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 355 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
356 loadPath, firstName, lastName); 356 loadPath, firstName, lastName);
357 } 357 }
358 catch (InventoryArchiverException e) 358 catch (InventoryArchiverException e)
359 { 359 {
@@ -390,7 +390,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
391 savePath, invPath, firstName, lastName); 391 savePath, invPath, firstName, lastName);
392 392
393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); 393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
394 } 394 }
395 catch (InventoryArchiverException e) 395 catch (InventoryArchiverException e)
396 { 396 {
@@ -398,7 +398,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
398 } 398 }
399 399
400 lock (m_pendingConsoleSaves) 400 lock (m_pendingConsoleSaves)
401 m_pendingConsoleSaves.Add(id); 401 m_pendingConsoleSaves.Add(id);
402 } 402 }
403 403
404 private void SaveInvConsoleCommandCompleted( 404 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index d66a1d0..938886b2 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -58,18 +58,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
58 /// <summary> 58 /// <summary>
59 /// Stream of data representing a common IAR that can be reused in load tests. 59 /// Stream of data representing a common IAR that can be reused in load tests.
60 /// </summary> 60 /// </summary>
61 protected MemoryStream m_iarStream; 61 protected MemoryStream m_iarStream;
62 62
63 protected UserAccount m_ua1 63 protected UserAccount m_ua1
64 = new UserAccount { 64 = new UserAccount {
65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"), 65 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000555"),
66 FirstName = "Mr", 66 FirstName = "Mr",
67 LastName = "Tiddles" }; 67 LastName = "Tiddles" };
68 protected UserAccount m_ua2 68 protected UserAccount m_ua2
69 = new UserAccount { 69 = new UserAccount {
70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"), 70 PrincipalID = UUID.Parse("00000000-0000-0000-0000-000000000666"),
71 FirstName = "Lord", 71 FirstName = "Lord",
72 LastName = "Lucan" }; 72 LastName = "Lucan" };
73 string m_item1Name = "b.lsl"; 73 string m_item1Name = "b.lsl";
74 74
75 private void SaveCompleted( 75 private void SaveCompleted(
@@ -86,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
86 } 86 }
87 87
88 protected void ConstructDefaultIarForTestLoad() 88 protected void ConstructDefaultIarForTestLoad()
89 { 89 {
90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random()); 90 string archiveItemName = InventoryArchiveWriteRequest.CreateArchiveItemName(m_item1Name, UUID.Random());
91 91
92 MemoryStream archiveWriteStream = new MemoryStream(); 92 MemoryStream archiveWriteStream = new MemoryStream();
@@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
104 string item1FileName 104 string item1FileName
105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName); 105 = string.Format("{0}{1}", ArchiveConstants.INVENTORY_PATH, archiveItemName);
106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1)); 106 tar.WriteFile(item1FileName, UserInventoryItemSerializer.Serialize(item1));
107 tar.Close(); 107 tar.Close();
108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray()); 108 m_iarStream = new MemoryStream(archiveWriteStream.ToArray());
109 } 109 }
110 110
@@ -341,7 +341,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
341// Assert.That(gotObject2File, Is.True, "No object2 file in archive"); 341// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
342 342
343 // TODO: Test presence of more files and contents of files. 343 // TODO: Test presence of more files and contents of files.
344 } 344 }
345 345
346 /// <summary> 346 /// <summary>
347 /// Test that things work when the load path specified starts with a slash 347 /// Test that things work when the load path specified starts with a slash
@@ -349,22 +349,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
349 [Test] 349 [Test]
350 public void TestLoadIarPathStartsWithSlash() 350 public void TestLoadIarPathStartsWithSlash()
351 { 351 {
352 TestHelper.InMethod(); 352 TestHelper.InMethod();
353// log4net.Config.XmlConfigurator.Configure(); 353// log4net.Config.XmlConfigurator.Configure();
354 354
355 SerialiserModule serialiserModule = new SerialiserModule(); 355 SerialiserModule serialiserModule = new SerialiserModule();
356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true); 356 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
357 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 357 Scene scene = SceneSetupHelpers.SetupScene("inventory");
358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 358 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
359 359
360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password"); 360 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "password");
361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream); 361 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/Objects", "password", m_iarStream);
362 362
363 InventoryItemBase foundItem1 363 InventoryItemBase foundItem1
364 = InventoryArchiveUtils.FindItemByPath( 364 = InventoryArchiveUtils.FindItemByPath(
365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name); 365 scene.InventoryService, m_ua1.PrincipalID, "/Objects/" + m_item1Name);
366 366
367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()"); 367 Assert.That(foundItem1, Is.Not.Null, "Didn't find loaded item 1 in TestLoadIarFolderStartsWithSlash()");
368 } 368 }
369 369
370 /// <summary> 370 /// <summary>
@@ -376,7 +376,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
376 [Test] 376 [Test]
377 public void TestLoadIarV0_1ExistingUsers() 377 public void TestLoadIarV0_1ExistingUsers()
378 { 378 {
379 TestHelper.InMethod(); 379 TestHelper.InMethod();
380 //log4net.Config.XmlConfigurator.Configure(); 380 //log4net.Config.XmlConfigurator.Configure();
381 381
382 SerialiserModule serialiserModule = new SerialiserModule(); 382 SerialiserModule serialiserModule = new SerialiserModule();
@@ -386,9 +386,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
386 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 386 Scene scene = SceneSetupHelpers.SetupScene("inventory");
387 387
388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 388 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
389 389
390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood"); 390 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua1, "meowfood");
391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire"); 391 UserProfileTestUtils.CreateUserWithInventory(scene, m_ua2, "hampshire");
392 392
393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream); 393 archiverModule.DearchiveInventory(m_ua1.FirstName, m_ua1.LastName, "/", "meowfood", m_iarStream);
394 394
@@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
450 string userFirstName = "Jock"; 450 string userFirstName = "Jock";
451 string userLastName = "Stirrup"; 451 string userLastName = "Stirrup";
452 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 452 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
453 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood"); 453 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, "meowfood");
454 454
455 // Create asset 455 // Create asset
456 SceneObjectGroup object1; 456 SceneObjectGroup object1;
@@ -524,7 +524,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
524 [Test] 524 [Test]
525 public void TestLoadIarV0_1AbsentUsers() 525 public void TestLoadIarV0_1AbsentUsers()
526 { 526 {
527 TestHelper.InMethod(); 527 TestHelper.InMethod();
528 //log4net.Config.XmlConfigurator.Configure(); 528 //log4net.Config.XmlConfigurator.Configure();
529 529
530 string userFirstName = "Charlie"; 530 string userFirstName = "Charlie";
@@ -562,7 +562,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
562 Scene scene = SceneSetupHelpers.SetupScene("inventory"); 562 Scene scene = SceneSetupHelpers.SetupScene("inventory");
563 563
564 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 564 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
565 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood"); 565 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userUuid, "meowfood");
566 566
567 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream); 567 archiverModule.DearchiveInventory(userFirstName, userLastName, "/", "meowfood", archiveReadStream);
568 568
@@ -680,8 +680,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
680 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random()); 680 string folder2aArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2aName, UUID.Random());
681 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random()); 681 string folder2bArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2bName, UUID.Random());
682 682
683 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName }); 683 string iarPath1 = string.Join("", new string[] { folder1ArchiveName, folder2aArchiveName });
684 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName }); 684 string iarPath2 = string.Join("", new string[] { folder1ArchiveName, folder2bArchiveName });
685 685
686 { 686 {
687 // Test replication of path1 687 // Test replication of path1
@@ -694,7 +694,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
694 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name); 694 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, ua1.PrincipalID, folder1Name);
695 Assert.That(folder1Candidates.Count, Is.EqualTo(1)); 695 Assert.That(folder1Candidates.Count, Is.EqualTo(1));
696 696
697 InventoryFolderBase folder1 = folder1Candidates[0]; 697 InventoryFolderBase folder1 = folder1Candidates[0];
698 List<InventoryFolderBase> folder2aCandidates 698 List<InventoryFolderBase> folder2aCandidates
699 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); 699 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
700 Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); 700 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
@@ -715,11 +715,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
715 715
716 List<InventoryFolderBase> folder2aCandidates 716 List<InventoryFolderBase> folder2aCandidates
717 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName); 717 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2aName);
718 Assert.That(folder2aCandidates.Count, Is.EqualTo(1)); 718 Assert.That(folder2aCandidates.Count, Is.EqualTo(1));
719 719
720 List<InventoryFolderBase> folder2bCandidates 720 List<InventoryFolderBase> folder2bCandidates
721 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName); 721 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1, folder2bName);
722 Assert.That(folder2bCandidates.Count, Is.EqualTo(1)); 722 Assert.That(folder2bCandidates.Count, Is.EqualTo(1));
723 } 723 }
724 } 724 }
725 725
@@ -741,7 +741,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
741 741
742 InventoryFolderBase folder1 742 InventoryFolderBase folder1
743 = UserInventoryTestUtils.CreateInventoryFolder( 743 = UserInventoryTestUtils.CreateInventoryFolder(
744 scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 744 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
745 745
746 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); 746 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
747 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 747 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -772,7 +772,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
772 List<InventoryFolderBase> folder2PostCandidates 772 List<InventoryFolderBase> folder2PostCandidates
773 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b"); 773 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1Post, "b");
774 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 774 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
775 } 775 }
776 776
777 /// <summary> 777 /// <summary>
778 /// Test replication of a partly existing archive path to the user's inventory. This should create 778 /// Test replication of a partly existing archive path to the user's inventory. This should create
@@ -792,7 +792,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
792 792
793 InventoryFolderBase folder1 793 InventoryFolderBase folder1
794 = UserInventoryTestUtils.CreateInventoryFolder( 794 = UserInventoryTestUtils.CreateInventoryFolder(
795 scene.InventoryService, ua1.PrincipalID, folder1ExistingName); 795 scene.InventoryService, ua1.PrincipalID, folder1ExistingName);
796 796
797 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random()); 797 string folder1ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder1ExistingName, UUID.Random());
798 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random()); 798 string folder2ArchiveName = InventoryArchiveWriteRequest.CreateArchiveFolderName(folder2Name, UUID.Random());
@@ -812,6 +812,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
812 List<InventoryFolderBase> folder2PostCandidates 812 List<InventoryFolderBase> folder2PostCandidates
813 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b"); 813 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, folder1PostCandidates[0], "b");
814 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1)); 814 Assert.That(folder2PostCandidates.Count, Is.EqualTo(1));
815 } 815 }
816 } 816 }
817} \ No newline at end of file 817} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
index 35b70de..05fe3ee 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs
@@ -138,7 +138,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
138 { 138 {
139 if (!queues.ContainsKey(agentId)) 139 if (!queues.ContainsKey(agentId))
140 { 140 {
141 /* 141 /*
142 m_log.DebugFormat( 142 m_log.DebugFormat(
143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}", 143 "[EVENTQUEUE]: Adding new queue for agent {0} in region {1}",
144 agentId, m_scene.RegionInfo.RegionName); 144 agentId, m_scene.RegionInfo.RegionName);
@@ -701,7 +701,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
701 701
702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID) 702 public void ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage, UUID avatarID)
703 { 703 {
704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage); 704 OSD item = EventQueueHelper.ParcelProperties(parcelPropertiesMessage);
705 Enqueue(item, avatarID); 705 Enqueue(item, avatarID);
706 } 706 }
707 707
diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
index b62df18..0d7d16a 100644
--- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
+++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueHelper.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
55 } 55 }
56 56
57// private static byte[] uintToByteArray(uint uIntValue) 57// private static byte[] uintToByteArray(uint uIntValue)
58// { 58// {
59// byte[] result = new byte[4]; 59// byte[] result = new byte[4];
60// Utils.UIntToBytesBig(uIntValue, result, 0); 60// Utils.UIntToBytesBig(uIntValue, result, 0);
61// return result; 61// return result;
@@ -386,14 +386,14 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
386 return placesReply; 386 return placesReply;
387 } 387 }
388 388
389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage) 389 public static OSD ParcelProperties(ParcelPropertiesMessage parcelPropertiesMessage)
390 { 390 {
391 OSDMap message = new OSDMap(); 391 OSDMap message = new OSDMap();
392 message.Add("message", OSD.FromString("ParcelProperties")); 392 message.Add("message", OSD.FromString("ParcelProperties"));
393 OSD message_body = parcelPropertiesMessage.Serialize(); 393 OSD message_body = parcelPropertiesMessage.Serialize();
394 message.Add("body", message_body); 394 message.Add("body", message_body);
395 return message; 395 return message;
396 } 396 }
397 397
398 } 398 }
399} 399}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 37f6ea0..a2ba498 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -629,7 +629,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
629 rootPart.Name = item.Name; 629 rootPart.Name = item.Name;
630 rootPart.Description = item.Description; 630 rootPart.Description = item.Description;
631 631
632 List<SceneObjectPart> partList = null; 632 List<SceneObjectPart> partList = null;
633 lock (group.Children) 633 lock (group.Children)
634 partList = new List<SceneObjectPart>(group.Children.Values); 634 partList = new List<SceneObjectPart>(group.Children.Values);
635 635
diff --git a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
index b75a700..a75ff62 100644
--- a/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Statistics/Logging/BinaryLoggingModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
49 protected bool m_collectStats; 49 protected bool m_collectStats;
50 protected Scene m_scene = null; 50 protected Scene m_scene = null;
51 51
52 public string Name { get { return "Binary Statistics Logging Module"; } } 52 public string Name { get { return "Binary Statistics Logging Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) 55 public void Initialise(IConfigSource source)
56 { 56 {
@@ -79,7 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
79 catch 79 catch
80 { 80 {
81 // if it doesn't work, we don't collect anything 81 // if it doesn't work, we don't collect anything
82 } 82 }
83 } 83 }
84 84
85 public void AddRegion(Scene scene) 85 public void AddRegion(Scene scene)
@@ -94,12 +94,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
94 public void RegionLoaded(Scene scene) 94 public void RegionLoaded(Scene scene)
95 { 95 {
96 if (m_collectStats) 96 if (m_collectStats)
97 m_scene.StatsReporter.OnSendStatsResult += LogSimStats; 97 m_scene.StatsReporter.OnSendStatsResult += LogSimStats;
98 } 98 }
99 99
100 public void Close() 100 public void Close()
101 { 101 {
102 } 102 }
103 103
104 public class StatLogger 104 public class StatLogger
105 { 105 {
@@ -164,6 +164,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
164 } 164 }
165 } 165 }
166 return; 166 return;
167 } 167 }
168 } 168 }
169} 169}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
index 235914a..2f96bcb 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Hypergrid/HypergridServiceInConnectorModule.cs
@@ -115,6 +115,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Hypergrid
115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService); 115 m_HypergridHandler = new GatekeeperServiceInConnector(m_Config, MainServer.Instance, simService);
116 116
117 new UserAgentServerConnector(m_Config, MainServer.Instance); 117 new UserAgentServerConnector(m_Config, MainServer.Instance);
118 new HeloServiceInConnector(m_Config, MainServer.Instance, "HeloService");
118 } 119 }
119 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper); 120 scene.RegisterModuleInterface<IGatekeeperService>(m_HypergridHandler.GateKeeper);
120 } 121 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 5b4fecb..39410b5 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -37,6 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39using OpenSim.Services.Connectors; 39using OpenSim.Services.Connectors;
40using OpenSim.Services.Connectors.SimianGrid;
40using OpenMetaverse; 41using OpenMetaverse;
41 42
42namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory 43namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
@@ -538,12 +539,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
538 } 539 }
539 else 540 else
540 { 541 {
541 // We're instantiating this class explicitly, but this won't 542 // Still not as flexible as I would like this to be,
542 // work in general, because the remote grid may be running 543 // but good enough for now
543 // an inventory server that has a different protocol. 544 string connectorType = new HeloServicesConnector(url).Helo();
544 // Eventually we will want a piece of protocol asking 545 m_log.DebugFormat("[HG INVENTORY SERVICE]: HELO returned {0}", connectorType);
545 // the remote server about its kind. Definitely cool thing to do! 546 if (connectorType == "opensim-simian")
546 connector = new RemoteXInventoryServicesConnector(url); 547 connector = new SimianInventoryServiceConnector(url);
548 else
549 connector = new RemoteXInventoryServicesConnector(url);
547 m_connectors.Add(url, connector); 550 m_connectors.Add(url, connector);
548 } 551 }
549 } 552 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 4e2f602..2322d7c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -185,7 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
185 return folders[type]; 185 return folders[type];
186 } 186 }
187 187
188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID); 188 m_log.WarnFormat("[INVENTORY CACHE]: Could not find folder for system type {0} for {1}", type, userID);
189 189
190 return null; 190 return null;
191 } 191 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index cbd9e05..ab6be50 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -220,7 +220,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
220 { 220 {
221// m_log.DebugFormat( 221// m_log.DebugFormat(
222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}", 222// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
223// item.Name, item.Owner, item.Folder); 223// item.Name, item.Owner, item.Folder);
224 224
225 return m_InventoryService.AddItem(item); 225 return m_InventoryService.AddItem(item);
226 } 226 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
index 4ab6947..34205e3 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs
@@ -227,7 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
227 public bool AddItem(InventoryItemBase item) 227 public bool AddItem(InventoryItemBase item)
228 { 228 {
229 if (item == null) 229 if (item == null)
230 return false; 230 return false;
231 231
232 return m_RemoteConnector.AddItem(item); 232 return m_RemoteConnector.AddItem(item);
233 } 233 }
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
index fb2edb9..64788db 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/UserAccounts/UserAccountCache.cs
@@ -36,6 +36,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
36{ 36{
37 public class UserAccountCache 37 public class UserAccountCache
38 { 38 {
39 private const double CACHE_EXPIRATION_SECONDS = 120.0;
40
39 private static readonly ILog m_log = 41 private static readonly ILog m_log =
40 LogManager.GetLogger( 42 LogManager.GetLogger(
41 MethodBase.GetCurrentMethod().DeclaringType); 43 MethodBase.GetCurrentMethod().DeclaringType);
@@ -51,9 +53,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.UserAccounts
51 public void Cache(UUID userID, UserAccount account) 53 public void Cache(UUID userID, UserAccount account)
52 { 54 {
53 // Cache even null accounts 55 // Cache even null accounts
54 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 56 m_UUIDCache.AddOrUpdate(userID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
55 if (account != null) 57 if (account != null)
56 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 58 m_NameCache.AddOrUpdate(account.Name, account.PrincipalID, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
57 59
58 // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID); 60 // m_log.DebugFormat("[USER CACHE]: cached user {0}", userID);
59 } 61 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
index ddc3dd7..c72acc3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs
@@ -33,7 +33,7 @@ using OpenSim.Framework.Serialization;
33using OpenSim.Region.Framework.Scenes; 33using OpenSim.Region.Framework.Scenes;
34 34
35namespace OpenSim.Region.CoreModules.World.Archiver 35namespace OpenSim.Region.CoreModules.World.Archiver
36{ 36{
37 /// <summary> 37 /// <summary>
38 /// Helper methods for archive manipulation 38 /// Helper methods for archive manipulation
39 /// </summary> 39 /// </summary>
@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
50 public static string CreateObjectFilename(SceneObjectGroup sog) 50 public static string CreateObjectFilename(SceneObjectGroup sog)
51 { 51 {
52 return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition); 52 return ArchiveConstants.CreateOarObjectFilename(sog.Name, sog.UUID, sog.AbsolutePosition);
53 } 53 }
54 54
55 /// <summary> 55 /// <summary>
56 /// Create the path used to store an object in an OpenSim Archive. 56 /// Create the path used to store an object in an OpenSim Archive.
@@ -62,7 +62,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
62 public static string CreateObjectPath(SceneObjectGroup sog) 62 public static string CreateObjectPath(SceneObjectGroup sog)
63 { 63 {
64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition); 64 return ArchiveConstants.CreateOarObjectPath(sog.Name, sog.UUID, sog.AbsolutePosition);
65 } 65 }
66 66
67 /// <summary> 67 /// <summary>
68 /// Resolve path to a working FileStream 68 /// Resolve path to a working FileStream
@@ -123,6 +123,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
123 123
124 // return new BufferedStream(file, (int) response.ContentLength); 124 // return new BufferedStream(file, (int) response.ContentLength);
125 return new BufferedStream(file, 1000000); 125 return new BufferedStream(file, 1000000);
126 } 126 }
127 } 127 }
128} \ No newline at end of file 128} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
index b25636f..283b33b 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
102 { 102 {
103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>(); 103 Dictionary<UUID, AssetType> assetUuids = new Dictionary<UUID, AssetType>();
104 104
105 List<EntityBase> entities = m_scene.GetEntities(); 105 EntityBase[] entities = m_scene.GetEntities();
106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); 106 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
107 107
108 /* 108 /*
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 58698ee..3342164 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -48,6 +48,7 @@ using OpenSim.Tests.Common.Setup;
48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 48using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader; 49using TarArchiveReader = OpenSim.Framework.Serialization.TarArchiveReader;
50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter; 50using TarArchiveWriter = OpenSim.Framework.Serialization.TarArchiveWriter;
51using RegionSettings = OpenSim.Framework.RegionSettings;
51 52
52namespace OpenSim.Region.CoreModules.World.Archiver.Tests 53namespace OpenSim.Region.CoreModules.World.Archiver.Tests
53{ 54{
@@ -135,7 +136,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
135 136
136 SceneObjectPart part2 = CreateSceneObjectPart2(); 137 SceneObjectPart part2 = CreateSceneObjectPart2();
137 138
138 AssetNotecard nc = new AssetNotecard("Hello World!"); 139 AssetNotecard nc = new AssetNotecard();
140 nc.BodyText = "Hello World!";
141 nc.Encode();
139 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 142 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
140 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 143 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
141 AssetBase ncAsset 144 AssetBase ncAsset
@@ -215,7 +218,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
215 public void TestLoadOarV0_2() 218 public void TestLoadOarV0_2()
216 { 219 {
217 TestHelper.InMethod(); 220 TestHelper.InMethod();
218 //log4net.Config.XmlConfigurator.Configure(); 221// log4net.Config.XmlConfigurator.Configure();
219 222
220 MemoryStream archiveWriteStream = new MemoryStream(); 223 MemoryStream archiveWriteStream = new MemoryStream();
221 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); 224 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index f62ec1b..5bd72ee 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -72,12 +72,12 @@ namespace OpenSim.Region.CoreModules.World.Land
72 #pragma warning restore 0429 72 #pragma warning restore 0429
73 73
74 /// <value> 74 /// <value>
75 /// Local land ids at specified region co-ordinates (region size / 4) 75 /// Local land ids at specified region co-ordinates (region size / 4)
76 /// </value> 76 /// </value>
77 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; 77 private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax];
78 78
79 /// <value> 79 /// <value>
80 /// Land objects keyed by local id 80 /// Land objects keyed by local id
81 /// </value> 81 /// </value>
82 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>(); 82 private readonly Dictionary<int, ILandObject> m_landList = new Dictionary<int, ILandObject>();
83 83
@@ -94,8 +94,8 @@ namespace OpenSim.Region.CoreModules.World.Land
94 94
95 #region INonSharedRegionModule Members 95 #region INonSharedRegionModule Members
96 96
97 public Type ReplaceableInterface 97 public Type ReplaceableInterface
98 { 98 {
99 get { return null; } 99 get { return null; }
100 } 100 }
101 101
@@ -200,7 +200,7 @@ namespace OpenSim.Region.CoreModules.World.Land
200 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); 200 Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
201 forcedPosition = null; 201 forcedPosition = null;
202 } 202 }
203 //if we are far away, teleport 203 //if we are far away, teleport
204 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3) 204 else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition.Value) > 3)
205 { 205 {
206 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition)); 206 Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition.Value, clientAvatar.AbsolutePosition));
@@ -329,8 +329,6 @@ namespace OpenSim.Region.CoreModules.World.Land
329 } 329 }
330 } 330 }
331 331
332
333
334 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position) 332 private void ForceAvatarToPosition(ScenePresence avatar, Vector3? position)
335 { 333 {
336 if (m_scene.Permissions.IsGod(avatar.UUID)) return; 334 if (m_scene.Permissions.IsGod(avatar.UUID)) return;
@@ -344,7 +342,6 @@ namespace OpenSim.Region.CoreModules.World.Land
344 { 342 {
345 avatar.ControllingClient.SendAlertMessage( 343 avatar.ControllingClient.SendAlertMessage(
346 "You are not allowed on this parcel because the land owner has restricted access."); 344 "You are not allowed on this parcel because the land owner has restricted access.");
347
348 } 345 }
349 346
350 public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID) 347 public void EventManagerOnAvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID)
@@ -456,7 +453,7 @@ namespace OpenSim.Region.CoreModules.World.Land
456 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT && 453 if (clientAvatar.AbsolutePosition.Z < LandChannel.BAN_LINE_SAFETY_HIEGHT &&
457 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown) 454 clientAvatar.sentMessageAboutRestrictedParcelFlyingDown)
458 { 455 {
459 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID, 456 EventManagerOnAvatarEnteringNewParcel(clientAvatar, parcel.LandData.LocalID,
460 m_scene.RegionInfo.RegionID); 457 m_scene.RegionInfo.RegionID);
461 //They are going under the safety line! 458 //They are going under the safety line!
462 if (!parcel.IsBannedFromLand(clientAvatar.UUID)) 459 if (!parcel.IsBannedFromLand(clientAvatar.UUID))
@@ -660,7 +657,7 @@ namespace OpenSim.Region.CoreModules.World.Land
660 657
661 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0) 658 if (x_float > Constants.RegionSize || x_float < 0 || y_float > Constants.RegionSize || y_float < 0)
662 return null; 659 return null;
663 660
664 try 661 try
665 { 662 {
666 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); 663 x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0));
@@ -675,7 +672,7 @@ namespace OpenSim.Region.CoreModules.World.Land
675 { 672 {
676 return null; 673 return null;
677 } 674 }
678 675
679 lock (m_landList) 676 lock (m_landList)
680 { 677 {
681 // Corner case. If an autoreturn happens during sim startup 678 // Corner case. If an autoreturn happens during sim startup
@@ -695,7 +692,7 @@ namespace OpenSim.Region.CoreModules.World.Land
695 // they happen every time at border crossings 692 // they happen every time at border crossings
696 throw new Exception("Error: Parcel not found at point " + x + ", " + y); 693 throw new Exception("Error: Parcel not found at point " + x + ", " + y);
697 } 694 }
698 695
699 lock (m_landIDList) 696 lock (m_landIDList)
700 { 697 {
701 try 698 try
@@ -749,7 +746,6 @@ namespace OpenSim.Region.CoreModules.World.Land
749 746
750 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj) 747 public void EventManagerOnObjectBeingRemovedFromScene(SceneObjectGroup obj)
751 { 748 {
752
753 lock (m_landList) 749 lock (m_landList)
754 { 750 {
755 foreach (LandObject p in m_landList.Values) 751 foreach (LandObject p in m_landList.Values)
@@ -802,7 +798,8 @@ namespace OpenSim.Region.CoreModules.World.Land
802 public void EventManagerOnParcelPrimCountUpdate() 798 public void EventManagerOnParcelPrimCountUpdate()
803 { 799 {
804 ResetAllLandPrimCounts(); 800 ResetAllLandPrimCounts();
805 foreach (EntityBase obj in m_scene.Entities) 801 EntityBase[] entities = m_scene.Entities.GetEntities();
802 foreach (EntityBase obj in entities)
806 { 803 {
807 if (obj != null) 804 if (obj != null)
808 { 805 {
@@ -943,7 +940,7 @@ namespace OpenSim.Region.CoreModules.World.Land
943 return; 940 return;
944 } 941 }
945 } 942 }
946 943
947 lock (m_landList) 944 lock (m_landList)
948 { 945 {
949 foreach (ILandObject slaveLandObject in selectedLandObjects) 946 foreach (ILandObject slaveLandObject in selectedLandObjects)
@@ -1089,7 +1086,6 @@ namespace OpenSim.Region.CoreModules.World.Land
1089 temp.Add(currentParcel); 1086 temp.Add(currentParcel);
1090 } 1087 }
1091 } 1088 }
1092
1093 } 1089 }
1094 } 1090 }
1095 1091
@@ -1132,7 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Land
1132 join(west, south, east, north, remote_client.AgentId); 1128 join(west, south, east, north, remote_client.AgentId);
1133 } 1129 }
1134 1130
1135 public void ClientOnParcelSelectObjects(int local_id, int request_type, 1131 public void ClientOnParcelSelectObjects(int local_id, int request_type,
1136 List<UUID> returnIDs, IClientAPI remote_client) 1132 List<UUID> returnIDs, IClientAPI remote_client)
1137 { 1133 {
1138 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client); 1134 m_landList[local_id].SendForceObjectSelect(local_id, request_type, returnIDs, remote_client);
@@ -1382,31 +1378,31 @@ namespace OpenSim.Region.CoreModules.World.Land
1382 { 1378 {
1383 return RemoteParcelRequest(request, path, param, agentID, caps); 1379 return RemoteParcelRequest(request, path, param, agentID, caps);
1384 })); 1380 }));
1385 UUID parcelCapID = UUID.Random(); 1381 UUID parcelCapID = UUID.Random();
1386 caps.RegisterHandler("ParcelPropertiesUpdate", 1382 caps.RegisterHandler("ParcelPropertiesUpdate",
1387 new RestStreamHandler("POST", "/CAPS/" + parcelCapID, 1383 new RestStreamHandler("POST", "/CAPS/" + parcelCapID,
1388 delegate(string request, string path, string param, 1384 delegate(string request, string path, string param,
1389 OSHttpRequest httpRequest, OSHttpResponse httpResponse) 1385 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
1390 { 1386 {
1391 return ProcessPropertiesUpdate(request, path, param, agentID, caps); 1387 return ProcessPropertiesUpdate(request, path, param, agentID, caps);
1392 })); 1388 }));
1393 } 1389 }
1394 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps) 1390 private string ProcessPropertiesUpdate(string request, string path, string param, UUID agentID, Caps caps)
1395 { 1391 {
1396 IClientAPI client; 1392 IClientAPI client;
1397 if ( ! m_scene.TryGetClient(agentID, out client) ) { 1393 if (! m_scene.TryGetClient(agentID, out client)) {
1398 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString() ); 1394 m_log.WarnFormat("[LAND] unable to retrieve IClientAPI for {0}", agentID.ToString());
1399 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1395 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1400 } 1396 }
1401 1397
1402 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage(); 1398 ParcelPropertiesUpdateMessage properties = new ParcelPropertiesUpdateMessage();
1403 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request); 1399 OpenMetaverse.StructuredData.OSDMap args = (OpenMetaverse.StructuredData.OSDMap) OSDParser.DeserializeLLSDXml(request);
1404 1400
1405 properties.Deserialize(args); 1401 properties.Deserialize(args);
1406 1402
1407 LandUpdateArgs land_update = new LandUpdateArgs(); 1403 LandUpdateArgs land_update = new LandUpdateArgs();
1408 int parcelID = properties.LocalID; 1404 int parcelID = properties.LocalID;
1409 land_update.AuthBuyerID = properties.AuthBuyerID; 1405 land_update.AuthBuyerID = properties.AuthBuyerID;
1410 land_update.Category = properties.Category; 1406 land_update.Category = properties.Category;
1411 land_update.Desc = properties.Desc; 1407 land_update.Desc = properties.Desc;
1412 land_update.GroupID = properties.GroupID; 1408 land_update.GroupID = properties.GroupID;
@@ -1423,15 +1419,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1423 land_update.SnapshotID = properties.SnapshotID; 1419 land_update.SnapshotID = properties.SnapshotID;
1424 land_update.UserLocation = properties.UserLocation; 1420 land_update.UserLocation = properties.UserLocation;
1425 land_update.UserLookAt = properties.UserLookAt; 1421 land_update.UserLookAt = properties.UserLookAt;
1426 land_update.MediaDescription = properties.MediaDesc; 1422 land_update.MediaDescription = properties.MediaDesc;
1427 land_update.MediaType = properties.MediaType; 1423 land_update.MediaType = properties.MediaType;
1428 land_update.MediaWidth = properties.MediaWidth; 1424 land_update.MediaWidth = properties.MediaWidth;
1429 land_update.MediaHeight = properties.MediaHeight; 1425 land_update.MediaHeight = properties.MediaHeight;
1430 land_update.MediaLoop = properties.MediaLoop; 1426 land_update.MediaLoop = properties.MediaLoop;
1431 land_update.ObscureMusic = properties.ObscureMusic; 1427 land_update.ObscureMusic = properties.ObscureMusic;
1432 land_update.ObscureMedia = properties.ObscureMedia; 1428 land_update.ObscureMedia = properties.ObscureMedia;
1433 1429
1434 ILandObject land; 1430 ILandObject land;
1435 lock (m_landList) 1431 lock (m_landList)
1436 { 1432 {
1437 m_landList.TryGetValue(parcelID, out land); 1433 m_landList.TryGetValue(parcelID, out land);
@@ -1439,15 +1435,15 @@ namespace OpenSim.Region.CoreModules.World.Land
1439 1435
1440 if (land != null) 1436 if (land != null)
1441 { 1437 {
1442 land.UpdateLandProperties(land_update, client); 1438 land.UpdateLandProperties(land_update, client);
1443 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client); 1439 m_scene.EventManager.TriggerOnParcelPropertiesUpdateRequest(land_update, parcelID, client);
1444 } 1440 }
1445 else 1441 else
1446 { 1442 {
1447 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID); 1443 m_log.WarnFormat("[LAND] unable to find parcelID {0}", parcelID);
1448 } 1444 }
1449 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty()); 1445 return LLSDHelpers.SerialiseLLSDReply(new LLSDEmpty());
1450 } 1446 }
1451 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the 1447 // we cheat here: As we don't have (and want) a grid-global parcel-store, we can't return the
1452 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to. 1448 // "real" parcelID, because we wouldn't be able to map that to the region the parcel belongs to.
1453 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x 1449 // So, we create a "fake" parcelID by using the regionHandle (64 bit), and the local (integer) x
@@ -1524,19 +1520,19 @@ namespace OpenSim.Region.CoreModules.World.Land
1524 if (parcelID == UUID.Zero) 1520 if (parcelID == UUID.Zero)
1525 return; 1521 return;
1526 1522
1527 ExtendedLandData data = 1523 ExtendedLandData data =
1528 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(), 1524 (ExtendedLandData)parcelInfoCache.Get(parcelID.ToString(),
1529 delegate(string id) 1525 delegate(string id)
1530 { 1526 {
1531 UUID parcel = UUID.Zero; 1527 UUID parcel = UUID.Zero;
1532 UUID.TryParse(id, out parcel); 1528 UUID.TryParse(id, out parcel);
1533 // assume we've got the parcelID we just computed in RemoteParcelRequest 1529 // assume we've got the parcelID we just computed in RemoteParcelRequest
1534 ExtendedLandData extLandData = new ExtendedLandData(); 1530 ExtendedLandData extLandData = new ExtendedLandData();
1535 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle, 1531 Util.ParseFakeParcelID(parcel, out extLandData.RegionHandle,
1536 out extLandData.X, out extLandData.Y); 1532 out extLandData.X, out extLandData.Y);
1537 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}", 1533 m_log.DebugFormat("[LAND] got parcelinfo request for regionHandle {0}, x/y {1}/{2}",
1538 extLandData.RegionHandle, extLandData.X, extLandData.Y); 1534 extLandData.RegionHandle, extLandData.X, extLandData.Y);
1539 1535
1540 // for this region or for somewhere else? 1536 // for this region or for somewhere else?
1541 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) 1537 if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
1542 { 1538 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 1b2cabb..bd1dd66 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -229,13 +229,13 @@ namespace OpenSim.Region.CoreModules.World.Land
229 newData.SnapshotID = args.SnapshotID; 229 newData.SnapshotID = args.SnapshotID;
230 newData.UserLocation = args.UserLocation; 230 newData.UserLocation = args.UserLocation;
231 newData.UserLookAt = args.UserLookAt; 231 newData.UserLookAt = args.UserLookAt;
232 newData.MediaType = args.MediaType; 232 newData.MediaType = args.MediaType;
233 newData.MediaDescription = args.MediaDescription; 233 newData.MediaDescription = args.MediaDescription;
234 newData.MediaWidth = args.MediaWidth; 234 newData.MediaWidth = args.MediaWidth;
235 newData.MediaHeight = args.MediaHeight; 235 newData.MediaHeight = args.MediaHeight;
236 newData.MediaLoop = args.MediaLoop; 236 newData.MediaLoop = args.MediaLoop;
237 newData.ObscureMusic = args.ObscureMusic; 237 newData.ObscureMusic = args.ObscureMusic;
238 newData.ObscureMedia = args.ObscureMedia; 238 newData.ObscureMedia = args.ObscureMedia;
239 239
240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData); 240 m_scene.LandChannel.UpdateLandObject(LandData.LocalID, newData);
241 241
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
index 82ad109..7c5d044 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs
@@ -54,11 +54,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
54{ 54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")] 55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MoapModule")]
56 public class MoapModule : INonSharedRegionModule, IMoapModule 56 public class MoapModule : INonSharedRegionModule, IMoapModule
57 { 57 {
58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 58 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
59 59
60 public string Name { get { return "MoapModule"; } } 60 public string Name { get { return "MoapModule"; } }
61 public Type ReplaceableInterface { get { return null; } } 61 public Type ReplaceableInterface { get { return null; } }
62 62
63 /// <summary> 63 /// <summary>
64 /// Is this module enabled? 64 /// Is this module enabled?
@@ -78,17 +78,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
78 /// <summary> 78 /// <summary>
79 /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate. 79 /// Track the ObjectMedia capabilities given to users keyed by agent. Lock m_omCapUsers to manipulate.
80 /// </summary> 80 /// </summary>
81 protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>(); 81 protected Dictionary<UUID, string> m_omCapUrls = new Dictionary<UUID, string>();
82 82
83 /// <summary> 83 /// <summary>
84 /// Track the ObjectMediaUpdate capabilities given to users keyed by path 84 /// Track the ObjectMediaUpdate capabilities given to users keyed by path
85 /// </summary> 85 /// </summary>
86 protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>(); 86 protected Dictionary<string, UUID> m_omuCapUsers = new Dictionary<string, UUID>();
87 87
88 /// <summary> 88 /// <summary>
89 /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate 89 /// Track the ObjectMediaUpdate capabilities given to users keyed by agent. Lock m_omuCapUsers to manipulate
90 /// </summary> 90 /// </summary>
91 protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>(); 91 protected Dictionary<UUID, string> m_omuCapUrls = new Dictionary<UUID, string>();
92 92
93 public void Initialise(IConfigSource configSource) 93 public void Initialise(IConfigSource configSource)
94 { 94 {
@@ -129,7 +129,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
129 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps; 129 m_scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
130 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps; 130 m_scene.EventManager.OnDeregisterCaps -= OnDeregisterCaps;
131 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy; 131 m_scene.EventManager.OnSceneObjectPartCopy -= OnSceneObjectPartCopy;
132 } 132 }
133 133
134 public void OnRegisterCaps(UUID agentID, Caps caps) 134 public void OnRegisterCaps(UUID agentID, Caps caps)
135 { 135 {
@@ -159,7 +159,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
159 caps.RegisterHandler( 159 caps.RegisterHandler(
160 "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage)); 160 "ObjectMediaNavigate", new RestStreamHandler("POST", omuCapUrl, HandleObjectMediaNavigateMessage));
161 } 161 }
162 } 162 }
163 163
164 public void OnDeregisterCaps(UUID agentID, Caps caps) 164 public void OnDeregisterCaps(UUID agentID, Caps caps)
165 { 165 {
@@ -179,7 +179,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
179 } 179 }
180 180
181 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed) 181 protected void OnSceneObjectPartCopy(SceneObjectPart copy, SceneObjectPart original, bool userExposed)
182 { 182 {
183 if (original.Shape.Media != null) 183 if (original.Shape.Media != null)
184 { 184 {
185 PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList(); 185 PrimitiveBaseShape.MediaList dupeMedia = new PrimitiveBaseShape.MediaList();
@@ -195,7 +195,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
195 } 195 }
196 196
197 copy.Shape.Media = dupeMedia; 197 copy.Shape.Media = dupeMedia;
198 } 198 }
199 } 199 }
200 200
201 public MediaEntry GetMediaEntry(SceneObjectPart part, int face) 201 public MediaEntry GetMediaEntry(SceneObjectPart part, int face)
@@ -211,9 +211,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
211 me = null; 211 me = null;
212 } 212 }
213 else 213 else
214 { 214 {
215 lock (media) 215 lock (media)
216 me = media[face]; 216 me = media[face];
217 217
218 // TODO: Really need a proper copy constructor down in libopenmetaverse 218 // TODO: Really need a proper copy constructor down in libopenmetaverse
219 if (me != null) 219 if (me != null)
@@ -227,17 +227,17 @@ namespace OpenSim.Region.CoreModules.Media.Moap
227 227
228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me) 228 public void SetMediaEntry(SceneObjectPart part, int face, MediaEntry me)
229 { 229 {
230 CheckFaceParam(part, face); 230 CheckFaceParam(part, face);
231 231
232 if (null == part.Shape.Media) 232 if (null == part.Shape.Media)
233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]); 233 part.Shape.Media = new PrimitiveBaseShape.MediaList(new MediaEntry[part.GetNumberOfSides()]);
234 234
235 lock (part.Shape.Media) 235 lock (part.Shape.Media)
236 part.Shape.Media[face] = me; 236 part.Shape.Media[face] = me;
237 237
238 UpdateMediaUrl(part, UUID.Zero); 238 UpdateMediaUrl(part, UUID.Zero);
239 part.ScheduleFullUpdate(); 239 part.ScheduleFullUpdate();
240 part.TriggerScriptChangedEvent(Changed.MEDIA); 240 part.TriggerScriptChangedEvent(Changed.MEDIA);
241 } 241 }
242 242
243 public void ClearMediaEntry(SceneObjectPart part, int face) 243 public void ClearMediaEntry(SceneObjectPart part, int face)
@@ -256,7 +256,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
256 /// <returns></returns> 256 /// <returns></returns>
257 protected string HandleObjectMediaMessage( 257 protected string HandleObjectMediaMessage(
258 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 258 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
259 { 259 {
260// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request); 260// m_log.DebugFormat("[MOAP]: Got ObjectMedia path [{0}], raw request [{1}]", path, request);
261 261
262 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); 262 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
@@ -266,12 +266,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
266 if (omm.Request is ObjectMediaRequest) 266 if (omm.Request is ObjectMediaRequest)
267 return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest); 267 return HandleObjectMediaRequest(omm.Request as ObjectMediaRequest);
268 else if (omm.Request is ObjectMediaUpdate) 268 else if (omm.Request is ObjectMediaUpdate)
269 return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate); 269 return HandleObjectMediaUpdate(path, omm.Request as ObjectMediaUpdate);
270 270
271 throw new Exception( 271 throw new Exception(
272 string.Format( 272 string.Format(
273 "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}", 273 "[MOAP]: ObjectMediaMessage has unrecognized ObjectMediaBlock of {0}",
274 omm.Request.GetType())); 274 omm.Request.GetType()));
275 } 275 }
276 276
277 /// <summary> 277 /// <summary>
@@ -279,7 +279,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
279 /// </summary> 279 /// </summary>
280 /// <param name="omr"></param> 280 /// <param name="omr"></param>
281 /// <returns></returns> 281 /// <returns></returns>
282 protected string HandleObjectMediaRequest(ObjectMediaRequest omr) 282 protected string HandleObjectMediaRequest(ObjectMediaRequest omr)
283 { 283 {
284 UUID primId = omr.PrimID; 284 UUID primId = omr.PrimID;
285 285
@@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
318 /// <param name="path">Path on which this request was made</param> 318 /// <param name="path">Path on which this request was made</param>
319 /// <param name="omu">/param> 319 /// <param name="omu">/param>
320 /// <returns></returns> 320 /// <returns></returns>
321 protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu) 321 protected string HandleObjectMediaUpdate(string path, ObjectMediaUpdate omu)
322 { 322 {
323 UUID primId = omu.PrimID; 323 UUID primId = omu.PrimID;
324 324
@@ -330,9 +330,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
330 "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}", 330 "[MOAP]: Received an UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in region {1}",
331 primId, m_scene.RegionInfo.RegionName); 331 primId, m_scene.RegionInfo.RegionName);
332 return string.Empty; 332 return string.Empty;
333 } 333 }
334 334
335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId); 335// m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", omu.FaceMedia.Length, primId);
336 336
337// for (int i = 0; i < omu.FaceMedia.Length; i++) 337// for (int i = 0; i < omu.FaceMedia.Length; i++)
338// { 338// {
@@ -374,14 +374,14 @@ namespace OpenSim.Region.CoreModules.Media.Moap
374 part.Shape.Textures = te; 374 part.Shape.Textures = te;
375// m_log.DebugFormat( 375// m_log.DebugFormat(
376// "[MOAP]: Media flags for face {0} is {1}", 376// "[MOAP]: Media flags for face {0} is {1}",
377// i, part.Shape.Textures.FaceTextures[i].MediaFlags); 377// i, part.Shape.Textures.FaceTextures[i].MediaFlags);
378 } 378 }
379 } 379 }
380 } 380 }
381 else 381 else
382 { 382 {
383 // We need to go through the media textures one at a time to make sure that we have permission 383 // We need to go through the media textures one at a time to make sure that we have permission
384 // to change them 384 // to change them
385 385
386 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get 386 // FIXME: Race condition here since some other texture entry manipulator may overwrite/get
387 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry 387 // overwritten. Unfortunately, PrimitiveBaseShape does not allow us to change texture entry
@@ -391,18 +391,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
391 lock (media) 391 lock (media)
392 { 392 {
393 for (int i = 0; i < media.Count; i++) 393 for (int i = 0; i < media.Count; i++)
394 { 394 {
395 if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i)) 395 if (m_scene.Permissions.CanControlPrimMedia(agentId, part.UUID, i))
396 { 396 {
397 media[i] = omu.FaceMedia[i]; 397 media[i] = omu.FaceMedia[i];
398 398
399 // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal 399 // When a face is cleared this is done by setting the MediaFlags in the TextureEntry via a normal
400 // texture update, so we don't need to worry about clearing MediaFlags here. 400 // texture update, so we don't need to worry about clearing MediaFlags here.
401 if (null == media[i]) 401 if (null == media[i])
402 continue; 402 continue;
403 403
404 Primitive.TextureEntryFace face = te.CreateFace((uint)i); 404 Primitive.TextureEntryFace face = te.CreateFace((uint)i);
405 face.MediaFlags = true; 405 face.MediaFlags = true;
406 406
407 // m_log.DebugFormat( 407 // m_log.DebugFormat(
408 // "[MOAP]: Media flags for face {0} is {1}", 408 // "[MOAP]: Media flags for face {0} is {1}",
@@ -414,11 +414,11 @@ namespace OpenSim.Region.CoreModules.Media.Moap
414 414
415 part.Shape.Textures = te; 415 part.Shape.Textures = te;
416 416
417// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++) 417// for (int i2 = 0; i2 < part.Shape.Textures.FaceTextures.Length; i2++)
418// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]); 418// m_log.DebugFormat("[MOAP]: FaceTexture[{0}] is {1}", i2, part.Shape.Textures.FaceTextures[i2]);
419 } 419 }
420 420
421 UpdateMediaUrl(part, agentId); 421 UpdateMediaUrl(part, agentId);
422 422
423 // Arguably, we could avoid sending a full update to the avatar that just changed the texture. 423 // Arguably, we could avoid sending a full update to the avatar that just changed the texture.
424 part.ScheduleFullUpdate(); 424 part.ScheduleFullUpdate();
@@ -439,16 +439,16 @@ namespace OpenSim.Region.CoreModules.Media.Moap
439 /// <returns></returns> 439 /// <returns></returns>
440 protected string HandleObjectMediaNavigateMessage( 440 protected string HandleObjectMediaNavigateMessage(
441 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse) 441 string request, string path, string param, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
442 { 442 {
443// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request); 443// m_log.DebugFormat("[MOAP]: Got ObjectMediaNavigate request [{0}]", request);
444 444
445 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request); 445 OSDMap osd = (OSDMap)OSDParser.DeserializeLLSDXml(request);
446 ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage(); 446 ObjectMediaNavigateMessage omn = new ObjectMediaNavigateMessage();
447 omn.Deserialize(osd); 447 omn.Deserialize(osd);
448 448
449 UUID primId = omn.PrimID; 449 UUID primId = omn.PrimID;
450 450
451 SceneObjectPart part = m_scene.GetSceneObjectPart(primId); 451 SceneObjectPart part = m_scene.GetSceneObjectPart(primId);
452 452
453 if (null == part) 453 if (null == part)
454 { 454 {
@@ -456,12 +456,12 @@ namespace OpenSim.Region.CoreModules.Media.Moap
456 "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}", 456 "[MOAP]: Received an ObjectMediaNavigateMessage for prim {0} but this doesn't exist in region {1}",
457 primId, m_scene.RegionInfo.RegionName); 457 primId, m_scene.RegionInfo.RegionName);
458 return string.Empty; 458 return string.Empty;
459 } 459 }
460 460
461 UUID agentId = default(UUID); 461 UUID agentId = default(UUID);
462 462
463 lock (m_omuCapUsers) 463 lock (m_omuCapUsers)
464 agentId = m_omuCapUsers[path]; 464 agentId = m_omuCapUsers[path];
465 465
466 if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face)) 466 if (!m_scene.Permissions.CanInteractWithPrimMedia(agentId, part.UUID, omn.Face))
467 return string.Empty; 467 return string.Empty;
@@ -484,7 +484,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
484 return string.Empty; 484 return string.Empty;
485 485
486 if (me.EnableWhiteList) 486 if (me.EnableWhiteList)
487 { 487 {
488 if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList)) 488 if (!CheckUrlAgainstWhitelist(omn.URL, me.WhiteList))
489 { 489 {
490// m_log.DebugFormat( 490// m_log.DebugFormat(
@@ -493,18 +493,18 @@ namespace OpenSim.Region.CoreModules.Media.Moap
493 493
494 return string.Empty; 494 return string.Empty;
495 } 495 }
496 } 496 }
497 497
498 me.CurrentURL = omn.URL; 498 me.CurrentURL = omn.URL;
499 499
500 UpdateMediaUrl(part, agentId); 500 UpdateMediaUrl(part, agentId);
501 501
502 part.ScheduleFullUpdate(); 502 part.ScheduleFullUpdate();
503 503
504 part.TriggerScriptChangedEvent(Changed.MEDIA); 504 part.TriggerScriptChangedEvent(Changed.MEDIA);
505 505
506 return OSDParser.SerializeLLSDXmlString(new OSD()); 506 return OSDParser.SerializeLLSDXmlString(new OSD());
507 } 507 }
508 508
509 /// <summary> 509 /// <summary>
510 /// Check that the face number is valid for the given prim. 510 /// Check that the face number is valid for the given prim.
@@ -519,7 +519,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
519 int maxFaces = part.GetNumberOfSides() - 1; 519 int maxFaces = part.GetNumberOfSides() - 1;
520 if (face > maxFaces) 520 if (face > maxFaces)
521 throw new ArgumentException( 521 throw new ArgumentException(
522 string.Format("Face argument was {0} but max is {1}", face, maxFaces)); 522 string.Format("Face argument was {0} but max is {1}", face, maxFaces));
523 } 523 }
524 524
525 /// <summary> 525 /// <summary>
@@ -542,9 +542,9 @@ namespace OpenSim.Region.CoreModules.Media.Moap
542 string rawVersion = part.MediaUrl.Substring(5, 10); 542 string rawVersion = part.MediaUrl.Substring(5, 10);
543 int version = int.Parse(rawVersion); 543 int version = int.Parse(rawVersion);
544 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId); 544 part.MediaUrl = string.Format("x-mv:{0:D10}/{1}", ++version, updateId);
545 } 545 }
546 546
547// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID); 547// m_log.DebugFormat("[MOAP]: Storing media url [{0}] in prim {1} {2}", part.MediaUrl, part.Name, part.UUID);
548 } 548 }
549 549
550 /// <summary> 550 /// <summary>
@@ -554,7 +554,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
554 /// <param name="whitelist"></param> 554 /// <param name="whitelist"></param>
555 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns> 555 /// <returns>true if the url matches an entry on the whitelist, false otherwise</returns>
556 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist) 556 protected bool CheckUrlAgainstWhitelist(string rawUrl, string[] whitelist)
557 { 557 {
558 Uri url = new Uri(rawUrl); 558 Uri url = new Uri(rawUrl);
559 559
560 foreach (string origWlUrl in whitelist) 560 foreach (string origWlUrl in whitelist)
@@ -575,7 +575,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
575 if (url.Host.Contains(wlUrl)) 575 if (url.Host.Contains(wlUrl))
576 { 576 {
577// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl); 577// m_log.DebugFormat("[MOAP]: Whitelist URL {0} matches {1}", origWlUrl, rawUrl);
578 return true; 578 return true;
579 } 579 }
580 } 580 }
581 else 581 else
@@ -588,7 +588,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap
588 return true; 588 return true;
589 } 589 }
590 } 590 }
591 } 591 }
592 592
593 return false; 593 return false;
594 } 594 }
diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
index 12750c5..db50339 100644
--- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs
@@ -49,8 +49,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
49 protected Scene m_scene = null; 49 protected Scene m_scene = null;
50 protected IDialogModule m_dialogModule; 50 protected IDialogModule m_dialogModule;
51 51
52 public string Name { get { return "Object BuySell Module"; } } 52 public string Name { get { return "Object BuySell Module"; } }
53 public Type ReplaceableInterface { get { return null; } } 53 public Type ReplaceableInterface { get { return null; } }
54 54
55 public void Initialise(IConfigSource source) {} 55 public void Initialise(IConfigSource source) {}
56 56
@@ -78,8 +78,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
78 78
79 public void SubscribeToClientEvents(IClientAPI client) 79 public void SubscribeToClientEvents(IClientAPI client)
80 { 80 {
81 client.OnObjectSaleInfo += ObjectSaleInfo; 81 client.OnObjectSaleInfo += ObjectSaleInfo;
82 } 82 }
83 83
84 protected void ObjectSaleInfo( 84 protected void ObjectSaleInfo(
85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice) 85 IClientAPI client, UUID agentID, UUID sessionID, uint localID, byte saleType, int salePrice)
@@ -99,7 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
99 part.ParentGroup.HasGroupChanged = true; 99 part.ParentGroup.HasGroupChanged = true;
100 100
101 part.GetProperties(client); 101 part.GetProperties(client);
102 } 102 }
103 103
104 public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType) 104 public bool BuyObject(IClientAPI remoteClient, UUID categoryID, uint localID, byte saleType)
105 { 105 {
@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
225 } 225 }
226 else 226 else
227 { 227 {
228 if (m_dialogModule != null) 228 if (m_dialogModule != null)
229 m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); 229 m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
230 return false; 230 return false;
231 } 231 }
@@ -261,6 +261,6 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
261 } 261 }
262 262
263 return true; 263 return true;
264 } 264 }
265 } 265 }
266} \ No newline at end of file 266} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index b1747ef..ecfd211 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -397,13 +397,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
397 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>(); 397 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
398 398
399 if (m_groupsModule == null) 399 if (m_groupsModule == null)
400 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work"); 400 m_log.Warn("[PERMISSIONS]: Groups module not found, group permissions will not work");
401 401
402 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>(); 402 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
403 403
404 // This log line will be commented out when no longer required for debugging 404 // This log line will be commented out when no longer required for debugging
405// if (m_moapModule == null) 405// if (m_moapModule == null)
406// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work"); 406// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
407 } 407 }
408 408
409 public void Close() 409 public void Close()
@@ -1906,7 +1906,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1906 } 1906 }
1907 1907
1908 private bool CanControlPrimMedia(UUID agentID, UUID primID, int face) 1908 private bool CanControlPrimMedia(UUID agentID, UUID primID, int face)
1909 { 1909 {
1910// m_log.DebugFormat( 1910// m_log.DebugFormat(
1911// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", 1911// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
1912// agentID, primID, face); 1912// agentID, primID, face);
@@ -1918,7 +1918,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1918 if (null == part) 1918 if (null == part)
1919 return false; 1919 return false;
1920 1920
1921 MediaEntry me = m_moapModule.GetMediaEntry(part, face); 1921 MediaEntry me = m_moapModule.GetMediaEntry(part, face);
1922 1922
1923 // If there is no existing media entry then it can be controlled (in this context, created). 1923 // If there is no existing media entry then it can be controlled (in this context, created).
1924 if (null == me) 1924 if (null == me)
@@ -1929,7 +1929,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1929// agentID, primID, face, me.ControlPermissions); 1929// agentID, primID, face, me.ControlPermissions);
1930 1930
1931 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions); 1931 return GenericPrimMediaPermission(part, agentID, me.ControlPermissions);
1932 } 1932 }
1933 1933
1934 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face) 1934 private bool CanInteractWithPrimMedia(UUID agentID, UUID primID, int face)
1935 { 1935 {
@@ -1952,15 +1952,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1952 1952
1953// m_log.DebugFormat( 1953// m_log.DebugFormat(
1954// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}", 1954// "[PERMISSIONS]: Checking CanInteractWithPrimMedia for {0} on {1} face {2} with interact permissions {3}",
1955// agentID, primID, face, me.InteractPermissions); 1955// agentID, primID, face, me.InteractPermissions);
1956 1956
1957 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions); 1957 return GenericPrimMediaPermission(part, agentID, me.InteractPermissions);
1958 } 1958 }
1959 1959
1960 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms) 1960 private bool GenericPrimMediaPermission(SceneObjectPart part, UUID agentID, MediaPermission perms)
1961 { 1961 {
1962// if (IsAdministrator(agentID)) 1962// if (IsAdministrator(agentID))
1963// return true; 1963// return true;
1964 1964
1965 if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone) 1965 if ((perms & MediaPermission.Anyone) == MediaPermission.Anyone)
1966 return true; 1966 return true;
@@ -1969,15 +1969,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1969 { 1969 {
1970 if (agentID == part.OwnerID) 1970 if (agentID == part.OwnerID)
1971 return true; 1971 return true;
1972 } 1972 }
1973 1973
1974 if ((perms & MediaPermission.Group) == MediaPermission.Group) 1974 if ((perms & MediaPermission.Group) == MediaPermission.Group)
1975 { 1975 {
1976 if (IsGroupMember(part.GroupID, agentID, 0)) 1976 if (IsGroupMember(part.GroupID, agentID, 0))
1977 return true; 1977 return true;
1978 } 1978 }
1979 1979
1980 return false; 1980 return false;
1981 } 1981 }
1982 } 1982 }
1983} \ No newline at end of file 1983} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
index bef7fe4..5067ebd 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiseObjects.cs
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
80 { 80 {
81 string xmlstream = "<scene>"; 81 string xmlstream = "<scene>";
82 82
83 List<EntityBase> EntityList = scene.GetEntities(); 83 EntityBase[] EntityList = scene.GetEntities();
84 List<string> EntityXml = new List<string>(); 84 List<string> EntityXml = new List<string>();
85 85
86 foreach (EntityBase ent in EntityList) 86 foreach (EntityBase ent in EntityList)
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index 58e4261..98fe493 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -165,12 +165,12 @@ namespace OpenSim.Region.CoreModules.World.Serialiser
165 return SceneXmlLoader.SaveGroupToXml2(grp); 165 return SceneXmlLoader.SaveGroupToXml2(grp);
166 } 166 }
167 167
168 public void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 168 public void SavePrimListToXml2(EntityBase[] entityList, string fileName)
169 { 169 {
170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName); 170 SceneXmlLoader.SavePrimListToXml2(entityList, fileName);
171 } 171 }
172 172
173 public void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) 173 public void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
174 { 174 {
175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max); 175 SceneXmlLoader.SavePrimListToXml2(entityList, stream, min, max);
176 } 176 }
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index d4166d0..4611352 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -816,7 +816,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
816 { 816 {
817 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY); 817 //m_log.Debug("Terrain packet unacked, resending patch: " + patchX + " , " + patchY);
818 client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised()); 818 client.SendLayerData(patchX, patchY, m_scene.Heightmap.GetFloatsSerialised());
819 } 819 }
820 820
821 private void StoreUndoState() 821 private void StoreUndoState()
822 { 822 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 9736b73..6bac555 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules
425 { 425 {
426 if (m_ready) 426 if (m_ready)
427 { 427 {
428 if(m_scene.GetRootAgentCount() > 0) 428 if (m_scene.GetRootAgentCount() > 0)
429 { 429 {
430 // Ask wind plugin to generate a LL wind array to be cached locally 430 // Ask wind plugin to generate a LL wind array to be cached locally
431 // Try not to update this too often, as it may involve array copies 431 // Try not to update this too often, as it may involve array copies
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 57eff8a..1bd1371 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -212,7 +212,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
212 double[,] hm = whichScene.Heightmap.GetDoubles(); 212 double[,] hm = whichScene.Heightmap.GetDoubles();
213 tc = Environment.TickCount; 213 tc = Environment.TickCount;
214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile"); 214 m_log.Info("[MAPTILE]: Generating Maptile Step 2: Object Volume Profile");
215 List<EntityBase> objs = whichScene.GetEntities(); 215 EntityBase[] objs = whichScene.GetEntities();
216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>(); 216 Dictionary<uint, DrawStruct> z_sort = new Dictionary<uint, DrawStruct>();
217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>(); 217 //SortedList<float, RectangleDrawStruct> z_sort = new SortedList<float, RectangleDrawStruct>();
218 List<float> z_sortheights = new List<float>(); 218 List<float> z_sortheights = new List<float>();
@@ -228,7 +228,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
228 SceneObjectGroup mapdot = (SceneObjectGroup)obj; 228 SceneObjectGroup mapdot = (SceneObjectGroup)obj;
229 Color mapdotspot = Color.Gray; // Default color when prim color is white 229 Color mapdotspot = Color.Gray; // Default color when prim color is white
230 230
231 // Loop over prim in group 231 // Loop over prim in group
232 List<SceneObjectPart> partList = null; 232 List<SceneObjectPart> partList = null;
233 lock (mapdot.Children) 233 lock (mapdot.Children)
234 partList = new List<SceneObjectPart>(mapdot.Children.Values); 234 partList = new List<SceneObjectPart>(mapdot.Children.Values);
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f036d85..fbc8a50 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -307,7 +307,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
307 lock (m_rootAgents) 307 lock (m_rootAgents)
308 { 308 {
309 m_rootAgents.Remove(AgentId); 309 m_rootAgents.Remove(AgentId);
310 if(m_rootAgents.Count == 0) 310 if (m_rootAgents.Count == 0)
311 StopThread(); 311 StopThread();
312 } 312 }
313 } 313 }
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
index 3c39f9e..5e75cae 100644
--- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
+++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs
@@ -101,7 +101,8 @@ namespace OpenSim.Region.DataSnapshot.Providers
101 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", ""); 101 XmlNode parent = nodeFactory.CreateNode(XmlNodeType.Element, "objectdata", "");
102 XmlNode node; 102 XmlNode node;
103 103
104 foreach (EntityBase entity in m_scene.Entities) 104 EntityBase[] entities = m_scene.Entities.GetEntities();
105 foreach (EntityBase entity in entities)
105 { 106 {
106 // only objects, not avatars 107 // only objects, not avatars
107 if (entity is SceneObjectGroup) 108 if (entity is SceneObjectGroup)
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 59c035f..6a0fb63 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -56,7 +56,7 @@ namespace OpenSim.Region.Framework.Interfaces
56 /// <param name="rot"></param> 56 /// <param name="rot"></param>
57 /// <param name="attachPos"></param> 57 /// <param name="attachPos"></param>
58 /// <param name="silent"></param> 58 /// <param name="silent"></param>
59 /// <returns>true if the object was successfully attached, false otherwise</returns> 59 /// <returns>true if the object was successfully attached, false otherwise</returns>
60 bool AttachObject( 60 bool AttachObject(
61 IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); 61 IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent);
62 62
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index f5cd528..6289f7a 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -202,7 +202,7 @@ namespace OpenSim.Region.Framework.Interfaces
202 /// Backup the inventory to the given data store 202 /// Backup the inventory to the given data store
203 /// </summary> 203 /// </summary>
204 /// <param name="datastore"></param> 204 /// <param name="datastore"></param>
205 void ProcessInventoryBackup(IRegionDataStore datastore); 205 void ProcessInventoryBackup(ISimulationDataService datastore);
206 206
207 uint MaskEffectivePermissions(); 207 uint MaskEffectivePermissions();
208 208
diff --git a/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
new file mode 100644
index 0000000..95c9659
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/IEstateDataService.cs
@@ -0,0 +1,45 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenSim.Framework;
31using OpenMetaverse;
32
33namespace OpenSim.Region.Framework.Interfaces
34{
35 public interface IEstateDataService
36 {
37 EstateSettings LoadEstateSettings(UUID regionID, bool create);
38 EstateSettings LoadEstateSettings(int estateID);
39 void StoreEstateSettings(EstateSettings es);
40 List<int> GetEstates(string search);
41 bool LinkRegion(UUID regionID, int estateID);
42 List<UUID> GetRegions(int estateID);
43 bool DeleteEstate(int estateID);
44 }
45}
diff --git a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
index 2c091e7..4c501f6 100644
--- a/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IGroupsModule.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces
65 /// Get a group 65 /// Get a group
66 /// </summary> 66 /// </summary>
67 /// <param name="GroupID">ID of the group</param> 67 /// <param name="GroupID">ID of the group</param>
68 /// <returns>The group's data. Null if there is no such group.</returns> 68 /// <returns>The group's data. Null if there is no such group.</returns>
69 GroupRecord GetGroupRecord(UUID GroupID); 69 GroupRecord GetGroupRecord(UUID GroupID);
70 70
71 void ActivateGroup(IClientAPI remoteClient, UUID groupID); 71 void ActivateGroup(IClientAPI remoteClient, UUID groupID);
@@ -74,14 +74,14 @@ namespace OpenSim.Region.Framework.Interfaces
74 List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID); 74 List<GroupRolesData> GroupRoleDataRequest(IClientAPI remoteClient, UUID groupID);
75 List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID); 75 List<GroupRoleMembersData> GroupRoleMembersRequest(IClientAPI remoteClient, UUID groupID);
76 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID); 76 GroupProfileData GroupProfileRequest(IClientAPI remoteClient, UUID groupID);
77 GroupMembershipData[] GetMembershipData(UUID UserID); 77 GroupMembershipData[] GetMembershipData(UUID UserID);
78 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID); 78 GroupMembershipData GetMembershipData(UUID GroupID, UUID UserID);
79 79
80 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish); 80 void UpdateGroupInfo(IClientAPI remoteClient, UUID groupID, string charter, bool showInList, UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish);
81 81
82 void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile); 82 void SetGroupAcceptNotices(IClientAPI remoteClient, UUID groupID, bool acceptNotices, bool listInProfile);
83 83
84 void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID); 84 void GroupTitleUpdate(IClientAPI remoteClient, UUID GroupID, UUID TitleRoleID);
85 85
86 GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID); 86 GroupNoticeData[] GroupNoticesListRequest(IClientAPI remoteClient, UUID GroupID);
87 string GetGroupTitle(UUID avatarID); 87 string GetGroupTitle(UUID avatarID);
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
index 01066e6..ddf7565 100644
--- a/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IInventoryArchiverModule.cs
@@ -43,14 +43,14 @@ namespace OpenSim.Region.Framework.Interfaces
43 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param> 43 /// <param name="reportedException">Contains the exception generated if the save did not succeed</param>
44 public delegate void InventoryArchiveSaved( 44 public delegate void InventoryArchiveSaved(
45 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException); 45 Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, Exception reportedException);
46 46
47 public interface IInventoryArchiverModule 47 public interface IInventoryArchiverModule
48 { 48 {
49 /// <summary> 49 /// <summary>
50 /// Fired when an archive inventory save has been completed. 50 /// Fired when an archive inventory save has been completed.
51 /// </summary> 51 /// </summary>
52 event InventoryArchiveSaved OnInventoryArchiveSaved; 52 event InventoryArchiveSaved OnInventoryArchiveSaved;
53 53
54 /// <summary> 54 /// <summary>
55 /// Dearchive a user's inventory folder from the given stream 55 /// Dearchive a user's inventory folder from the given stream
56 /// </summary> 56 /// </summary>
@@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces
60 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param> 60 /// <param name="loadStream">The stream from which the inventory archive will be loaded</param>
61 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 61 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
62 bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream); 62 bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream);
63 63
64 /// <summary> 64 /// <summary>
65 /// Dearchive a user's inventory folder from the given stream 65 /// Dearchive a user's inventory folder from the given stream
66 /// </summary> 66 /// </summary>
@@ -72,8 +72,8 @@ namespace OpenSim.Region.Framework.Interfaces
72 /// the loaded IAR with existing folders where possible.</param> 72 /// the loaded IAR with existing folders where possible.</param>
73 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 73 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
74 bool DearchiveInventory( 74 bool DearchiveInventory(
75 string firstName, string lastName, string invPath, string pass, Stream loadStream, 75 string firstName, string lastName, string invPath, string pass, Stream loadStream,
76 Dictionary<string, object> options); 76 Dictionary<string, object> options);
77 77
78 /// <summary> 78 /// <summary>
79 /// Archive a user's inventory folder to the given stream 79 /// Archive a user's inventory folder to the given stream
@@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Interfaces
85 /// <param name="saveStream">The stream to which the inventory archive will be saved</param> 85 /// <param name="saveStream">The stream to which the inventory archive will be saved</param>
86 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 86 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
87 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream); 87 bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream);
88 88
89 /// <summary> 89 /// <summary>
90 /// Archive a user's inventory folder to the given stream 90 /// Archive a user's inventory folder to the given stream
91 /// </summary> 91 /// </summary>
@@ -97,7 +97,7 @@ namespace OpenSim.Region.Framework.Interfaces
97 /// <param name="options">Archiving options. Currently, there are none.</param> 97 /// <param name="options">Archiving options. Currently, there are none.</param>
98 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns> 98 /// <returns>true if the first stage of the operation succeeded, false otherwise</returns>
99 bool ArchiveInventory( 99 bool ArchiveInventory(
100 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, 100 Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream,
101 Dictionary<string, object> options); 101 Dictionary<string, object> options);
102 } 102 }
103} 103}
diff --git a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
index 24b6860..1d3d240 100644
--- a/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IMoapModule.cs
@@ -63,5 +63,5 @@ namespace OpenSim.Region.Framework.Interfaces
63 /// <param name="part"></param> 63 /// <param name="part"></param>
64 /// <param name="face">/param> 64 /// <param name="face">/param>
65 void ClearMediaEntry(SceneObjectPart part, int face); 65 void ClearMediaEntry(SceneObjectPart part, int face);
66 } 66 }
67} \ No newline at end of file 67} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
index e7562a5..18758c8 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionSerialiserModule.cs
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Interfaces
90 /// </summary> 90 /// </summary>
91 /// <param name="entityList"></param> 91 /// <param name="entityList"></param>
92 /// <param name="fileName"></param> 92 /// <param name="fileName"></param>
93 void SavePrimListToXml2(List<EntityBase> entityList, string fileName); 93 void SavePrimListToXml2(EntityBase[] entityList, string fileName);
94 94
95 /// <summary> 95 /// <summary>
96 /// Save a set of prims in the xml2 format, optionally specifying a bounding box for which 96 /// 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
101 /// <param name="stream"></param> 101 /// <param name="stream"></param>
102 /// <param name="min"></param> 102 /// <param name="min"></param>
103 /// <param name="max"></param> 103 /// <param name="max"></param>
104 void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max); 104 void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max);
105 105
106 void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName); 106 void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName);
107 107
diff --git a/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
new file mode 100644
index 0000000..edaa07c
--- /dev/null
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataService.cs
@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes;
33
34namespace OpenSim.Region.Framework.Interfaces
35{
36 public interface ISimulationDataService
37 {
38 /// <summary>
39 /// Stores all object's details apart from inventory
40 /// </summary>
41 /// <param name="obj"></param>
42 /// <param name="regionUUID"></param>
43 void StoreObject(SceneObjectGroup obj, UUID regionUUID);
44
45 /// <summary>
46 /// Entirely removes the object, including inventory
47 /// </summary>
48 /// <param name="uuid"></param>
49 /// <param name="regionUUID"></param>
50 /// <returns></returns>
51 void RemoveObject(UUID uuid, UUID regionUUID);
52
53 /// <summary>
54 /// Store a prim's inventory
55 /// </summary>
56 /// <returns></returns>
57 void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items);
58
59 /// <summary>
60 /// Load persisted objects from region storage.
61 /// </summary>
62 /// <param name="regionUUID">the Region UUID</param>
63 /// <returns>List of loaded groups</returns>
64 List<SceneObjectGroup> LoadObjects(UUID regionUUID);
65
66 /// <summary>
67 /// Store a terrain revision in region storage
68 /// </summary>
69 /// <param name="ter">HeightField data</param>
70 /// <param name="regionID">region UUID</param>
71 void StoreTerrain(double[,] terrain, UUID regionID);
72
73 /// <summary>
74 /// Load the latest terrain revision from region storage
75 /// </summary>
76 /// <param name="regionID">the region UUID</param>
77 /// <returns>Heightfield data</returns>
78 double[,] LoadTerrain(UUID regionID);
79
80 void StoreLandObject(ILandObject Parcel);
81
82 /// <summary>
83 /// <list type="bullet">
84 /// <item>delete from land where UUID=globalID</item>
85 /// <item>delete from landaccesslist where LandUUID=globalID</item>
86 /// </list>
87 /// </summary>
88 /// <param name="globalID"></param>
89 void RemoveLandObject(UUID globalID);
90
91 List<LandData> LoadLandObjects(UUID regionUUID);
92
93 void StoreRegionSettings(RegionSettings rs);
94 RegionSettings LoadRegionSettings(UUID regionUUID);
95 RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID);
96 void StoreRegionWindlightSettings(RegionLightShareData wl);
97 }
98}
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
index 3e8e196..0a4d531 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionDataStore.cs
+++ b/OpenSim/Region/Framework/Interfaces/ISimulationDataStore.cs
@@ -32,7 +32,7 @@ using OpenSim.Region.Framework.Scenes;
32 32
33namespace OpenSim.Region.Framework.Interfaces 33namespace OpenSim.Region.Framework.Interfaces
34{ 34{
35 public interface IRegionDataStore 35 public interface ISimulationDataStore
36 { 36 {
37 /// <summary> 37 /// <summary>
38 /// Initialises the data storage engine 38 /// Initialises the data storage engine
diff --git a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
index d6e31f4..65c57a6 100644
--- a/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IWorldMapModule.cs
@@ -31,7 +31,7 @@ namespace OpenSim.Region.Framework.Interfaces
31 { 31 {
32 /// <summary> 32 /// <summary>
33 /// Generate a map tile for the scene. a terrain texture for this scene 33 /// Generate a map tile for the scene. a terrain texture for this scene
34 /// </summary> 34 /// </summary>
35 void GenerateMaptile(); 35 void GenerateMaptile();
36 } 36 }
37} 37}
diff --git a/OpenSim/Region/Framework/Scenes/EntityManager.cs b/OpenSim/Region/Framework/Scenes/EntityManager.cs
index c246e32..0defa93 100644
--- a/OpenSim/Region/Framework/Scenes/EntityManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EntityManager.cs
@@ -34,227 +34,89 @@ using OpenMetaverse;
34 34
35namespace OpenSim.Region.Framework.Scenes 35namespace OpenSim.Region.Framework.Scenes
36{ 36{
37 public class EntityManager : IEnumerable<EntityBase> 37 public class EntityManager
38 { 38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 private readonly Dictionary<UUID,EntityBase> m_eb_uuid = new Dictionary<UUID, EntityBase>(); 40 private readonly DoubleDictionary<UUID, uint, EntityBase> m_entities = new DoubleDictionary<UUID, uint, EntityBase>();
41 private readonly Dictionary<uint, EntityBase> m_eb_localID = new Dictionary<uint, EntityBase>();
42 //private readonly Dictionary<UUID, ScenePresence> m_pres_uuid = new Dictionary<UUID, ScenePresence>();
43 private System.Threading.ReaderWriterLockSlim m_lock = new System.Threading.ReaderWriterLockSlim();
44 41
45 [Obsolete("Use Add() instead.")] 42 public int Count
46 public void Add(UUID id, EntityBase eb)
47 { 43 {
48 Add(eb); 44 get { return m_entities.Count; }
49 } 45 }
50 46
51 public void Add(EntityBase entity) 47 public void Add(EntityBase entity)
52 { 48 {
53 m_lock.EnterWriteLock(); 49 m_entities.Add(entity.UUID, entity.LocalId, entity);
54 try
55 {
56 try
57 {
58 m_eb_uuid.Add(entity.UUID, entity);
59 m_eb_localID.Add(entity.LocalId, entity);
60 }
61 catch(Exception e)
62 {
63 m_log.ErrorFormat("Add Entity failed: {0}", e.Message);
64 }
65 }
66 finally
67 {
68 m_lock.ExitWriteLock();
69 }
70 }
71
72 public void InsertOrReplace(EntityBase entity)
73 {
74 m_lock.EnterWriteLock();
75 try
76 {
77 try
78 {
79 m_eb_uuid[entity.UUID] = entity;
80 m_eb_localID[entity.LocalId] = entity;
81 }
82 catch(Exception e)
83 {
84 m_log.ErrorFormat("Insert or Replace Entity failed: {0}", e.Message);
85 }
86 }
87 finally
88 {
89 m_lock.ExitWriteLock();
90 }
91 } 50 }
92 51
93 public void Clear() 52 public void Clear()
94 { 53 {
95 m_lock.EnterWriteLock(); 54 m_entities.Clear();
96 try
97 {
98 m_eb_uuid.Clear();
99 m_eb_localID.Clear();
100 }
101 finally
102 {
103 m_lock.ExitWriteLock();
104 }
105 }
106
107 public int Count
108 {
109 get
110 {
111 return m_eb_uuid.Count;
112 }
113 } 55 }
114 56
115 public bool ContainsKey(UUID id) 57 public bool ContainsKey(UUID id)
116 { 58 {
117 try 59 return m_entities.ContainsKey(id);
118 {
119 return m_eb_uuid.ContainsKey(id);
120 }
121 catch
122 {
123 return false;
124 }
125 } 60 }
126 61
127 public bool ContainsKey(uint localID) 62 public bool ContainsKey(uint localID)
128 { 63 {
129 try 64 return m_entities.ContainsKey(localID);
130 {
131 return m_eb_localID.ContainsKey(localID);
132 }
133 catch
134 {
135 return false;
136 }
137 } 65 }
138 66
139 public bool Remove(uint localID) 67 public bool Remove(uint localID)
140 { 68 {
141 m_lock.EnterWriteLock(); 69 return m_entities.Remove(localID);
142 try
143 {
144 try
145 {
146 bool a = false;
147 EntityBase entity;
148 if (m_eb_localID.TryGetValue(localID, out entity))
149 a = m_eb_uuid.Remove(entity.UUID);
150
151 bool b = m_eb_localID.Remove(localID);
152 return a && b;
153 }
154 catch (Exception e)
155 {
156 m_log.ErrorFormat("Remove Entity failed for {0}", localID, e);
157 return false;
158 }
159 }
160 finally
161 {
162 m_lock.ExitWriteLock();
163 }
164 } 70 }
165 71
166 public bool Remove(UUID id) 72 public bool Remove(UUID id)
167 { 73 {
168 m_lock.EnterWriteLock(); 74 return m_entities.Remove(id);
169 try
170 {
171 try
172 {
173 bool a = false;
174 EntityBase entity;
175 if (m_eb_uuid.TryGetValue(id, out entity))
176 a = m_eb_localID.Remove(entity.LocalId);
177
178 bool b = m_eb_uuid.Remove(id);
179 return a && b;
180 }
181 catch (Exception e)
182 {
183 m_log.ErrorFormat("Remove Entity failed for {0}", id, e);
184 return false;
185 }
186 }
187 finally
188 {
189 m_lock.ExitWriteLock();
190 }
191 } 75 }
192 76
193 public List<EntityBase> GetAllByType<T>() 77 public EntityBase[] GetAllByType<T>()
194 { 78 {
195 List<EntityBase> tmp = new List<EntityBase>(); 79 List<EntityBase> tmp = new List<EntityBase>();
196 80
197 m_lock.EnterReadLock(); 81 m_entities.ForEach(
198 try 82 delegate(EntityBase entity)
199 {
200 try
201 {
202 foreach (KeyValuePair<UUID, EntityBase> pair in m_eb_uuid)
203 {
204 if (pair.Value is T)
205 {
206 tmp.Add(pair.Value);
207 }
208 }
209 }
210 catch (Exception e)
211 { 83 {
212 m_log.ErrorFormat("GetAllByType failed for {0}", e); 84 if (entity is T)
213 tmp = null; 85 tmp.Add(entity);
214 } 86 }
215 } 87 );
216 finally
217 {
218 m_lock.ExitReadLock();
219 }
220 88
221 return tmp; 89 return tmp.ToArray();
222 } 90 }
223 91
224 public List<EntityBase> GetEntities() 92 public EntityBase[] GetEntities()
225 { 93 {
226 m_lock.EnterReadLock(); 94 List<EntityBase> tmp = new List<EntityBase>(m_entities.Count);
227 try 95 m_entities.ForEach(delegate(EntityBase entity) { tmp.Add(entity); });
228 { 96 return tmp.ToArray();
229 return new List<EntityBase>(m_eb_uuid.Values); 97 }
230 } 98
231 finally 99 public void ForEach(Action<EntityBase> action)
232 { 100 {
233 m_lock.ExitReadLock(); 101 m_entities.ForEach(action);
234 } 102 }
103
104 public EntityBase Find(Predicate<EntityBase> predicate)
105 {
106 return m_entities.FindValue(predicate);
235 } 107 }
236 108
237 public EntityBase this[UUID id] 109 public EntityBase this[UUID id]
238 { 110 {
239 get 111 get
240 { 112 {
241 m_lock.EnterReadLock(); 113 EntityBase entity;
242 try 114 m_entities.TryGetValue(id, out entity);
243 { 115 return entity;
244 EntityBase entity;
245 if (m_eb_uuid.TryGetValue(id, out entity))
246 return entity;
247 else
248 return null;
249 }
250 finally
251 {
252 m_lock.ExitReadLock();
253 }
254 } 116 }
255 set 117 set
256 { 118 {
257 InsertOrReplace(value); 119 Add(value);
258 } 120 }
259 } 121 }
260 122
@@ -262,65 +124,24 @@ namespace OpenSim.Region.Framework.Scenes
262 { 124 {
263 get 125 get
264 { 126 {
265 m_lock.EnterReadLock(); 127 EntityBase entity;
266 try 128 m_entities.TryGetValue(localID, out entity);
267 { 129 return entity;
268 EntityBase entity;
269 if (m_eb_localID.TryGetValue(localID, out entity))
270 return entity;
271 else
272 return null;
273 }
274 finally
275 {
276 m_lock.ExitReadLock();
277 }
278 } 130 }
279 set 131 set
280 { 132 {
281 InsertOrReplace(value); 133 Add(value);
282 } 134 }
283 } 135 }
284 136
285 public bool TryGetValue(UUID key, out EntityBase obj) 137 public bool TryGetValue(UUID key, out EntityBase obj)
286 { 138 {
287 m_lock.EnterReadLock(); 139 return m_entities.TryGetValue(key, out obj);
288 try
289 {
290 return m_eb_uuid.TryGetValue(key, out obj);
291 }
292 finally
293 {
294 m_lock.ExitReadLock();
295 }
296 } 140 }
297 141
298 public bool TryGetValue(uint key, out EntityBase obj) 142 public bool TryGetValue(uint key, out EntityBase obj)
299 { 143 {
300 m_lock.EnterReadLock(); 144 return m_entities.TryGetValue(key, out obj);
301 try
302 {
303 return m_eb_localID.TryGetValue(key, out obj);
304 }
305 finally
306 {
307 m_lock.ExitReadLock();
308 }
309 }
310
311 /// <summary>
312 /// This could be optimised to work on the list 'live' rather than making a safe copy and iterating that.
313 /// </summary>
314 /// <returns></returns>
315 public IEnumerator<EntityBase> GetEnumerator()
316 {
317 return GetEntities().GetEnumerator();
318 }
319
320 IEnumerator IEnumerable.GetEnumerator()
321 {
322 return GetEnumerator();
323 } 145 }
324
325 } 146 }
326} 147}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 3fae5e6..e923932 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes
61 61
62 public event OnTerrainUpdateDelegate OnTerrainUpdate; 62 public event OnTerrainUpdateDelegate OnTerrainUpdate;
63 63
64 public delegate void OnBackupDelegate(IRegionDataStore datastore, bool forceBackup); 64 public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup);
65 65
66 public event OnBackupDelegate OnBackup; 66 public event OnBackupDelegate OnBackup;
67 67
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Framework.Scenes
336 /// If the object is being attached, then the avatarID will be present. If the object is being detached then 336 /// If the object is being attached, then the avatarID will be present. If the object is being detached then
337 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). 337 /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
338 public delegate void Attach(uint localID, UUID itemID, UUID avatarID); 338 public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
339 public event Attach OnAttach; 339 public event Attach OnAttach;
340 340
341 /// <summary> 341 /// <summary>
342 /// Called immediately after an object is loaded from storage. 342 /// Called immediately after an object is loaded from storage.
@@ -348,7 +348,7 @@ namespace OpenSim.Region.Framework.Scenes
348 /// Called immediately before an object is saved to storage. 348 /// Called immediately before an object is saved to storage.
349 /// </summary> 349 /// </summary>
350 /// <param name="persistingSo"> 350 /// <param name="persistingSo">
351 /// The scene object being persisted. 351 /// The scene object being persisted.
352 /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory. 352 /// This is actually a copy of the original scene object so changes made here will be saved to storage but will not be kept in memory.
353 /// </param> 353 /// </param>
354 /// <param name="originalSo"> 354 /// <param name="originalSo">
@@ -367,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
367 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); 367 public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed);
368 368
369 public delegate void RegionUp(GridRegion region); 369 public delegate void RegionUp(GridRegion region);
370 public event RegionUp OnRegionUp; 370 public event RegionUp OnRegionUp;
371 371
372 public class MoneyTransferArgs : EventArgs 372 public class MoneyTransferArgs : EventArgs
373 { 373 {
@@ -688,7 +688,7 @@ namespace OpenSim.Region.Framework.Scenes
688 } 688 }
689 } 689 }
690 690
691 public void TriggerOnBackup(IRegionDataStore dstore, bool forced) 691 public void TriggerOnBackup(ISimulationDataService dstore, bool forced)
692 { 692 {
693 OnBackupDelegate handlerOnAttach = OnBackup; 693 OnBackupDelegate handlerOnAttach = OnBackup;
694 if (handlerOnAttach != null) 694 if (handlerOnAttach != null)
@@ -2087,7 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes
2087 } 2087 }
2088 } 2088 }
2089 } 2089 }
2090 } 2090 }
2091 2091
2092 public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo) 2092 public void TriggerOnSceneObjectPreSave(SceneObjectGroup persistingSo, SceneObjectGroup originalSo)
2093 { 2093 {
@@ -2129,7 +2129,7 @@ namespace OpenSim.Region.Framework.Scenes
2129 } 2129 }
2130 } 2130 }
2131 } 2131 }
2132 } 2132 }
2133 2133
2134 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args, 2134 public void TriggerOnParcelPropertiesUpdateRequest(LandUpdateArgs args,
2135 int local_id, IClientAPI remote_client) 2135 int local_id, IClientAPI remote_client)
@@ -2151,6 +2151,6 @@ namespace OpenSim.Region.Framework.Scenes
2151 } 2151 }
2152 } 2152 }
2153 } 2153 }
2154 } 2154 }
2155 } 2155 }
2156} 2156}
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
index 3a3ec2b..c75f8ba 100644
--- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs
+++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs
@@ -1,3 +1,30 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
1using System; 28using System;
2using System.Collections.Generic; 29using System.Collections.Generic;
3using log4net; 30using log4net;
@@ -35,7 +62,7 @@ namespace OpenSim.Region.Framework.Scenes
35 62
36 /// <summary> 63 /// <summary>
37 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the 64 /// This is added to the priority of all child prims, to make sure that the root prim update is sent to the
38 /// viewer before child prim updates. 65 /// viewer before child prim updates.
39 /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up 66 /// The adjustment is added to child prims and subtracted from root prims, so the gap ends up
40 /// being double. We do it both ways so that there is a still a priority delta even if the priority is already 67 /// being double. We do it both ways so that there is a still a priority delta even if the priority is already
41 /// double.MinValue or double.MaxValue. 68 /// double.MinValue or double.MaxValue.
@@ -123,9 +150,9 @@ namespace OpenSim.Region.Framework.Scenes
123 if (entity is SceneObjectPart) 150 if (entity is SceneObjectPart)
124 { 151 {
125 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene 152 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
126 // before its scheduled update was triggered 153 // before its scheduled update was triggered
127 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; 154 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
128 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; 155 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
129 } 156 }
130 else 157 else
131 { 158 {
@@ -152,15 +179,10 @@ namespace OpenSim.Region.Framework.Scenes
152 Vector3 entityPos = entity.AbsolutePosition; 179 Vector3 entityPos = entity.AbsolutePosition;
153 if (entity is SceneObjectPart) 180 if (entity is SceneObjectPart)
154 { 181 {
155 SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); 182 // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene
156 if (group == null) 183 // before its scheduled update was triggered
157 { 184 //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
158 entityPos = entity.AbsolutePosition; 185 entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition;
159 }
160 else
161 {
162 entityPos = group.AbsolutePosition;
163 }
164 } 186 }
165 else 187 else
166 { 188 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index ccbd880..867fb10 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -58,7 +58,8 @@ namespace OpenSim.Region.Framework.Scenes
58 { 58 {
59 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene"); 59 m_log.Info("[PRIM INVENTORY]: Starting scripts in scene");
60 60
61 foreach (EntityBase group in Entities) 61 EntityBase[] entities = Entities.GetEntities();
62 foreach (EntityBase group in entities)
62 { 63 {
63 if (group is SceneObjectGroup) 64 if (group is SceneObjectGroup)
64 { 65 {
@@ -132,7 +133,7 @@ namespace OpenSim.Region.Framework.Scenes
132 item.Owner, item.Name, item.ID); 133 item.Owner, item.Name, item.ID);
133 134
134 return false; 135 return false;
135 } 136 }
136 } 137 }
137 138
138 /// <summary> 139 /// <summary>
@@ -1987,7 +1988,7 @@ namespace OpenSim.Region.Framework.Scenes
1987 return null; 1988 return null;
1988 1989
1989 if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) 1990 if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos))
1990 return null; 1991 return null;
1991 1992
1992 if (!Permissions.BypassPermissions()) 1993 if (!Permissions.BypassPermissions())
1993 { 1994 {
@@ -2065,7 +2066,7 @@ namespace OpenSim.Region.Framework.Scenes
2065 2066
2066 List<SceneObjectPart> partList = null; 2067 List<SceneObjectPart> partList = null;
2067 lock (sog.Children) 2068 lock (sog.Children)
2068 partList = new List<SceneObjectPart>(sog.Children.Values); 2069 partList = new List<SceneObjectPart>(sog.Children.Values);
2069 2070
2070 foreach (SceneObjectPart child in partList) 2071 foreach (SceneObjectPart child in partList)
2071 child.Inventory.ChangeInventoryOwner(ownerID); 2072 child.Inventory.ChangeInventoryOwner(ownerID);
@@ -2080,7 +2081,7 @@ namespace OpenSim.Region.Framework.Scenes
2080 2081
2081 List<SceneObjectPart> partList = null; 2082 List<SceneObjectPart> partList = null;
2082 lock (sog.Children) 2083 lock (sog.Children)
2083 partList = new List<SceneObjectPart>(sog.Children.Values); 2084 partList = new List<SceneObjectPart>(sog.Children.Values);
2084 2085
2085 foreach (SceneObjectPart child in partList) 2086 foreach (SceneObjectPart child in partList)
2086 { 2087 {
@@ -2090,7 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes
2090 2091
2091 sog.SetOwnerId(groupID); 2092 sog.SetOwnerId(groupID);
2092 sog.ApplyNextOwnerPermissions(); 2093 sog.ApplyNextOwnerPermissions();
2093 } 2094 }
2094 } 2095 }
2095 2096
2096 foreach (uint localID in localIDs) 2097 foreach (uint localID in localIDs)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index c511774..7788e43 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -116,9 +116,8 @@ namespace OpenSim.Region.Framework.Scenes
116 /// <param name="remoteClient"></param> 116 /// <param name="remoteClient"></param>
117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient) 117 public void RequestPrim(uint primLocalID, IClientAPI remoteClient)
118 { 118 {
119 List<EntityBase> EntityList = GetEntities(); 119 EntityBase[] entityList = GetEntities();
120 120 foreach (EntityBase ent in entityList)
121 foreach (EntityBase ent in EntityList)
122 { 121 {
123 if (ent is SceneObjectGroup) 122 if (ent is SceneObjectGroup)
124 { 123 {
@@ -138,9 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
138 /// <param name="remoteClient"></param> 137 /// <param name="remoteClient"></param>
139 public void SelectPrim(uint primLocalID, IClientAPI remoteClient) 138 public void SelectPrim(uint primLocalID, IClientAPI remoteClient)
140 { 139 {
141 List<EntityBase> EntityList = GetEntities(); 140 EntityBase[] entityList = GetEntities();
142 141 foreach (EntityBase ent in entityList)
143 foreach (EntityBase ent in EntityList)
144 { 142 {
145 if (ent is SceneObjectGroup) 143 if (ent is SceneObjectGroup)
146 { 144 {
@@ -166,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
166 164
167 List<SceneObjectPart> partList = null; 165 List<SceneObjectPart> partList = null;
168 lock (sog.Children) 166 lock (sog.Children)
169 partList = new List<SceneObjectPart>(sog.Children.Values); 167 partList = new List<SceneObjectPart>(sog.Children.Values);
170 168
171 foreach (SceneObjectPart part in partList) 169 foreach (SceneObjectPart part in partList)
172 { 170 {
@@ -259,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes
259 257
260 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 258 public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
261 { 259 {
262 List<EntityBase> EntityList = GetEntities(); 260 EntityBase[] EntityList = GetEntities();
263 261
264 SurfaceTouchEventArgs surfaceArg = null; 262 SurfaceTouchEventArgs surfaceArg = null;
265 if (surfaceArgs != null && surfaceArgs.Count > 0) 263 if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -303,7 +301,7 @@ namespace OpenSim.Region.Framework.Scenes
303 301
304 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 302 public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
305 { 303 {
306 List<EntityBase> EntityList = GetEntities(); 304 EntityBase[] EntityList = GetEntities();
307 305
308 SurfaceTouchEventArgs surfaceArg = null; 306 SurfaceTouchEventArgs surfaceArg = null;
309 if (surfaceArgs != null && surfaceArgs.Count > 0) 307 if (surfaceArgs != null && surfaceArgs.Count > 0)
@@ -343,7 +341,7 @@ namespace OpenSim.Region.Framework.Scenes
343 341
344 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) 342 public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs)
345 { 343 {
346 List<EntityBase> EntityList = GetEntities(); 344 EntityBase[] EntityList = GetEntities();
347 345
348 SurfaceTouchEventArgs surfaceArg = null; 346 SurfaceTouchEventArgs surfaceArg = null;
349 if (surfaceArgs != null && surfaceArgs.Count > 0) 347 if (surfaceArgs != null && surfaceArgs.Count > 0)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
index 4e80bf2..06890a0 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Permissions.cs
@@ -997,6 +997,6 @@ namespace OpenSim.Region.Framework.Scenes
997 } 997 }
998 } 998 }
999 return true; 999 return true;
1000 } 1000 }
1001 } 1001 }
1002} \ No newline at end of file 1002} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index be342ab..0e1b4b1 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -57,55 +57,21 @@ namespace OpenSim.Region.Framework.Scenes
57 57
58 public partial class Scene : SceneBase 58 public partial class Scene : SceneBase
59 { 59 {
60 public delegate void SynchronizeSceneHandler(Scene scene);
61 public SynchronizeSceneHandler SynchronizeScene = null;
62
63 /* Used by the loadbalancer plugin on GForge */
64 protected int m_splitRegionID = 0;
65 public int SplitRegionID
66 {
67 get { return m_splitRegionID; }
68 set { m_splitRegionID = value; }
69 }
70
71 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L; 60 private const long DEFAULT_MIN_TIME_FOR_PERSISTENCE = 60L;
72 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L; 61 private const long DEFAULT_MAX_TIME_FOR_PERSISTENCE = 600L;
73 62
74 #region Fields 63 public delegate void SynchronizeSceneHandler(Scene scene);
75 64
76 protected Timer m_restartWaitTimer = new Timer(); 65 #region Fields
77 66
67 public SynchronizeSceneHandler SynchronizeScene;
78 public SimStatsReporter StatsReporter; 68 public SimStatsReporter StatsReporter;
79
80 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
81 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
82
83 private volatile int m_bordersLocked = 0;
84 public bool BordersLocked
85 {
86 get { return m_bordersLocked == 1; }
87 set
88 {
89 if (value == true)
90 m_bordersLocked = 1;
91 else
92 m_bordersLocked = 0;
93 }
94 }
95 public List<Border> NorthBorders = new List<Border>(); 69 public List<Border> NorthBorders = new List<Border>();
96 public List<Border> EastBorders = new List<Border>(); 70 public List<Border> EastBorders = new List<Border>();
97 public List<Border> SouthBorders = new List<Border>(); 71 public List<Border> SouthBorders = new List<Border>();
98 public List<Border> WestBorders = new List<Border>(); 72 public List<Border> WestBorders = new List<Border>();
99 73
100 /// <value> 74 /// <summary>Are we applying physics to any of the prims in this scene?</summary>
101 /// The scene graph for this scene
102 /// </value>
103 /// TODO: Possibly stop other classes being able to manipulate this directly.
104 private SceneGraph m_sceneGraph;
105
106 /// <summary>
107 /// Are we applying physics to any of the prims in this scene?
108 /// </summary>
109 public bool m_physicalPrim; 75 public bool m_physicalPrim;
110 public float m_maxNonphys = 256; 76 public float m_maxNonphys = 256;
111 public float m_maxPhys = 10; 77 public float m_maxPhys = 10;
@@ -119,25 +85,131 @@ namespace OpenSim.Region.Framework.Scenes
119 // root agents when ACL denies access to root agent 85 // root agents when ACL denies access to root agent
120 public bool m_strictAccessControl = true; 86 public bool m_strictAccessControl = true;
121 public int MaxUndoCount = 5; 87 public int MaxUndoCount = 5;
88 public bool LoginsDisabled = true;
89 public bool LoadingPrims;
90 public IXfer XferManager;
91
92 // the minimum time that must elapse before a changed object will be considered for persisted
93 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
94 // the maximum time that must elapse before a changed object will be considered for persisted
95 public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
96
97 protected int m_splitRegionID;
98 protected Timer m_restartWaitTimer = new Timer();
99 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
100 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
101 protected string m_simulatorVersion = "OpenSimulator Server";
102 protected ModuleLoader m_moduleLoader;
103 protected AgentCircuitManager m_authenticateHandler;
104 protected SceneCommunicationService m_sceneGridService;
105 protected ISnmpModule m_snmpService = null;
106
107 protected ISimulationDataService m_SimulationDataService;
108 protected IEstateDataService m_EstateDataService;
109 protected IAssetService m_AssetService;
110 protected IAuthorizationService m_AuthorizationService;
111 protected IInventoryService m_InventoryService;
112 protected IGridService m_GridService;
113 protected ILibraryService m_LibraryService;
114 protected ISimulationService m_simulationService;
115 protected IAuthenticationService m_AuthenticationService;
116 protected IPresenceService m_PresenceService;
117 protected IUserAccountService m_UserAccountService;
118 protected IAvatarService m_AvatarService;
119 protected IGridUserService m_GridUserService;
120
121 protected IXMLRPC m_xmlrpcModule;
122 protected IWorldComm m_worldCommModule;
123 protected IAvatarFactory m_AvatarFactory;
124 protected IConfigSource m_config;
125 protected IRegionSerialiserModule m_serialiser;
126 protected IDialogModule m_dialogModule;
127 protected IEntityTransferModule m_teleportModule;
128 protected ICapabilitiesModule m_capsModule;
129 // Central Update Loop
130 protected int m_fps = 10;
131 protected uint m_frame;
132 protected float m_timespan = 0.089f;
133 protected DateTime m_lastupdate = DateTime.UtcNow;
134
135 // TODO: Possibly stop other classes being able to manipulate this directly.
136 private SceneGraph m_sceneGraph;
137 private volatile int m_bordersLocked;
122 private int m_RestartTimerCounter; 138 private int m_RestartTimerCounter;
123 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 139 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
124 private int m_incrementsof15seconds; 140 private int m_incrementsof15seconds;
125 private volatile bool m_backingup; 141 private volatile bool m_backingup;
126
127 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>(); 142 private Dictionary<UUID, ReturnInfo> m_returns = new Dictionary<UUID, ReturnInfo>();
128 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>(); 143 private Dictionary<UUID, SceneObjectGroup> m_groupsWithTargets = new Dictionary<UUID, SceneObjectGroup>();
144 private Object m_heartbeatLock = new Object();
129 145
130 protected string m_simulatorVersion = "OpenSimulator Server"; 146 private int m_update_physics = 1;
147 private int m_update_entitymovement = 1;
148 private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
149 private int m_update_presences = 1; // Update scene presence movements
150 private int m_update_events = 1;
151 private int m_update_backup = 200;
152 private int m_update_terrain = 50;
153 private int m_update_land = 1;
154 private int m_update_coarse_locations = 50;
131 155
132 protected ModuleLoader m_moduleLoader; 156 private int frameMS;
133 protected StorageManager m_storageManager; 157 private int physicsMS2;
134 protected AgentCircuitManager m_authenticateHandler; 158 private int physicsMS;
159 private int otherMS;
160 private int tempOnRezMS;
161 private int eventMS;
162 private int backupMS;
163 private int terrainMS;
164 private int landMS;
165 private int lastCompletedFrame;
135 166
136 protected SceneCommunicationService m_sceneGridService;
137 public bool LoginsDisabled = true;
138 public bool LoadingPrims = false;
139 public bool CombineRegions = false; 167 public bool CombineRegions = false;
168 private bool m_physics_enabled = true;
169 private bool m_scripts_enabled = true;
170 private string m_defaultScriptEngine;
171 private int m_LastLogin;
172 private Thread HeartbeatThread;
173 private volatile bool shuttingdown;
174
175 private int m_lastUpdate;
176 private bool m_firstHeartbeat = true;
177
178 private object m_deleting_scene_object = new object();
179 private object m_cleaningAttachments = new object();
180
181 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
182 private bool m_reprioritizationEnabled = true;
183 private double m_reprioritizationInterval = 5000.0;
184 private double m_rootReprioritizationDistance = 10.0;
185 private double m_childReprioritizationDistance = 20.0;
186
187 private Timer m_mapGenerationTimer = new Timer();
188 private bool m_generateMaptiles;
189
190 #endregion Fields
140 191
192 #region Properties
193
194 /* Used by the loadbalancer plugin on GForge */
195 public int SplitRegionID
196 {
197 get { return m_splitRegionID; }
198 set { m_splitRegionID = value; }
199 }
200
201 public bool BordersLocked
202 {
203 get { return m_bordersLocked == 1; }
204 set
205 {
206 if (value == true)
207 m_bordersLocked = 1;
208 else
209 m_bordersLocked = 0;
210 }
211 }
212
141 public new float TimeDilation 213 public new float TimeDilation
142 { 214 {
143 get { return m_sceneGraph.PhysicsScene.TimeDilation; } 215 get { return m_sceneGraph.PhysicsScene.TimeDilation; }
@@ -148,9 +220,6 @@ namespace OpenSim.Region.Framework.Scenes
148 get { return m_sceneGridService; } 220 get { return m_sceneGridService; }
149 } 221 }
150 222
151 public IXfer XferManager;
152
153 protected ISnmpModule m_snmpService = null;
154 public ISnmpModule SnmpService 223 public ISnmpModule SnmpService
155 { 224 {
156 get 225 get
@@ -164,10 +233,41 @@ namespace OpenSim.Region.Framework.Scenes
164 } 233 }
165 } 234 }
166 235
167 protected IAssetService m_AssetService; 236 public ISimulationDataService SimulationDataService
168 protected IAuthorizationService m_AuthorizationService; 237 {
238 get
239 {
240 if (m_SimulationDataService == null)
241 {
242 m_SimulationDataService = RequestModuleInterface<ISimulationDataService>();
169 243
170 private Object m_heartbeatLock = new Object(); 244 if (m_SimulationDataService == null)
245 {
246 throw new Exception("No ISimulationDataService available.");
247 }
248 }
249
250 return m_SimulationDataService;
251 }
252 }
253
254 public IEstateDataService EstateDataService
255 {
256 get
257 {
258 if (m_EstateDataService == null)
259 {
260 m_EstateDataService = RequestModuleInterface<IEstateDataService>();
261
262 if (m_EstateDataService == null)
263 {
264 throw new Exception("No IEstateDataService available.");
265 }
266 }
267
268 return m_EstateDataService;
269 }
270 }
171 271
172 public IAssetService AssetService 272 public IAssetService AssetService
173 { 273 {
@@ -206,8 +306,6 @@ namespace OpenSim.Region.Framework.Scenes
206 } 306 }
207 } 307 }
208 308
209 protected IInventoryService m_InventoryService;
210
211 public IInventoryService InventoryService 309 public IInventoryService InventoryService
212 { 310 {
213 get 311 get
@@ -226,8 +324,6 @@ namespace OpenSim.Region.Framework.Scenes
226 } 324 }
227 } 325 }
228 326
229 protected IGridService m_GridService;
230
231 public IGridService GridService 327 public IGridService GridService
232 { 328 {
233 get 329 get
@@ -246,8 +342,6 @@ namespace OpenSim.Region.Framework.Scenes
246 } 342 }
247 } 343 }
248 344
249 protected ILibraryService m_LibraryService;
250
251 public ILibraryService LibraryService 345 public ILibraryService LibraryService
252 { 346 {
253 get 347 get
@@ -259,7 +353,6 @@ namespace OpenSim.Region.Framework.Scenes
259 } 353 }
260 } 354 }
261 355
262 protected ISimulationService m_simulationService;
263 public ISimulationService SimulationService 356 public ISimulationService SimulationService
264 { 357 {
265 get 358 get
@@ -270,7 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
270 } 363 }
271 } 364 }
272 365
273 protected IAuthenticationService m_AuthenticationService;
274 public IAuthenticationService AuthenticationService 366 public IAuthenticationService AuthenticationService
275 { 367 {
276 get 368 get
@@ -281,7 +373,6 @@ namespace OpenSim.Region.Framework.Scenes
281 } 373 }
282 } 374 }
283 375
284 protected IPresenceService m_PresenceService;
285 public IPresenceService PresenceService 376 public IPresenceService PresenceService
286 { 377 {
287 get 378 get
@@ -291,7 +382,7 @@ namespace OpenSim.Region.Framework.Scenes
291 return m_PresenceService; 382 return m_PresenceService;
292 } 383 }
293 } 384 }
294 protected IUserAccountService m_UserAccountService; 385
295 public IUserAccountService UserAccountService 386 public IUserAccountService UserAccountService
296 { 387 {
297 get 388 get
@@ -302,8 +393,7 @@ namespace OpenSim.Region.Framework.Scenes
302 } 393 }
303 } 394 }
304 395
305 protected OpenSim.Services.Interfaces.IAvatarService m_AvatarService; 396 public IAvatarService AvatarService
306 public OpenSim.Services.Interfaces.IAvatarService AvatarService
307 { 397 {
308 get 398 get
309 { 399 {
@@ -313,7 +403,6 @@ namespace OpenSim.Region.Framework.Scenes
313 } 403 }
314 } 404 }
315 405
316 protected IGridUserService m_GridUserService;
317 public IGridUserService GridUserService 406 public IGridUserService GridUserService
318 { 407 {
319 get 408 get
@@ -324,58 +413,18 @@ namespace OpenSim.Region.Framework.Scenes
324 } 413 }
325 } 414 }
326 415
327 protected IXMLRPC m_xmlrpcModule;
328 protected IWorldComm m_worldCommModule;
329 public IAttachmentsModule AttachmentsModule { get; set; } 416 public IAttachmentsModule AttachmentsModule { get; set; }
330 protected IAvatarFactory m_AvatarFactory; 417
331 public IAvatarFactory AvatarFactory 418 public IAvatarFactory AvatarFactory
332 { 419 {
333 get { return m_AvatarFactory; } 420 get { return m_AvatarFactory; }
334 } 421 }
335 protected IConfigSource m_config;
336 protected IRegionSerialiserModule m_serialiser;
337 protected IDialogModule m_dialogModule;
338 protected IEntityTransferModule m_teleportModule;
339 422
340 protected ICapabilitiesModule m_capsModule;
341 public ICapabilitiesModule CapsModule 423 public ICapabilitiesModule CapsModule
342 { 424 {
343 get { return m_capsModule; } 425 get { return m_capsModule; }
344 } 426 }
345 427
346 protected override IConfigSource GetConfig()
347 {
348 return m_config;
349 }
350
351 // Central Update Loop
352
353 protected int m_fps = 10;
354 protected uint m_frame;
355 protected float m_timespan = 0.089f;
356 protected DateTime m_lastupdate = DateTime.UtcNow;
357
358 private int m_update_physics = 1;
359 private int m_update_entitymovement = 1;
360 private int m_update_objects = 1; // Update objects which have scheduled themselves for updates
361 private int m_update_presences = 1; // Update scene presence movements
362 private int m_update_events = 1;
363 private int m_update_backup = 200;
364 private int m_update_terrain = 50;
365 private int m_update_land = 1;
366 private int m_update_coarse_locations = 50;
367
368 private int frameMS;
369 private int physicsMS2;
370 private int physicsMS;
371 private int otherMS;
372 private int tempOnRezMS;
373 private int eventMS;
374 private int backupMS;
375 private int terrainMS;
376 private int landMS;
377 private int lastCompletedFrame;
378
379 public int MonitorFrameTime { get { return frameMS; } } 428 public int MonitorFrameTime { get { return frameMS; } }
380 public int MonitorPhysicsUpdateTime { get { return physicsMS; } } 429 public int MonitorPhysicsUpdateTime { get { return physicsMS; } }
381 public int MonitorPhysicsSyncTime { get { return physicsMS2; } } 430 public int MonitorPhysicsSyncTime { get { return physicsMS2; } }
@@ -387,37 +436,6 @@ namespace OpenSim.Region.Framework.Scenes
387 public int MonitorLandTime { get { return landMS; } } 436 public int MonitorLandTime { get { return landMS; } }
388 public int MonitorLastFrameTick { get { return lastCompletedFrame; } } 437 public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
389 438
390 private bool m_physics_enabled = true;
391 private bool m_scripts_enabled = true;
392 private string m_defaultScriptEngine;
393 private int m_LastLogin;
394 private Thread HeartbeatThread;
395 private volatile bool shuttingdown;
396
397 private int m_lastUpdate;
398 private bool m_firstHeartbeat = true;
399
400 private object m_deleting_scene_object = new object();
401 private object m_cleaningAttachments = new object();
402
403 // the minimum time that must elapse before a changed object will be considered for persisted
404 public long m_dontPersistBefore = DEFAULT_MIN_TIME_FOR_PERSISTENCE * 10000000L;
405 // the maximum time that must elapse before a changed object will be considered for persisted
406 public long m_persistAfter = DEFAULT_MAX_TIME_FOR_PERSISTENCE * 10000000L;
407
408 private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
409 private bool m_reprioritizationEnabled = true;
410 private double m_reprioritizationInterval = 5000.0;
411 private double m_rootReprioritizationDistance = 10.0;
412 private double m_childReprioritizationDistance = 20.0;
413
414 private Timer m_mapGenerationTimer = new Timer();
415 bool m_generateMaptiles = false;
416
417 #endregion
418
419 #region Properties
420
421 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } 439 public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
422 public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } 440 public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
423 public double ReprioritizationInterval { get { return m_reprioritizationInterval; } } 441 public double ReprioritizationInterval { get { return m_reprioritizationInterval; } }
@@ -497,13 +515,13 @@ namespace OpenSim.Region.Framework.Scenes
497 set { m_sceneGraph.RestorePresences = value; } 515 set { m_sceneGraph.RestorePresences = value; }
498 } 516 }
499 517
500 #endregion 518 #endregion Properties
501 519
502 #region Constructors 520 #region Constructors
503 521
504 public Scene(RegionInfo regInfo, AgentCircuitManager authen, 522 public Scene(RegionInfo regInfo, AgentCircuitManager authen,
505 SceneCommunicationService sceneGridService, 523 SceneCommunicationService sceneGridService,
506 StorageManager storeManager, 524 ISimulationDataService simDataService, IEstateDataService estateDataService,
507 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, 525 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
508 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) 526 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
509 { 527 {
@@ -539,7 +557,8 @@ namespace OpenSim.Region.Framework.Scenes
539 m_moduleLoader = moduleLoader; 557 m_moduleLoader = moduleLoader;
540 m_authenticateHandler = authen; 558 m_authenticateHandler = authen;
541 m_sceneGridService = sceneGridService; 559 m_sceneGridService = sceneGridService;
542 m_storageManager = storeManager; 560 m_SimulationDataService = simDataService;
561 m_EstateDataService = estateDataService;
543 m_regInfo = regInfo; 562 m_regInfo = regInfo;
544 m_regionHandle = m_regInfo.RegionHandle; 563 m_regionHandle = m_regInfo.RegionHandle;
545 m_regionName = m_regInfo.RegionName; 564 m_regionName = m_regInfo.RegionName;
@@ -558,13 +577,11 @@ namespace OpenSim.Region.Framework.Scenes
558 #region Region Settings 577 #region Region Settings
559 578
560 // Load region settings 579 // Load region settings
561 m_regInfo.RegionSettings = m_storageManager.DataStore.LoadRegionSettings(m_regInfo.RegionID); 580 m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(m_regInfo.RegionID);
562 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(m_regInfo.RegionID);
563 581
564 if (m_storageManager.EstateDataStore != null) 582 m_regInfo.RegionSettings = simDataService.LoadRegionSettings(m_regInfo.RegionID);
565 { 583 if (estateDataService != null)
566 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 584 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
567 }
568 585
569 #endregion Region Settings 586 #endregion Region Settings
570 587
@@ -574,9 +591,9 @@ namespace OpenSim.Region.Framework.Scenes
574 591
575 //Bind Storage Manager functions to some land manager functions for this scene 592 //Bind Storage Manager functions to some land manager functions for this scene
576 EventManager.OnLandObjectAdded += 593 EventManager.OnLandObjectAdded +=
577 new EventManager.LandObjectAdded(m_storageManager.DataStore.StoreLandObject); 594 new EventManager.LandObjectAdded(simDataService.StoreLandObject);
578 EventManager.OnLandObjectRemoved += 595 EventManager.OnLandObjectRemoved +=
579 new EventManager.LandObjectRemoved(m_storageManager.DataStore.RemoveLandObject); 596 new EventManager.LandObjectRemoved(simDataService.RemoveLandObject);
580 597
581 m_sceneGraph = new SceneGraph(this, m_regInfo); 598 m_sceneGraph = new SceneGraph(this, m_regInfo);
582 599
@@ -1062,29 +1079,30 @@ namespace OpenSim.Region.Framework.Scenes
1062 if (ScriptEngine) 1079 if (ScriptEngine)
1063 { 1080 {
1064 m_log.Info("Stopping all Scripts in Scene"); 1081 m_log.Info("Stopping all Scripts in Scene");
1065 foreach (EntityBase ent in Entities) 1082
1083 EntityBase[] entities = Entities.GetEntities();
1084 foreach (EntityBase ent in entities)
1066 { 1085 {
1067 if (ent is SceneObjectGroup) 1086 if (ent is SceneObjectGroup)
1068 { 1087 ((SceneObjectGroup)ent).RemoveScriptInstances(false);
1069 ((SceneObjectGroup) ent).RemoveScriptInstances(false);
1070 }
1071 } 1088 }
1072 } 1089 }
1073 else 1090 else
1074 { 1091 {
1075 m_log.Info("Starting all Scripts in Scene"); 1092 m_log.Info("Starting all Scripts in Scene");
1076 lock (Entities) 1093
1094 EntityBase[] entities = Entities.GetEntities();
1095 foreach (EntityBase ent in entities)
1077 { 1096 {
1078 foreach (EntityBase ent in Entities) 1097 if (ent is SceneObjectGroup)
1079 { 1098 {
1080 if (ent is SceneObjectGroup) 1099 SceneObjectGroup sog = (SceneObjectGroup)ent;
1081 { 1100 sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0);
1082 ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); 1101 sog.ResumeScripts();
1083 ((SceneObjectGroup)ent).ResumeScripts();
1084 }
1085 } 1102 }
1086 } 1103 }
1087 } 1104 }
1105
1088 m_scripts_enabled = !ScriptEngine; 1106 m_scripts_enabled = !ScriptEngine;
1089 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); 1107 m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine");
1090 } 1108 }
@@ -1131,12 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes
1131 shuttingdown = true; 1149 shuttingdown = true;
1132 1150
1133 m_log.Debug("[SCENE]: Persisting changed objects"); 1151 m_log.Debug("[SCENE]: Persisting changed objects");
1134 List<EntityBase> entities = GetEntities(); 1152 EntityBase[] entities = GetEntities();
1135 foreach (EntityBase entity in entities) 1153 foreach (EntityBase entity in entities)
1136 { 1154 {
1137 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged) 1155 if (!entity.IsDeleted && entity is SceneObjectGroup && ((SceneObjectGroup)entity).HasGroupChanged)
1138 { 1156 {
1139 ((SceneObjectGroup)entity).ProcessBackup(m_storageManager.DataStore, false); 1157 ((SceneObjectGroup)entity).ProcessBackup(SimulationDataService, false);
1140 } 1158 }
1141 } 1159 }
1142 1160
@@ -1192,8 +1210,9 @@ namespace OpenSim.Region.Framework.Scenes
1192 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null) 1210 while (m_regInfo.EstateSettings.EstateOwner == UUID.Zero && MainConsole.Instance != null)
1193 { 1211 {
1194 MainConsole.Instance.Output("The current estate has no owner set."); 1212 MainConsole.Instance.Output("The current estate has no owner set.");
1195 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test"); 1213 List<char> excluded = new List<char>(new char[1]{' '});
1196 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User"); 1214 string first = MainConsole.Instance.CmdPrompt("Estate owner first name", "Test", excluded);
1215 string last = MainConsole.Instance.CmdPrompt("Estate owner last name", "User", excluded);
1197 1216
1198 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last); 1217 UserAccount account = UserAccountService.GetUserAccount(m_regInfo.ScopeID, first, last);
1199 1218
@@ -1577,7 +1596,7 @@ namespace OpenSim.Region.Framework.Scenes
1577 { 1596 {
1578 lock (m_returns) 1597 lock (m_returns)
1579 { 1598 {
1580 EventManager.TriggerOnBackup(m_storageManager.DataStore, forced); 1599 EventManager.TriggerOnBackup(SimulationDataService, forced);
1581 m_backingup = false; 1600 m_backingup = false;
1582 1601
1583 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns) 1602 foreach (KeyValuePair<UUID, ReturnInfo> ret in m_returns)
@@ -1618,7 +1637,7 @@ namespace OpenSim.Region.Framework.Scenes
1618 { 1637 {
1619 if (group != null) 1638 if (group != null)
1620 { 1639 {
1621 group.ProcessBackup(m_storageManager.DataStore, true); 1640 group.ProcessBackup(SimulationDataService, true);
1622 } 1641 }
1623 } 1642 }
1624 1643
@@ -1660,20 +1679,19 @@ namespace OpenSim.Region.Framework.Scenes
1660 /// </summary> 1679 /// </summary>
1661 public void SaveTerrain() 1680 public void SaveTerrain()
1662 { 1681 {
1663 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1682 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1664 } 1683 }
1665 1684
1666 public void StoreWindlightProfile(RegionLightShareData wl) 1685 public void StoreWindlightProfile(RegionLightShareData wl)
1667 { 1686 {
1668 m_regInfo.WindlightSettings = wl; 1687 m_regInfo.WindlightSettings = wl;
1669 wl.Save(); 1688 SimulationDataService.StoreRegionWindlightSettings(wl);
1670 m_storageManager.DataStore.StoreRegionWindlightSettings(wl);
1671 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1689 m_eventManager.TriggerOnSaveNewWindlightProfile();
1672 } 1690 }
1673 1691
1674 public void LoadWindlightProfile() 1692 public void LoadWindlightProfile()
1675 { 1693 {
1676 m_regInfo.WindlightSettings = m_storageManager.DataStore.LoadRegionWindlightSettings(RegionInfo.RegionID); 1694 m_regInfo.WindlightSettings = SimulationDataService.LoadRegionWindlightSettings(RegionInfo.RegionID);
1677 m_eventManager.TriggerOnSaveNewWindlightProfile(); 1695 m_eventManager.TriggerOnSaveNewWindlightProfile();
1678 } 1696 }
1679 1697
@@ -1684,13 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
1684 { 1702 {
1685 try 1703 try
1686 { 1704 {
1687 double[,] map = m_storageManager.DataStore.LoadTerrain(RegionInfo.RegionID); 1705 double[,] map = SimulationDataService.LoadTerrain(RegionInfo.RegionID);
1688 if (map == null) 1706 if (map == null)
1689 { 1707 {
1690 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain."); 1708 m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
1691 Heightmap = new TerrainChannel(); 1709 Heightmap = new TerrainChannel();
1692 1710
1693 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1711 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1694 } 1712 }
1695 else 1713 else
1696 { 1714 {
@@ -1707,7 +1725,7 @@ namespace OpenSim.Region.Framework.Scenes
1707 { 1725 {
1708 Heightmap = new TerrainChannel(); 1726 Heightmap = new TerrainChannel();
1709 1727
1710 m_storageManager.DataStore.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID); 1728 SimulationDataService.StoreTerrain(Heightmap.GetDoubles(), RegionInfo.RegionID);
1711 } 1729 }
1712 } 1730 }
1713 catch (Exception e) 1731 catch (Exception e)
@@ -1754,7 +1772,7 @@ namespace OpenSim.Region.Framework.Scenes
1754 public void loadAllLandObjectsFromStorage(UUID regionID) 1772 public void loadAllLandObjectsFromStorage(UUID regionID)
1755 { 1773 {
1756 m_log.Info("[SCENE]: Loading land objects from storage"); 1774 m_log.Info("[SCENE]: Loading land objects from storage");
1757 List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(regionID); 1775 List<LandData> landData = SimulationDataService.LoadLandObjects(regionID);
1758 1776
1759 if (LandChannel != null) 1777 if (LandChannel != null)
1760 { 1778 {
@@ -1785,7 +1803,7 @@ namespace OpenSim.Region.Framework.Scenes
1785 LoadingPrims = true; 1803 LoadingPrims = true;
1786 m_log.Info("[SCENE]: Loading objects from datastore"); 1804 m_log.Info("[SCENE]: Loading objects from datastore");
1787 1805
1788 List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); 1806 List<SceneObjectGroup> PrimsFromDB = SimulationDataService.LoadObjects(regionID);
1789 1807
1790 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore"); 1808 m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count + " objects from the datastore");
1791 1809
@@ -1978,7 +1996,7 @@ namespace OpenSim.Region.Framework.Scenes
1978 sceneObject.ScheduleGroupForFullUpdate(); 1996 sceneObject.ScheduleGroupForFullUpdate();
1979 1997
1980 return sceneObject; 1998 return sceneObject;
1981 } 1999 }
1982 2000
1983 /// <summary> 2001 /// <summary>
1984 /// Add an object into the scene that has come from storage 2002 /// Add an object into the scene that has come from storage
@@ -2074,7 +2092,7 @@ namespace OpenSim.Region.Framework.Scenes
2074 /// <returns></returns> 2092 /// <returns></returns>
2075 public bool AddNewSceneObject( 2093 public bool AddNewSceneObject(
2076 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 2094 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
2077 { 2095 {
2078 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel); 2096 return m_sceneGraph.AddNewSceneObject(sceneObject, attachToBackup, pos, rot, vel);
2079 } 2097 }
2080 2098
@@ -2094,8 +2112,7 @@ namespace OpenSim.Region.Framework.Scenes
2094 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>(); 2112 List<SceneObjectGroup> toReturn = new List<SceneObjectGroup>();
2095 lock (Entities) 2113 lock (Entities)
2096 { 2114 {
2097 ICollection<EntityBase> entities = new List<EntityBase>(Entities); 2115 EntityBase[] entities = Entities.GetEntities();
2098
2099 foreach (EntityBase e in entities) 2116 foreach (EntityBase e in entities)
2100 { 2117 {
2101 if (e is SceneObjectGroup) 2118 if (e is SceneObjectGroup)
@@ -2190,12 +2207,12 @@ namespace OpenSim.Region.Framework.Scenes
2190 // group has recently been delinked from another group but that this change has not been persisted 2207 // group has recently been delinked from another group but that this change has not been persisted
2191 // to the DB. 2208 // to the DB.
2192 ForceSceneObjectBackup(so); 2209 ForceSceneObjectBackup(so);
2193 so.DetachFromBackup(); 2210 so.DetachFromBackup();
2194 m_storageManager.DataStore.RemoveObject(so.UUID, m_regInfo.RegionID); 2211 SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
2195 } 2212 }
2196 2213
2197 // We need to keep track of this state in case this group is still queued for further backup. 2214 // We need to keep track of this state in case this group is still queued for further backup.
2198 so.IsDeleted = true; 2215 so.IsDeleted = true;
2199 2216
2200 return true; 2217 return true;
2201 } 2218 }
@@ -2482,7 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes
2482 ScenePresence sp = GetScenePresence(userID); 2499 ScenePresence sp = GetScenePresence(userID);
2483 if (sp != null && AttachmentsModule != null) 2500 if (sp != null && AttachmentsModule != null)
2484 { 2501 {
2485 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID); 2502 uint attPt = (uint)sp.Appearance.GetAttachpoint(itemID);
2486 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt); 2503 AttachmentsModule.RezSingleAttachmentFromInventory(sp.ControllingClient, itemID, attPt);
2487 } 2504 }
2488 2505
@@ -2531,7 +2548,7 @@ namespace OpenSim.Region.Framework.Scenes
2531 sceneObject.RootPart.AddFlag(PrimFlags.Phantom); 2548 sceneObject.RootPart.AddFlag(PrimFlags.Phantom);
2532 2549
2533 // Don't sent a full update here because this will cause full updates to be sent twice for 2550 // Don't sent a full update here because this will cause full updates to be sent twice for
2534 // attachments on region crossings, resulting in viewer glitches. 2551 // attachments on region crossings, resulting in viewer glitches.
2535 AddRestoredSceneObject(sceneObject, false, false, false); 2552 AddRestoredSceneObject(sceneObject, false, false, false);
2536 2553
2537 // Handle attachment special case 2554 // Handle attachment special case
@@ -2788,7 +2805,7 @@ namespace OpenSim.Region.Framework.Scenes
2788 } 2805 }
2789 2806
2790 public virtual void SubscribeToClientPrimEvents(IClientAPI client) 2807 public virtual void SubscribeToClientPrimEvents(IClientAPI client)
2791 { 2808 {
2792 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition; 2809 client.OnUpdatePrimGroupPosition += m_sceneGraph.UpdatePrimPosition;
2793 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition; 2810 client.OnUpdatePrimSinglePosition += m_sceneGraph.UpdatePrimSinglePosition;
2794 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation; 2811 client.OnUpdatePrimGroupRotation += m_sceneGraph.UpdatePrimRotation;
@@ -2824,7 +2841,7 @@ namespace OpenSim.Region.Framework.Scenes
2824 client.OnUndo += m_sceneGraph.HandleUndo; 2841 client.OnUndo += m_sceneGraph.HandleUndo;
2825 client.OnRedo += m_sceneGraph.HandleRedo; 2842 client.OnRedo += m_sceneGraph.HandleRedo;
2826 client.OnObjectDescription += m_sceneGraph.PrimDescription; 2843 client.OnObjectDescription += m_sceneGraph.PrimDescription;
2827 client.OnObjectDrop += m_sceneGraph.DropObject; 2844 client.OnObjectDrop += m_sceneGraph.DropObject;
2828 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable; 2845 client.OnObjectIncludeInSearch += m_sceneGraph.MakeObjectSearchable;
2829 client.OnObjectOwner += ObjectOwner; 2846 client.OnObjectOwner += ObjectOwner;
2830 } 2847 }
@@ -3804,7 +3821,7 @@ namespace OpenSim.Region.Framework.Scenes
3804 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) 3821 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
3805 { 3822 {
3806 ScenePresence presence = GetScenePresence(agentID); 3823 ScenePresence presence = GetScenePresence(agentID);
3807 if(presence != null) 3824 if (presence != null)
3808 { 3825 {
3809 try 3826 try
3810 { 3827 {
@@ -4083,6 +4100,11 @@ namespace OpenSim.Region.Framework.Scenes
4083 4100
4084 #region Other Methods 4101 #region Other Methods
4085 4102
4103 protected override IConfigSource GetConfig()
4104 {
4105 return m_config;
4106 }
4107
4086 #endregion 4108 #endregion
4087 4109
4088 public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) 4110 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
4107 /// </summary> 4129 /// </summary>
4108 public void ForceClientUpdate() 4130 public void ForceClientUpdate()
4109 { 4131 {
4110 List<EntityBase> EntityList = GetEntities(); 4132 EntityBase[] entityList = GetEntities();
4111 4133 foreach (EntityBase ent in entityList)
4112 foreach (EntityBase ent in EntityList)
4113 { 4134 {
4114 if (ent is SceneObjectGroup) 4135 if (ent is SceneObjectGroup)
4115 { 4136 {
@@ -4127,9 +4148,8 @@ namespace OpenSim.Region.Framework.Scenes
4127 { 4148 {
4128 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'"); 4149 m_log.Debug("Searching for Primitive: '" + cmdparams[2] + "'");
4129 4150
4130 List<EntityBase> EntityList = GetEntities(); 4151 EntityBase[] entityList = GetEntities();
4131 4152 foreach (EntityBase ent in entityList)
4132 foreach (EntityBase ent in EntityList)
4133 { 4153 {
4134 if (ent is SceneObjectGroup) 4154 if (ent is SceneObjectGroup)
4135 { 4155 {
@@ -4498,7 +4518,7 @@ namespace OpenSim.Region.Framework.Scenes
4498 /// will not affect the original list of objects in the scene. 4518 /// will not affect the original list of objects in the scene.
4499 /// </summary> 4519 /// </summary>
4500 /// <returns></returns> 4520 /// <returns></returns>
4501 public List<EntityBase> GetEntities() 4521 public EntityBase[] GetEntities()
4502 { 4522 {
4503 return m_sceneGraph.GetEntities(); 4523 return m_sceneGraph.GetEntities();
4504 } 4524 }
@@ -4532,9 +4552,8 @@ namespace OpenSim.Region.Framework.Scenes
4532 4552
4533 public void CleanTempObjects() 4553 public void CleanTempObjects()
4534 { 4554 {
4535 List<EntityBase> objs = GetEntities(); 4555 EntityBase[] entities = GetEntities();
4536 4556 foreach (EntityBase obj in entities)
4537 foreach (EntityBase obj in objs)
4538 { 4557 {
4539 if (obj is SceneObjectGroup) 4558 if (obj is SceneObjectGroup)
4540 { 4559 {
@@ -4554,7 +4573,7 @@ namespace OpenSim.Region.Framework.Scenes
4554 4573
4555 public void DeleteFromStorage(UUID uuid) 4574 public void DeleteFromStorage(UUID uuid)
4556 { 4575 {
4557 m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); 4576 SimulationDataService.RemoveObject(uuid, m_regInfo.RegionID);
4558 } 4577 }
4559 4578
4560 public int GetHealth() 4579 public int GetHealth()
@@ -4963,17 +4982,21 @@ namespace OpenSim.Region.Framework.Scenes
4963 4982
4964 public List<UUID> GetEstateRegions(int estateID) 4983 public List<UUID> GetEstateRegions(int estateID)
4965 { 4984 {
4966 if (m_storageManager.EstateDataStore == null) 4985 IEstateDataService estateDataService = EstateDataService;
4967 return new List<UUID>(); 4986 if (estateDataService == null)
4987 return new List<UUID>(0);
4968 4988
4969 return m_storageManager.EstateDataStore.GetRegions(estateID); 4989 return estateDataService.GetRegions(estateID);
4970 } 4990 }
4971 4991
4972 public void ReloadEstateData() 4992 public void ReloadEstateData()
4973 { 4993 {
4974 m_regInfo.EstateSettings = m_storageManager.EstateDataStore.LoadEstateSettings(m_regInfo.RegionID, false); 4994 IEstateDataService estateDataService = EstateDataService;
4975 4995 if (estateDataService != null)
4976 TriggerEstateSunUpdate(); 4996 {
4997 m_regInfo.EstateSettings = estateDataService.LoadEstateSettings(m_regInfo.RegionID, false);
4998 TriggerEstateSunUpdate();
4999 }
4977 } 5000 }
4978 5001
4979 public void TriggerEstateSunUpdate() 5002 public void TriggerEstateSunUpdate()
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index f8591ba..c71aefa 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Framework.Scenes
521 /// <param name="shorthelp"></param> 521 /// <param name="shorthelp"></param>
522 /// <param name="longhelp"></param> 522 /// <param name="longhelp"></param>
523 /// <param name="descriptivehelp"></param> 523 /// <param name="descriptivehelp"></param>
524 /// <param name="callback"></param> 524 /// <param name="callback"></param>
525 public void AddCommand( 525 public void AddCommand(
526 object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback) 526 object mod, string command, string shorthelp, string longhelp, string descriptivehelp, CommandDelegate callback)
527 { 527 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a39f27a..6246400 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -81,10 +81,7 @@ namespace OpenSim.Region.Framework.Scenes
81 protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>(); 81 protected Dictionary<UUID, ScenePresence> m_scenePresenceMap = new Dictionary<UUID, ScenePresence>();
82 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); 82 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
83 83
84 // SceneObjects is not currently populated or used.
85 //public Dictionary<UUID, SceneObjectGroup> SceneObjects;
86 protected internal EntityManager Entities = new EntityManager(); 84 protected internal EntityManager Entities = new EntityManager();
87// protected internal Dictionary<UUID, EntityBase> Entities = new Dictionary<UUID, EntityBase>();
88 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>(); 85 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
89 86
90 protected RegionInfo m_regInfo; 87 protected RegionInfo m_regInfo;
@@ -323,7 +320,7 @@ namespace OpenSim.Region.Framework.Scenes
323 /// <param name="pos">Position of the object</param> 320 /// <param name="pos">Position of the object</param>
324 /// <param name="rot">Rotation of the object</param> 321 /// <param name="rot">Rotation of the object</param>
325 /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param> 322 /// <param name="vel">Velocity of the object. This parameter only has an effect if the object is physical</param>
326 /// <returns></returns> 323 /// <returns></returns>
327 public bool AddNewSceneObject( 324 public bool AddNewSceneObject(
328 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel) 325 SceneObjectGroup sceneObject, bool attachToBackup, Vector3 pos, Quaternion rot, Vector3 vel)
329 { 326 {
@@ -347,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes
347 } 344 }
348 345
349 return true; 346 return true;
350 } 347 }
351 348
352 /// <summary> 349 /// <summary>
353 /// Add an object to the scene. This will both update the scene, and send information about the 350 /// Add an object to the scene. This will both update the scene, and send information about the
@@ -370,68 +367,57 @@ namespace OpenSim.Region.Framework.Scenes
370 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) 367 if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero)
371 return false; 368 return false;
372 369
373 lock (sceneObject) 370 if (Entities.ContainsKey(sceneObject.UUID))
374 { 371 return false;
375 if (Entities.ContainsKey(sceneObject.UUID)) 372
376 { 373 List<SceneObjectPart> children;
377// m_log.WarnFormat( 374 lock (sceneObject.Children)
378// "[SCENE GRAPH]: Scene object {0} {1} was already in region {2} on add request", 375 children = new List<SceneObjectPart>(sceneObject.Children.Values);
379// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); 376
380 return false; 377 // Clamp child prim sizes and add child prims to the m_numPrim count
381 } 378 if (m_parentScene.m_clampPrimSize)
382 379 {
383// m_log.DebugFormat( 380 foreach (SceneObjectPart part in children)
384// "[SCENE GRAPH]: Adding object {0} {1} to region {2}",
385// sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName);
386
387 lock (sceneObject.Children)
388 { 381 {
389 if (m_parentScene.m_clampPrimSize) 382 Vector3 scale = part.Shape.Scale;
390 { 383
391 foreach (SceneObjectPart part in sceneObject.Children.Values) 384 if (scale.X > m_parentScene.m_maxNonphys)
392 { 385 scale.X = m_parentScene.m_maxNonphys;
393 Vector3 scale = part.Shape.Scale; 386 if (scale.Y > m_parentScene.m_maxNonphys)
394 387 scale.Y = m_parentScene.m_maxNonphys;
395 if (scale.X > m_parentScene.m_maxNonphys) 388 if (scale.Z > m_parentScene.m_maxNonphys)
396 scale.X = m_parentScene.m_maxNonphys; 389 scale.Z = m_parentScene.m_maxNonphys;
397 if (scale.Y > m_parentScene.m_maxNonphys) 390
398 scale.Y = m_parentScene.m_maxNonphys; 391 part.Shape.Scale = scale;
399 if (scale.Z > m_parentScene.m_maxNonphys)
400 scale.Z = m_parentScene.m_maxNonphys;
401
402 part.Shape.Scale = scale;
403 }
404 }
405
406 m_numPrim += sceneObject.Children.Count;
407 } 392 }
408 393 }
409 sceneObject.AttachToScene(m_parentScene); 394 m_numPrim += children.Count;
410 395
411 if (sendClientUpdates) 396 sceneObject.AttachToScene(m_parentScene);
412 sceneObject.ScheduleGroupForFullUpdate();
413
414 Entities.Add(sceneObject);
415 397
416 if (attachToBackup) 398 if (sendClientUpdates)
417 sceneObject.AttachToBackup(); 399 sceneObject.ScheduleGroupForFullUpdate();
418 400
419 if (OnObjectCreate != null) 401 Entities.Add(sceneObject);
420 OnObjectCreate(sceneObject); 402
421 403 if (attachToBackup)
422 lock (SceneObjectGroupsByFullID) 404 sceneObject.AttachToBackup();
423 { 405
424 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; 406 if (OnObjectCreate != null)
425 foreach (SceneObjectPart part in sceneObject.Children.Values) 407 OnObjectCreate(sceneObject);
426 SceneObjectGroupsByFullID[part.UUID] = sceneObject; 408
427 } 409 lock (SceneObjectGroupsByFullID)
428 410 {
429 lock (SceneObjectGroupsByLocalID) 411 SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject;
430 { 412 foreach (SceneObjectPart part in children)
431 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; 413 SceneObjectGroupsByFullID[part.UUID] = sceneObject;
432 foreach (SceneObjectPart part in sceneObject.Children.Values) 414 }
433 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; 415
434 } 416 lock (SceneObjectGroupsByLocalID)
417 {
418 SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject;
419 foreach (SceneObjectPart part in children)
420 SceneObjectGroupsByLocalID[part.LocalId] = sceneObject;
435 } 421 }
436 422
437 return true; 423 return true;
@@ -443,42 +429,38 @@ namespace OpenSim.Region.Framework.Scenes
443 /// <returns>true if the object was deleted, false if there was no object to delete</returns> 429 /// <returns>true if the object was deleted, false if there was no object to delete</returns>
444 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked) 430 public bool DeleteSceneObject(UUID uuid, bool resultOfObjectLinked)
445 { 431 {
446 if (Entities.ContainsKey(uuid)) 432 EntityBase entity;
447 { 433 if (!Entities.TryGetValue(uuid, out entity) && entity is SceneObjectGroup)
448 SceneObjectGroup grp = (SceneObjectGroup)Entities[uuid]; 434 return false;
449 435
450 if (!resultOfObjectLinked) 436 SceneObjectGroup grp = (SceneObjectGroup)entity;
451 {
452 m_numPrim -= grp.PrimCount;
453 437
454 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 438 if (!resultOfObjectLinked)
455 RemovePhysicalPrim(grp.PrimCount); 439 {
456 } 440 m_numPrim -= grp.PrimCount;
457 441
458 if (OnObjectRemove != null) 442 if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
459 OnObjectRemove(Entities[uuid]); 443 RemovePhysicalPrim(grp.PrimCount);
444 }
460 445
461 lock (SceneObjectGroupsByFullID) 446 if (OnObjectRemove != null)
462 { 447 OnObjectRemove(Entities[uuid]);
463 foreach (SceneObjectPart part in grp.Children.Values)
464 SceneObjectGroupsByFullID.Remove(part.UUID);
465 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
466 }
467 lock (SceneObjectGroupsByLocalID)
468 {
469 foreach (SceneObjectPart part in grp.Children.Values)
470 SceneObjectGroupsByLocalID.Remove(part.LocalId);
471 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
472 }
473 448
474 Entities.Remove(uuid); 449 lock (SceneObjectGroupsByFullID)
475 //SceneObjectGroup part; 450 {
476 //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) 451 foreach (SceneObjectPart part in grp.Children.Values)
452 SceneObjectGroupsByFullID.Remove(part.UUID);
453 SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
454 }
477 455
478 return true; 456 lock (SceneObjectGroupsByLocalID)
457 {
458 foreach (SceneObjectPart part in grp.Children.Values)
459 SceneObjectGroupsByLocalID.Remove(part.LocalId);
460 SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
479 } 461 }
480 462
481 return false; 463 return Entities.Remove(uuid);
482 } 464 }
483 465
484 /// <summary> 466 /// <summary>
@@ -490,9 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
490 protected internal void AddToUpdateList(SceneObjectGroup obj) 472 protected internal void AddToUpdateList(SceneObjectGroup obj)
491 { 473 {
492 lock (m_updateList) 474 lock (m_updateList)
493 {
494 m_updateList[obj.UUID] = obj; 475 m_updateList[obj.UUID] = obj;
495 }
496 } 476 }
497 477
498 public void FireAttachToBackup(SceneObjectGroup obj) 478 public void FireAttachToBackup(SceneObjectGroup obj)
@@ -526,34 +506,39 @@ namespace OpenSim.Region.Framework.Scenes
526 { 506 {
527 if (!Monitor.TryEnter(m_updateLock)) 507 if (!Monitor.TryEnter(m_updateLock))
528 return; 508 return;
529 509 try
530 List<SceneObjectGroup> updates;
531
532 // Some updates add more updates to the updateList.
533 // Get the current list of updates and clear the list before iterating
534 lock (m_updateList)
535 {
536 updates = new List<SceneObjectGroup>(m_updateList.Values);
537 m_updateList.Clear();
538 }
539
540 // Go through all updates
541 for (int i = 0; i < updates.Count; i++)
542 { 510 {
543 SceneObjectGroup sog = updates[i]; 511 List<SceneObjectGroup> updates;
544 512
545 // Don't abort the whole update if one entity happens to give us an exception. 513 // Some updates add more updates to the updateList.
546 try 514 // Get the current list of updates and clear the list before iterating
515 lock (m_updateList)
547 { 516 {
548 sog.Update(); 517 updates = new List<SceneObjectGroup>(m_updateList.Values);
518 m_updateList.Clear();
549 } 519 }
550 catch (Exception e) 520
521 // Go through all updates
522 for (int i = 0; i < updates.Count; i++)
551 { 523 {
552 m_log.ErrorFormat( 524 SceneObjectGroup sog = updates[i];
553 "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e); 525
526 // Don't abort the whole update if one entity happens to give us an exception.
527 try
528 {
529 sog.Update();
530 }
531 catch (Exception e)
532 {
533 m_log.ErrorFormat(
534 "[INNER SCENE]: Failed to update {0}, {1} - {2}", sog.Name, sog.UUID, e);
535 }
554 } 536 }
555 } 537 }
556 Monitor.Exit(m_updateLock); 538 finally
539 {
540 Monitor.Exit(m_updateLock);
541 }
557 } 542 }
558 543
559 protected internal void AddPhysicalPrim(int number) 544 protected internal void AddPhysicalPrim(int number)
@@ -920,38 +905,38 @@ namespace OpenSim.Region.Framework.Scenes
920 /// <returns>null if no scene object group containing that prim is found</returns> 905 /// <returns>null if no scene object group containing that prim is found</returns>
921 public SceneObjectGroup GetGroupByPrim(uint localID) 906 public SceneObjectGroup GetGroupByPrim(uint localID)
922 { 907 {
923 if (Entities.ContainsKey(localID)) 908 EntityBase entity;
924 return Entities[localID] as SceneObjectGroup; 909 if (Entities.TryGetValue(localID, out entity))
910 return entity as SceneObjectGroup;
925 911
926 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID); 912 //m_log.DebugFormat("Entered GetGroupByPrim with localID {0}", localID);
927 SceneObjectGroup sog; 913 SceneObjectGroup sog;
928 lock (SceneObjectGroupsByLocalID) 914 lock (SceneObjectGroupsByLocalID)
915 SceneObjectGroupsByLocalID.TryGetValue(localID, out sog);
916
917 if (sog != null)
929 { 918 {
930 if (SceneObjectGroupsByLocalID.TryGetValue(localID, out sog)) 919 if (sog.HasChildPrim(localID))
931 { 920 return sog;
932 if (sog.HasChildPrim(localID)) 921 SceneObjectGroupsByLocalID.Remove(localID);
933 return sog;
934 SceneObjectGroupsByLocalID.Remove(localID);
935 }
936 } 922 }
937 923
938 List<EntityBase> EntityList = GetEntities(); 924 EntityBase[] entityList = GetEntities();
939 foreach (EntityBase ent in EntityList) 925 foreach (EntityBase ent in entityList)
940 { 926 {
941 //m_log.DebugFormat("Looking at entity {0}", ent.UUID); 927 //m_log.DebugFormat("Looking at entity {0}", ent.UUID);
942 if (ent is SceneObjectGroup) 928 if (ent is SceneObjectGroup)
943 { 929 {
944 if (((SceneObjectGroup)ent).HasChildPrim(localID)) 930 sog = (SceneObjectGroup)ent;
931 if (sog.HasChildPrim(localID))
945 { 932 {
946 sog = (SceneObjectGroup)ent;
947 lock (SceneObjectGroupsByLocalID) 933 lock (SceneObjectGroupsByLocalID)
948 {
949 SceneObjectGroupsByLocalID[localID] = sog; 934 SceneObjectGroupsByLocalID[localID] = sog;
950 }
951 return sog; 935 return sog;
952 } 936 }
953 } 937 }
954 } 938 }
939
955 return null; 940 return null;
956 } 941 }
957 942
@@ -964,36 +949,35 @@ namespace OpenSim.Region.Framework.Scenes
964 { 949 {
965 SceneObjectGroup sog; 950 SceneObjectGroup sog;
966 lock (SceneObjectGroupsByFullID) 951 lock (SceneObjectGroupsByFullID)
952 SceneObjectGroupsByFullID.TryGetValue(fullID, out sog);
953
954 if (sog != null)
967 { 955 {
968 if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) 956 lock (sog.Children)
969 { 957 {
970 lock (sog.Children) 958 if (sog.Children.ContainsKey(fullID))
971 { 959 return sog;
972 if (sog.Children.ContainsKey(fullID))
973 return sog;
974 }
975
976 SceneObjectGroupsByFullID.Remove(fullID);
977 } 960 }
978 }
979 961
980 List<EntityBase> EntityList = GetEntities(); 962 lock (SceneObjectGroupsByFullID)
963 SceneObjectGroupsByFullID.Remove(fullID);
964 }
981 965
982 foreach (EntityBase ent in EntityList) 966 EntityBase[] entityList = GetEntities();
967 foreach (EntityBase ent in entityList)
983 { 968 {
984 if (ent is SceneObjectGroup) 969 if (ent is SceneObjectGroup)
985 { 970 {
986 if (((SceneObjectGroup)ent).HasChildPrim(fullID)) 971 sog = (SceneObjectGroup)ent;
972 if (sog.HasChildPrim(fullID))
987 { 973 {
988 sog = (SceneObjectGroup)ent;
989 lock (SceneObjectGroupsByFullID) 974 lock (SceneObjectGroupsByFullID)
990 {
991 SceneObjectGroupsByFullID[fullID] = sog; 975 SceneObjectGroupsByFullID[fullID] = sog;
992 }
993 return sog; 976 return sog;
994 } 977 }
995 } 978 }
996 } 979 }
980
997 return null; 981 return null;
998 } 982 }
999 983
@@ -1002,7 +986,7 @@ namespace OpenSim.Region.Framework.Scenes
1002 // Primitive Ray Tracing 986 // Primitive Ray Tracing
1003 float closestDistance = 280f; 987 float closestDistance = 280f;
1004 EntityIntersection result = new EntityIntersection(); 988 EntityIntersection result = new EntityIntersection();
1005 List<EntityBase> EntityList = GetEntities(); 989 EntityBase[] EntityList = GetEntities();
1006 foreach (EntityBase ent in EntityList) 990 foreach (EntityBase ent in EntityList)
1007 { 991 {
1008 if (ent is SceneObjectGroup) 992 if (ent is SceneObjectGroup)
@@ -1040,23 +1024,28 @@ namespace OpenSim.Region.Framework.Scenes
1040 /// <returns>null if the part was not found</returns> 1024 /// <returns>null if the part was not found</returns>
1041 protected internal SceneObjectPart GetSceneObjectPart(string name) 1025 protected internal SceneObjectPart GetSceneObjectPart(string name)
1042 { 1026 {
1043 List<EntityBase> EntityList = GetEntities(); 1027 SceneObjectPart sop = null;
1044 1028
1045 // FIXME: use a dictionary here 1029 Entities.Find(
1046 foreach (EntityBase ent in EntityList) 1030 delegate(EntityBase entity)
1047 {
1048 if (ent is SceneObjectGroup)
1049 { 1031 {
1050 foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) 1032 if (entity is SceneObjectGroup)
1051 { 1033 {
1052 if (p.Name == name) 1034 foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
1053 { 1035 {
1054 return p; 1036 if (p.Name == name)
1037 {
1038 sop = p;
1039 return true;
1040 }
1055 } 1041 }
1056 } 1042 }
1043
1044 return false;
1057 } 1045 }
1058 } 1046 );
1059 return null; 1047
1048 return sop;
1060 } 1049 }
1061 1050
1062 /// <summary> 1051 /// <summary>
@@ -1077,7 +1066,7 @@ namespace OpenSim.Region.Framework.Scenes
1077 /// it 1066 /// it
1078 /// </summary> 1067 /// </summary>
1079 /// <returns></returns> 1068 /// <returns></returns>
1080 protected internal List<EntityBase> GetEntities() 1069 protected internal EntityBase[] GetEntities()
1081 { 1070 {
1082 return Entities.GetEntities(); 1071 return Entities.GetEntities();
1083 } 1072 }
@@ -1086,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
1086 { 1075 {
1087 Dictionary<uint, float> topScripts = new Dictionary<uint, float>(); 1076 Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
1088 1077
1089 List<EntityBase> EntityList = GetEntities(); 1078 EntityBase[] EntityList = GetEntities();
1090 int limit = 0; 1079 int limit = 0;
1091 foreach (EntityBase ent in EntityList) 1080 foreach (EntityBase ent in EntityList)
1092 { 1081 {
@@ -1140,7 +1129,7 @@ namespace OpenSim.Region.Framework.Scenes
1140 /// <param name="action"></param> 1129 /// <param name="action"></param>
1141 protected internal void ForEachSOG(Action<SceneObjectGroup> action) 1130 protected internal void ForEachSOG(Action<SceneObjectGroup> action)
1142 { 1131 {
1143 List<EntityBase> objlist = Entities.GetAllByType<SceneObjectGroup>(); 1132 EntityBase[] objlist = Entities.GetAllByType<SceneObjectGroup>();
1144 foreach (EntityBase ent in objlist) 1133 foreach (EntityBase ent in objlist)
1145 { 1134 {
1146 SceneObjectGroup obj = (SceneObjectGroup)ent; 1135 SceneObjectGroup obj = (SceneObjectGroup)ent;
@@ -1353,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
1353 SceneObjectGroup group = GetGroupByPrim(localID); 1342 SceneObjectGroup group = GetGroupByPrim(localID);
1354 1343
1355 if (group != null) 1344 if (group != null)
1356 { 1345 {
1357 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) 1346 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
1358 { 1347 {
1359 if (m_parentScene.AttachmentsModule != null) 1348 if (m_parentScene.AttachmentsModule != null)
@@ -1798,8 +1787,8 @@ namespace OpenSim.Region.Framework.Scenes
1798 UUID objid = UUID.Zero; 1787 UUID objid = UUID.Zero;
1799 SceneObjectPart obj = null; 1788 SceneObjectPart obj = null;
1800 1789
1801 List<EntityBase> EntityList = GetEntities(); 1790 EntityBase[] entityList = GetEntities();
1802 foreach (EntityBase ent in EntityList) 1791 foreach (EntityBase ent in entityList)
1803 { 1792 {
1804 if (ent is SceneObjectGroup) 1793 if (ent is SceneObjectGroup)
1805 { 1794 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 470fdd7..a952508 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1326,7 +1326,7 @@ namespace OpenSim.Region.Framework.Scenes
1326 AbsolutePosition = detachedpos; 1326 AbsolutePosition = detachedpos;
1327 m_rootPart.AttachedAvatar = UUID.Zero; 1327 m_rootPart.AttachedAvatar = UUID.Zero;
1328 1328
1329 //Anakin Lohner bug #3839 1329 //Anakin Lohner bug #3839
1330 lock (m_parts) 1330 lock (m_parts)
1331 { 1331 {
1332 foreach (SceneObjectPart p in m_parts.Values) 1332 foreach (SceneObjectPart p in m_parts.Values)
@@ -1556,7 +1556,7 @@ namespace OpenSim.Region.Framework.Scenes
1556 } 1556 }
1557 1557
1558 /// <summary> 1558 /// <summary>
1559 /// Delete this group from its scene. 1559 /// Delete this group from its scene.
1560 /// </summary> 1560 /// </summary>
1561 /// 1561 ///
1562 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood 1562 /// This only handles the in-world consequences of deletion (e.g. any avatars sitting on it are forcibly stood
@@ -1731,12 +1731,12 @@ namespace OpenSim.Region.Framework.Scenes
1731 /// Processes backup. 1731 /// Processes backup.
1732 /// </summary> 1732 /// </summary>
1733 /// <param name="datastore"></param> 1733 /// <param name="datastore"></param>
1734 public virtual void ProcessBackup(IRegionDataStore datastore, bool forcedBackup) 1734 public virtual void ProcessBackup(ISimulationDataService datastore, bool forcedBackup)
1735 { 1735 {
1736 if (!m_isBackedUp) 1736 if (!m_isBackedUp)
1737 { 1737 {
1738// m_log.DebugFormat( 1738// m_log.DebugFormat(
1739// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID); 1739// "[WATER WARS]: Ignoring backup of {0} {1} since object is not marked to be backed up", Name, UUID);
1740 return; 1740 return;
1741 } 1741 }
1742 1742
@@ -1748,7 +1748,7 @@ namespace OpenSim.Region.Framework.Scenes
1748 } 1748 }
1749 1749
1750 // Since this is the top of the section of call stack for backing up a particular scene object, don't let 1750 // Since this is the top of the section of call stack for backing up a particular scene object, don't let
1751 // any exception propogate upwards. 1751 // any exception propogate upwards.
1752 try 1752 try
1753 { 1753 {
1754 if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart 1754 if (!m_scene.ShuttingDown || // if shutting down then there will be nothing to handle the return so leave till next restart
@@ -1944,7 +1944,6 @@ namespace OpenSim.Region.Framework.Scenes
1944 part.PhysActor.LocalID = part.LocalId; 1944 part.PhysActor.LocalID = part.LocalId;
1945 part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true); 1945 part.DoPhysicsPropertyUpdate(part.PhysActor.IsPhysical, true);
1946 } 1946 }
1947
1948 } 1947 }
1949 if (userExposed) 1948 if (userExposed)
1950 { 1949 {
@@ -1954,7 +1953,6 @@ namespace OpenSim.Region.Framework.Scenes
1954 1953
1955 ScheduleGroupForFullUpdate(); 1954 ScheduleGroupForFullUpdate();
1956 } 1955 }
1957
1958 } 1956 }
1959 finally 1957 finally
1960 { 1958 {
@@ -2515,16 +2513,9 @@ namespace OpenSim.Region.Framework.Scenes
2515 /// <returns>null if a child part with the primID was not found</returns> 2513 /// <returns>null if a child part with the primID was not found</returns>
2516 public SceneObjectPart GetChildPart(UUID primID) 2514 public SceneObjectPart GetChildPart(UUID primID)
2517 { 2515 {
2518 SceneObjectPart childPart = null; 2516 SceneObjectPart childPart;
2519
2520 lock (m_parts) 2517 lock (m_parts)
2521 { 2518 m_parts.TryGetValue(primID, out childPart);
2522 if (m_parts.ContainsKey(primID))
2523 {
2524 childPart = m_parts[primID];
2525 }
2526 }
2527
2528 return childPart; 2519 return childPart;
2529 } 2520 }
2530 2521
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index eefe8bb..5c4a2a3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -508,7 +508,14 @@ namespace OpenSim.Region.Framework.Scenes
508 public UUID UUID 508 public UUID UUID
509 { 509 {
510 get { return m_uuid; } 510 get { return m_uuid; }
511 set { m_uuid = value; } 511 set
512 {
513 m_uuid = value;
514
515 // This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
516 if (Inventory != null)
517 Inventory.ResetInventoryIDs();
518 }
512 } 519 }
513 520
514 public uint LocalId 521 public uint LocalId
@@ -1027,12 +1034,12 @@ namespace OpenSim.Region.Framework.Scenes
1027 return m_mediaUrl; 1034 return m_mediaUrl;
1028 } 1035 }
1029 1036
1030 set 1037 set
1031 { 1038 {
1032 m_mediaUrl = value; 1039 m_mediaUrl = value;
1033 1040
1034 if (ParentGroup != null) 1041 if (ParentGroup != null)
1035 ParentGroup.HasGroupChanged = true; 1042 ParentGroup.HasGroupChanged = true;
1036 } 1043 }
1037 } 1044 }
1038 1045
@@ -1045,7 +1052,7 @@ namespace OpenSim.Region.Framework.Scenes
1045// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID); 1052// m_log.DebugFormat("[SOP]: Setting CreateSelected to {0} for {1} {2}", value, Name, UUID);
1046 m_createSelected = value; 1053 m_createSelected = value;
1047 } 1054 }
1048 } 1055 }
1049 1056
1050 #endregion 1057 #endregion
1051 1058
@@ -1207,7 +1214,7 @@ namespace OpenSim.Region.Framework.Scenes
1207 1214
1208 /// <summary> 1215 /// <summary>
1209 /// Property flags. See OpenMetaverse.PrimFlags 1216 /// Property flags. See OpenMetaverse.PrimFlags
1210 /// </summary> 1217 /// </summary>
1211 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge 1218 /// Example properties are PrimFlags.Phantom and PrimFlags.DieAtEdge
1212 public PrimFlags Flags 1219 public PrimFlags Flags
1213 { 1220 {
@@ -1372,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
1372 1379
1373 /// <summary> 1380 /// <summary>
1374 /// Tell the scene presence that it should send updates for this part to its client 1381 /// Tell the scene presence that it should send updates for this part to its client
1375 /// </summary> 1382 /// </summary>
1376 public void AddFullUpdateToAvatar(ScenePresence presence) 1383 public void AddFullUpdateToAvatar(ScenePresence presence)
1377 { 1384 {
1378 presence.SceneViewer.QueuePartForUpdate(this); 1385 presence.SceneViewer.QueuePartForUpdate(this);
@@ -1431,7 +1438,7 @@ namespace OpenSim.Region.Framework.Scenes
1431 1438
1432 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 1439 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp)
1433 { 1440 {
1434 if(!sp.IsChildAgent) 1441 if (!sp.IsChildAgent)
1435 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); 1442 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1436 }); 1443 });
1437 } 1444 }
@@ -1683,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes
1683 1690
1684// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID); 1691// m_log.DebugFormat("[SCENE OBJECT PART]: Clone of {0} {1} finished", Name, UUID);
1685 1692
1686 return dupe; 1693 return dupe;
1687 } 1694 }
1688 1695
1689 protected void AssetReceived(string id, Object sender, AssetBase asset) 1696 protected void AssetReceived(string id, Object sender, AssetBase asset)
@@ -1993,10 +2000,10 @@ namespace OpenSim.Region.Framework.Scenes
1993 } 2000 }
1994 2001
1995 public uint GetEffectiveObjectFlags() 2002 public uint GetEffectiveObjectFlags()
1996 { 2003 {
1997 // Commenting this section of code out since it doesn't actually do anything, as enums are handled by 2004 // Commenting this section of code out since it doesn't actually do anything, as enums are handled by
1998 // value rather than reference 2005 // value rather than reference
1999// PrimFlags f = _flags; 2006// PrimFlags f = _flags;
2000// if (m_parentGroup == null || m_parentGroup.RootPart == this) 2007// if (m_parentGroup == null || m_parentGroup.RootPart == this)
2001// f &= ~(PrimFlags.Touch | PrimFlags.Money); 2008// f &= ~(PrimFlags.Touch | PrimFlags.Money);
2002 2009
@@ -2793,7 +2800,6 @@ namespace OpenSim.Region.Framework.Scenes
2793 UUID = UUID.Random(); 2800 UUID = UUID.Random();
2794 LinkNum = linkNum; 2801 LinkNum = linkNum;
2795 LocalId = 0; 2802 LocalId = 0;
2796 Inventory.ResetInventoryIDs();
2797 } 2803 }
2798 2804
2799 /// <summary> 2805 /// <summary>
@@ -4756,7 +4762,7 @@ namespace OpenSim.Region.Framework.Scenes
4756 if (ParentGroup == null || ParentGroup.IsDeleted) 4762 if (ParentGroup == null || ParentGroup.IsDeleted)
4757 return; 4763 return;
4758 4764
4759 if (IsAttachment && ParentGroup.RootPart != this) 4765 if (IsAttachment && ParentGroup.RootPart != this)
4760 return; 4766 return;
4761 4767
4762 // Causes this thread to dig into the Client Thread Data. 4768 // Causes this thread to dig into the Client Thread Data.
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 1959427..2de439b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Framework.Scenes
125 { 125 {
126 m_items.LockItemsForWrite(true); 126 m_items.LockItemsForWrite(true);
127 127
128 if (0 == Items.Count) 128 if (Items.Count == 0)
129 { 129 {
130 m_items.LockItemsForWrite(false); 130 m_items.LockItemsForWrite(false);
131 return; 131 return;
@@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Framework.Scenes
1010 /// Process inventory backup 1010 /// Process inventory backup
1011 /// </summary> 1011 /// </summary>
1012 /// <param name="datastore"></param> 1012 /// <param name="datastore"></param>
1013 public void ProcessInventoryBackup(IRegionDataStore datastore) 1013 public void ProcessInventoryBackup(ISimulationDataService datastore)
1014 { 1014 {
1015 if (HasInventoryChanged) 1015 if (HasInventoryChanged)
1016 { 1016 {
@@ -1257,7 +1257,7 @@ namespace OpenSim.Region.Framework.Scenes
1257 engine.ResumeScript(item.ItemID); 1257 engine.ResumeScript(item.ItemID);
1258 } 1258 }
1259 } 1259 }
1260 } 1260 }
1261 } 1261 }
1262 1262
1263 Items.LockItemsForRead(false); 1263 Items.LockItemsForRead(false);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d88f2cc..6d0ecf0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1427,7 +1427,7 @@ namespace OpenSim.Region.Framework.Scenes
1427 // Setting parent ID would fix this, if we knew what value 1427 // Setting parent ID would fix this, if we knew what value
1428 // to use. Or we could add a m_isSitting variable. 1428 // to use. Or we could add a m_isSitting variable.
1429 //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 1429 //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
1430 SitGround = true; 1430 SitGround = true;
1431 } 1431 }
1432 1432
1433 // In the future, these values might need to go global. 1433 // In the future, these values might need to go global.
diff --git a/OpenSim/Region/Framework/Scenes/SceneViewer.cs b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
index f478a4a..b45291f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneViewer.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneViewer.cs
@@ -73,9 +73,10 @@ namespace OpenSim.Region.Framework.Scenes
73 { 73 {
74 m_pendingObjects = new Queue<SceneObjectGroup>(); 74 m_pendingObjects = new Queue<SceneObjectGroup>();
75 75
76 lock(m_pendingObjects) 76 lock (m_pendingObjects)
77 { 77 {
78 foreach (EntityBase e in m_presence.Scene.Entities) 78 EntityBase[] entities = m_presence.Scene.Entities.GetEntities();
79 foreach (EntityBase e in entities)
79 { 80 {
80 if (e != null && e is SceneObjectGroup) 81 if (e != null && e is SceneObjectGroup)
81 m_pendingObjects.Enqueue((SceneObjectGroup)e); 82 m_pendingObjects.Enqueue((SceneObjectGroup)e);
@@ -84,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes
84 } 85 }
85 } 86 }
86 87
87 lock(m_pendingObjects) 88 lock (m_pendingObjects)
88 { 89 {
89 while (m_pendingObjects != null && m_pendingObjects.Count > 0) 90 while (m_pendingObjects != null && m_pendingObjects.Count > 0)
90 { 91 {
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
index b6677f0..5494549 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs
@@ -84,9 +84,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
84 int primCount = 0; 84 int primCount = 0;
85 stream.WriteLine("<scene>\n"); 85 stream.WriteLine("<scene>\n");
86 86
87 List<EntityBase> EntityList = scene.GetEntities(); 87 EntityBase[] entityList = scene.GetEntities();
88 88 foreach (EntityBase ent in entityList)
89 foreach (EntityBase ent in EntityList)
90 { 89 {
91 if (ent is SceneObjectGroup) 90 if (ent is SceneObjectGroup)
92 { 91 {
@@ -204,16 +203,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
204 203
205 public static void SavePrimsToXml2(Scene scene, string fileName) 204 public static void SavePrimsToXml2(Scene scene, string fileName)
206 { 205 {
207 List<EntityBase> EntityList = scene.GetEntities(); 206 EntityBase[] entityList = scene.GetEntities();
208 207 SavePrimListToXml2(entityList, fileName);
209 SavePrimListToXml2(EntityList, fileName);
210 } 208 }
211 209
212 public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max) 210 public static void SavePrimsToXml2(Scene scene, TextWriter stream, Vector3 min, Vector3 max)
213 { 211 {
214 List<EntityBase> EntityList = scene.GetEntities(); 212 EntityBase[] entityList = scene.GetEntities();
215 213 SavePrimListToXml2(entityList, stream, min, max);
216 SavePrimListToXml2(EntityList, stream, min, max);
217 } 214 }
218 215
219 public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName) 216 public static void SaveNamedPrimsToXml2(Scene scene, string primName, string fileName)
@@ -222,7 +219,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
222 "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}", 219 "[SERIALISER]: Saving prims with name {0} in xml2 format for region {1} to {2}",
223 primName, scene.RegionInfo.RegionName, fileName); 220 primName, scene.RegionInfo.RegionName, fileName);
224 221
225 List<EntityBase> entityList = scene.GetEntities(); 222 EntityBase[] entityList = scene.GetEntities();
226 List<EntityBase> primList = new List<EntityBase>(); 223 List<EntityBase> primList = new List<EntityBase>();
227 224
228 foreach (EntityBase ent in entityList) 225 foreach (EntityBase ent in entityList)
@@ -236,10 +233,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
236 } 233 }
237 } 234 }
238 235
239 SavePrimListToXml2(primList, fileName); 236 SavePrimListToXml2(primList.ToArray(), fileName);
240 } 237 }
241 238
242 public static void SavePrimListToXml2(List<EntityBase> entityList, string fileName) 239 public static void SavePrimListToXml2(EntityBase[] entityList, string fileName)
243 { 240 {
244 FileStream file = new FileStream(fileName, FileMode.Create); 241 FileStream file = new FileStream(fileName, FileMode.Create);
245 try 242 try
@@ -260,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
260 } 257 }
261 } 258 }
262 259
263 public static void SavePrimListToXml2(List<EntityBase> entityList, TextWriter stream, Vector3 min, Vector3 max) 260 public static void SavePrimListToXml2(EntityBase[] entityList, TextWriter stream, Vector3 min, Vector3 max)
264 { 261 {
265 int primCount = 0; 262 int primCount = 0;
266 stream.WriteLine("<scene>\n"); 263 stream.WriteLine("<scene>\n");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index c9662ef..7d9a6a9 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
71 Assert.That(dupeSo.Children.Count, Is.EqualTo(2)); 71 Assert.That(dupeSo.Children.Count, Is.EqualTo(2));
72 72
73 SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1); 73 SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
74 SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2); 74 SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);
75 Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId)); 75 Assert.That(dupePart1.LocalId, Is.Not.EqualTo(part1.LocalId));
76 Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId)); 76 Assert.That(dupePart2.LocalId, Is.Not.EqualTo(part2.LocalId));
77 77
@@ -84,6 +84,6 @@ namespace OpenSim.Region.Framework.Scenes.Tests
84 Assert.That(dupePart1.PhysActor, Is.Not.Null); 84 Assert.That(dupePart1.PhysActor, Is.Not.Null);
85 Assert.That(dupePart2.PhysActor, Is.Not.Null); 85 Assert.That(dupePart2.PhysActor, Is.Not.Null);
86 */ 86 */
87 } 87 }
88 } 88 }
89} \ No newline at end of file 89} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index e3ef263..60824be 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
270 TestHelper.InMethod(); 270 TestHelper.InMethod();
271 //log4net.Config.XmlConfigurator.Configure(); 271 //log4net.Config.XmlConfigurator.Configure();
272 272
273 TestScene scene = SceneSetupHelpers.SetupScene(); 273 TestScene scene = SceneSetupHelpers.SetupScene();
274 274
275 string rootPartName = "rootpart"; 275 string rootPartName = "rootpart";
276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 276 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -282,17 +282,17 @@ namespace OpenSim.Region.Framework.Scenes.Tests
282 { Name = rootPartName, UUID = rootPartUuid }; 282 { Name = rootPartName, UUID = rootPartUuid };
283 SceneObjectPart linkPart 283 SceneObjectPart linkPart
284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 284 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
285 { Name = linkPartName, UUID = linkPartUuid }; 285 { Name = linkPartName, UUID = linkPartUuid };
286 286
287 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 287 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
288 sog.AddPart(linkPart); 288 sog.AddPart(linkPart);
289 scene.AddNewSceneObject(sog, true); 289 scene.AddNewSceneObject(sog, true);
290 290
291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 291 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
292 // scene backup thread. 292 // scene backup thread.
293 scene.Backup(true); 293 scene.Backup(true);
294 294
295 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); 295 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
296 296
297 Assert.That(storedObjects.Count, Is.EqualTo(1)); 297 Assert.That(storedObjects.Count, Is.EqualTo(1));
298 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2)); 298 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
@@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
309 TestHelper.InMethod(); 309 TestHelper.InMethod();
310 //log4net.Config.XmlConfigurator.Configure(); 310 //log4net.Config.XmlConfigurator.Configure();
311 311
312 TestScene scene = SceneSetupHelpers.SetupScene(); 312 TestScene scene = SceneSetupHelpers.SetupScene();
313 313
314 string rootPartName = "rootpart"; 314 string rootPartName = "rootpart";
315 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001"); 315 UUID rootPartUuid = new UUID("00000000-0000-0000-0000-000000000001");
@@ -321,11 +321,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
321 { Name = rootPartName, UUID = rootPartUuid }; 321 { Name = rootPartName, UUID = rootPartUuid };
322 SceneObjectPart linkPart 322 SceneObjectPart linkPart
323 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 323 = new SceneObjectPart(UUID.Zero, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
324 { Name = linkPartName, UUID = linkPartUuid }; 324 { Name = linkPartName, UUID = linkPartUuid };
325 325
326 SceneObjectGroup sog = new SceneObjectGroup(rootPart); 326 SceneObjectGroup sog = new SceneObjectGroup(rootPart);
327 sog.AddPart(linkPart); 327 sog.AddPart(linkPart);
328 scene.AddNewSceneObject(sog, true); 328 scene.AddNewSceneObject(sog, true);
329 329
330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked 330 // In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
331 // scene backup thread. 331 // scene backup thread.
@@ -333,9 +333,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
333 333
334 // These changes should occur immediately without waiting for a backup pass 334 // These changes should occur immediately without waiting for a backup pass
335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false); 335 SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
336 scene.DeleteSceneObject(groupToDelete, false); 336 scene.DeleteSceneObject(groupToDelete, false);
337 337
338 List<SceneObjectGroup> storedObjects = scene.StorageManager.DataStore.LoadObjects(scene.RegionInfo.RegionID); 338 List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
339 339
340 Assert.That(storedObjects.Count, Is.EqualTo(1)); 340 Assert.That(storedObjects.Count, Is.EqualTo(1));
341 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1)); 341 Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
diff --git a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
index da8199d..fe59d4f 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/TaskInventoryTests.cs
@@ -59,8 +59,8 @@ namespace OpenSim.Region.Framework.Tests
59 string userFirstName = "Jock"; 59 string userFirstName = "Jock";
60 string userLastName = "Stirrup"; 60 string userLastName = "Stirrup";
61 string userPassword = "troll"; 61 string userPassword = "troll";
62 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020"); 62 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
63 return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword); 63 return UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
64 } 64 }
65 65
66 protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId) 66 protected SceneObjectGroup CreateSO1(Scene scene, UUID ownerId)
@@ -70,14 +70,16 @@ namespace OpenSim.Region.Framework.Tests
70 SceneObjectPart part1 70 SceneObjectPart part1
71 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero) 71 = new SceneObjectPart(ownerId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero)
72 { Name = part1Name, UUID = part1Id }; 72 { Name = part1Name, UUID = part1Id };
73 return new SceneObjectGroup(part1); 73 return new SceneObjectGroup(part1);
74 } 74 }
75 75
76 protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part) 76 protected TaskInventoryItem CreateSOItem1(Scene scene, SceneObjectPart part)
77 { 77 {
78 AssetNotecard nc = new AssetNotecard("Hello World!"); 78 AssetNotecard nc = new AssetNotecard();
79 nc.BodyText = "Hello World!";
80 nc.Encode();
79 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000"); 81 UUID ncAssetUuid = new UUID("00000000-0000-0000-1000-000000000000");
80 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000"); 82 UUID ncItemUuid = new UUID("00000000-0000-0000-1100-000000000000");
81 AssetBase ncAsset 83 AssetBase ncAsset
82 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero); 84 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
83 scene.AssetService.Store(ncAsset); 85 scene.AssetService.Store(ncAsset);
@@ -112,9 +114,9 @@ namespace OpenSim.Region.Framework.Tests
112 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID); 114 scene.MoveTaskInventoryItem(user1.PrincipalID, folder.ID, sop1, sopItem1.ItemID);
113 115
114 InventoryItemBase ncUserItem 116 InventoryItemBase ncUserItem
115 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem"); 117 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Objects/ncItem");
116 Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found"); 118 Assert.That(ncUserItem, Is.Not.Null, "Objects/ncItem was not found");
117 } 119 }
118 120
119 /// <summary> 121 /// <summary>
120 /// Test MoveTaskInventoryItem where the item has no parent folder assigned. 122 /// Test MoveTaskInventoryItem where the item has no parent folder assigned.
@@ -136,7 +138,7 @@ namespace OpenSim.Region.Framework.Tests
136 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID); 138 scene.MoveTaskInventoryItem(user1.PrincipalID, UUID.Zero, sop1, sopItem1.ItemID);
137 139
138 InventoryItemBase ncUserItem 140 InventoryItemBase ncUserItem
139 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem"); 141 = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, user1.PrincipalID, "Notecards/ncItem");
140 Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found"); 142 Assert.That(ncUserItem, Is.Not.Null, "Notecards/ncItem was not found");
141 } 143 }
142 } 144 }
diff --git a/OpenSim/Region/Framework/StorageManager.cs b/OpenSim/Region/Framework/StorageManager.cs
deleted file mode 100644
index 9375b4a..0000000
--- a/OpenSim/Region/Framework/StorageManager.cs
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Reflection;
30using log4net;
31using OpenSim.Region.Framework.Interfaces;
32
33namespace OpenSim.Region.Framework
34{
35 public class StorageManager
36 {
37 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38
39 protected IRegionDataStore m_dataStore;
40
41 public IRegionDataStore DataStore
42 {
43 get { return m_dataStore; }
44 }
45
46 private IEstateDataStore m_estateDataStore;
47
48 public IEstateDataStore EstateDataStore
49 {
50 get { return m_estateDataStore; }
51 }
52
53 public StorageManager(IRegionDataStore storage)
54 {
55 m_dataStore = storage;
56 }
57
58 public StorageManager(string dllName, string connectionstring, string estateconnectionstring)
59 {
60 m_log.Info("[DATASTORE]: Attempting to load " + dllName);
61 Assembly pluginAssembly = Assembly.LoadFrom(dllName);
62
63 foreach (Type pluginType in pluginAssembly.GetTypes())
64 {
65 if (pluginType.IsPublic)
66 {
67 Type typeInterface = pluginType.GetInterface("IRegionDataStore", true);
68
69 if (typeInterface != null)
70 {
71 IRegionDataStore plug =
72 (IRegionDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
73 plug.Initialise(connectionstring);
74
75 m_dataStore = plug;
76
77 m_log.Info("[DATASTORE]: Added IRegionDataStore Interface");
78 }
79
80 typeInterface = pluginType.GetInterface("IEstateDataStore", true);
81
82 if (typeInterface != null)
83 {
84 IEstateDataStore estPlug =
85 (IEstateDataStore) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
86 estPlug.Initialise(estateconnectionstring);
87
88 m_estateDataStore = estPlug;
89 }
90 }
91 }
92
93 //TODO: Add checking and warning to make sure it initialised.
94 }
95 }
96}
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index b98aabe..4ab67aa 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -375,8 +375,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
375 375
376 private void IRC_SendNamesReply() 376 private void IRC_SendNamesReply()
377 { 377 {
378 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 378 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
379
380 foreach (EntityBase user in users) 379 foreach (EntityBase user in users)
381 { 380 {
382 SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", "")); 381 SendServerCommand("353 " + m_nick + " = " + IrcRegionName + " :" + user.Name.Replace(" ", ""));
@@ -386,8 +385,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
386 385
387 private void IRC_SendWhoReply() 386 private void IRC_SendWhoReply()
388 { 387 {
389 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 388 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
390
391 foreach (EntityBase user in users) 389 foreach (EntityBase user in users)
392 { 390 {
393 /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName, 391 /*SendServerCommand(String.Format("352 {0} {1} {2} {3} {4} {5} :0 {6}", IrcRegionName,
@@ -415,11 +413,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
415 413
416 private void IRC_SendReplyUsers() 414 private void IRC_SendReplyUsers()
417 { 415 {
418 List<EntityBase> users = m_scene.Entities.GetAllByType<ScenePresence>(); 416 EntityBase[] users = m_scene.Entities.GetAllByType<ScenePresence>();
419 417
420 SendServerCommand("392 :UserID Terminal Host"); 418 SendServerCommand("392 :UserID Terminal Host");
421 419
422 if (users.Count == 0) 420 if (users.Length == 0)
423 { 421 {
424 SendServerCommand("395 :Nobody logged in"); 422 SendServerCommand("395 :Nobody logged in");
425 return; 423 return;
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
index 2969503..6f044e0 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs
@@ -962,7 +962,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
962 if ((groupInfo == null) || (account == null)) 962 if ((groupInfo == null) || (account == null))
963 { 963 {
964 return; 964 return;
965 } 965 }
966 966
967 // Send Message to Ejectee 967 // Send Message to Ejectee
968 GridInstantMessage msg = new GridInstantMessage(); 968 GridInstantMessage msg = new GridInstantMessage();
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
index 9363205..0d265f2 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/SimianGroupsServicesConnectorModule.cs
@@ -91,11 +91,11 @@ using OpenSim.Services.Interfaces;
91 * + RoleID 91 * + RoleID
92 * 92 *
93 * GroupID -> GroupNotice -> NoticeID 93 * GroupID -> GroupNotice -> NoticeID
94 * + TimeStamp [uint] 94 * + TimeStamp [uint]
95 * + FromName [string] 95 * + FromName [string]
96 * + Subject [string] 96 * + Subject [string]
97 * + Message [string] 97 * + Message [string]
98 * + BinaryBucket [byte[]] 98 * + BinaryBucket [byte[]]
99 * 99 *
100 * */ 100 * */
101 101
@@ -309,7 +309,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
309 GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID); 309 GroupInfoMap["OwnerRoleID"] = OSD.FromUUID(OwnerRoleID);
310 GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers); 310 GroupInfoMap["OwnersPowers"] = OSD.FromULong((ulong)m_DefaultOwnerPowers);
311 311
312 if(SimianAddGeneric(GroupID, "Group", name, GroupInfoMap)) 312 if (SimianAddGeneric(GroupID, "Group", name, GroupInfoMap))
313 { 313 {
314 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers); 314 AddGroupRole(requestingAgentID, GroupID, UUID.Zero, "Everyone", "Members of " + name, "Member of " + name, (ulong)m_DefaultEveryonePowers);
315 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers); 315 AddGroupRole(requestingAgentID, GroupID, OwnerRoleID, "Owners", "Owners of " + name, "Owner of " + name, (ulong)m_DefaultOwnerPowers);
@@ -334,7 +334,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
334 334
335 string GroupName; 335 string GroupName;
336 OSDMap GroupInfoMap; 336 OSDMap GroupInfoMap;
337 if( SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap) ) 337 if (SimianGetFirstGenericEntry(groupID, "GroupInfo", out GroupName, out GroupInfoMap))
338 { 338 {
339 GroupInfoMap["Charter"] = OSD.FromString(charter); 339 GroupInfoMap["Charter"] = OSD.FromString(charter);
340 GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList); 340 GroupInfoMap["ShowInList"] = OSD.FromBoolean(showInList);
@@ -379,7 +379,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
379 string GroupRoleMemberType = "GroupRole" + groupID.ToString(); 379 string GroupRoleMemberType = "GroupRole" + groupID.ToString();
380 if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers)) 380 if (SimianGetGenericEntries(GroupRoleMemberType, roleID.ToString(), out GroupRoleMembers))
381 { 381 {
382 foreach(UUID UserID in GroupRoleMembers.Keys) 382 foreach (UUID UserID in GroupRoleMembers.Keys)
383 { 383 {
384 EnsureRoleNotSelectedByMember(groupID, roleID, UserID); 384 EnsureRoleNotSelectedByMember(groupID, roleID, UserID);
385 385
@@ -724,7 +724,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
724 } 724 }
725 725
726 OSDMap UserGroupMemberInfo; 726 OSDMap UserGroupMemberInfo;
727 if( SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo) ) 727 if (SimianGetGenericEntry(agentID, "GroupMember", groupID.ToString(), out UserGroupMemberInfo))
728 { 728 {
729 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean(); 729 data.AcceptNotices = UserGroupMemberInfo["AcceptNotices"].AsBoolean();
730 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger(); 730 data.Contribution = UserGroupMemberInfo["Contribution"].AsInteger();
@@ -736,7 +736,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
736 // 736 //
737 737
738 OSDMap GroupRoleInfo; 738 OSDMap GroupRoleInfo;
739 if( SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo) ) 739 if (SimianGetGenericEntry(groupID, "GroupRole", data.ActiveRole.ToString(), out GroupRoleInfo))
740 { 740 {
741 data.GroupTitle = GroupRoleInfo["Title"].AsString(); 741 data.GroupTitle = GroupRoleInfo["Title"].AsString();
742 data.GroupPowers = GroupRoleInfo["Powers"].AsULong(); 742 data.GroupPowers = GroupRoleInfo["Powers"].AsULong();
@@ -748,7 +748,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
748 // 748 //
749 OSDMap GroupInfo; 749 OSDMap GroupInfo;
750 string GroupName; 750 string GroupName;
751 if( SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo) ) 751 if (SimianGetFirstGenericEntry(groupID, "Group", out GroupName, out GroupInfo))
752 { 752 {
753 data.GroupID = groupID; 753 data.GroupID = groupID;
754 data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean(); 754 data.AllowPublish = GroupInfo["AllowPublish"].AsBoolean();
@@ -928,12 +928,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
928 Dictionary<string, OSDMap> GroupRoles; 928 Dictionary<string, OSDMap> GroupRoles;
929 if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles)) 929 if (SimianGetGenericEntries(groupID, "GroupRole", out GroupRoles))
930 { 930 {
931 foreach( KeyValuePair<string, OSDMap> Role in GroupRoles ) 931 foreach (KeyValuePair<string, OSDMap> Role in GroupRoles)
932 { 932 {
933 Dictionary<UUID, OSDMap> GroupRoleMembers; 933 Dictionary<UUID, OSDMap> GroupRoleMembers;
934 if( SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers) ) 934 if (SimianGetGenericEntries("GroupRole"+groupID.ToString(), Role.Key, out GroupRoleMembers))
935 { 935 {
936 foreach( KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers ) 936 foreach (KeyValuePair<UUID, OSDMap> GroupRoleMember in GroupRoleMembers)
937 { 937 {
938 GroupRoleMembersData data = new GroupRoleMembersData(); 938 GroupRoleMembersData data = new GroupRoleMembersData();
939 939
@@ -1264,7 +1264,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1264 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString()); 1264 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] Generics Result {0}", entryMap["Value"].AsString());
1265 maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString())); 1265 maps.Add(entryMap["Key"].AsString(), (OSDMap)OSDParser.DeserializeJson(entryMap["Value"].AsString()));
1266 } 1266 }
1267 if(maps.Count == 0) 1267 if (maps.Count == 0)
1268 { 1268 {
1269 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results"); 1269 if (m_debugEnabled) m_log.InfoFormat("[SIMIAN-GROUPS-CONNECTOR] No Generics Results");
1270 } 1270 }
@@ -1352,17 +1352,14 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1352 } 1352 }
1353 1353
1354 // Check if this is an update or a request 1354 // Check if this is an update or a request
1355 if ( requestArgs["RequestMethod"] == "RemoveGeneric" 1355 if (requestArgs["RequestMethod"] == "RemoveGeneric"
1356 || requestArgs["RequestMethod"] == "AddGeneric" 1356 || requestArgs["RequestMethod"] == "AddGeneric")
1357 )
1358
1359 { 1357 {
1360 // Any and all updates cause the cache to clear 1358 // Any and all updates cause the cache to clear
1361 m_memoryCache.Clear(); 1359 m_memoryCache.Clear();
1362 1360
1363 // Send update to server, return the response without caching it 1361 // Send update to server, return the response without caching it
1364 return WebUtil.PostToService(m_groupsServerURI, requestArgs); 1362 return WebUtil.PostToService(m_groupsServerURI, requestArgs);
1365
1366 } 1363 }
1367 1364
1368 // If we're not doing an update, we must be requesting data 1365 // If we're not doing an update, we must be requesting data
@@ -1372,7 +1369,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1372 OSDMap response = null; 1369 OSDMap response = null;
1373 if (!m_memoryCache.TryGetValue(CacheKey, out response)) 1370 if (!m_memoryCache.TryGetValue(CacheKey, out response))
1374 { 1371 {
1375 // if it wasn't in the cache, pass the request to the Simian Grid Services 1372 // if it wasn't in the cache, pass the request to the Simian Grid Services
1376 response = WebUtil.PostToService(m_groupsServerURI, requestArgs); 1373 response = WebUtil.PostToService(m_groupsServerURI, requestArgs);
1377 1374
1378 // and cache the response 1375 // and cache the response
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
index 79b9a16..a88c5e2 100644
--- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -960,7 +960,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
960 960
961 } 961 }
962 962
963 if( resp == null ) 963 if (resp == null)
964 { 964 {
965 string UserService; 965 string UserService;
966 UUID SessionID; 966 UUID SessionID;
@@ -1065,7 +1065,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
1065 1065
1066 /// <summary> 1066 /// <summary>
1067 /// Group Request Tokens are an attempt to allow the groups service to authenticate 1067 /// Group Request Tokens are an attempt to allow the groups service to authenticate
1068 /// requests. 1068 /// requests.
1069 /// TODO: This broke after the big grid refactor, either find a better way, or discard this 1069 /// TODO: This broke after the big grid refactor, either find a better way, or discard this
1070 /// </summary> 1070 /// </summary>
1071 /// <param name="client"></param> 1071 /// <param name="client"></param>
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
index de1e01c..d21b652 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMEntityCollection.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
111 } 111 }
112 112
113 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash 113 // Check if there are SceneObjectGroups in the list that do not have corresponding ContentManagementGroups in the CMEntityHash
114 public System.Collections.ArrayList CheckForMissingEntities(System.Collections.Generic.List<EntityBase> currList) 114 public System.Collections.ArrayList CheckForMissingEntities(EntityBase[] currList)
115 { 115 {
116 System.Collections.ArrayList missingList = new System.Collections.ArrayList(); 116 System.Collections.ArrayList missingList = new System.Collections.ArrayList();
117 SceneObjectGroup temp = null; 117 SceneObjectGroup temp = null;
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
index 2730eee..49d20e1 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementEntity.cs
@@ -127,7 +127,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
127 /// </summary> 127 /// </summary>
128 public void FindDifferences() 128 public void FindDifferences()
129 { 129 {
130 System.Collections.Generic.List<EntityBase> sceneEntityList = m_Entity.Scene.GetEntities(); 130 List<EntityBase> sceneEntityList = new List<EntityBase>(m_Entity.Scene.GetEntities());
131 DiffersFromSceneGroup = false; 131 DiffersFromSceneGroup = false;
132 // if group is not contained in scene's list 132 // if group is not contained in scene's list
133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID)) 133 if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
index 796f437..d7838c5 100644
--- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
+++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
161 161
162 //finalize 162 //finalize
163 m_Entity.RootPart.PhysActor = null; 163 m_Entity.RootPart.PhysActor = null;
164 m_Entity.Children = parts; 164 m_Entity.Children = parts;
165 } 165 }
166 } 166 }
167 167
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
index 6ba5ccf..140264b 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs
@@ -41,12 +41,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
41 private readonly Scene m_scene; 41 private readonly Scene m_scene;
42 private readonly IEnumerator<EntityBase> m_sogEnum; 42 private readonly IEnumerator<EntityBase> m_sogEnum;
43 private readonly ISecurityCredential m_security; 43 private readonly ISecurityCredential m_security;
44 private readonly List<EntityBase> m_entities;
44 45
45 public IObjEnum(Scene scene, ISecurityCredential security) 46 public IObjEnum(Scene scene, ISecurityCredential security)
46 { 47 {
47 m_scene = scene; 48 m_scene = scene;
48 m_security = security; 49 m_security = security;
49 m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); 50 m_entities = new List<EntityBase>(m_scene.Entities.GetEntities());
51 m_sogEnum = m_entities.GetEnumerator();
50 } 52 }
51 53
52 public void Dispose() 54 public void Dispose()
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
index c439e3e..59ad9d8 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs
@@ -432,7 +432,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
432 return; 432 return;
433 } 433 }
434 434
435 foreach(string button in buttons) 435 foreach (string button in buttons)
436 { 436 {
437 if (button == String.Empty) 437 if (button == String.Empty)
438 { 438 {
@@ -448,7 +448,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
448 448
449 dm.SendDialogToUser( 449 dm.SendDialogToUser(
450 avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID, 450 avatar, GetSOP().Name, GetSOP().UUID, GetSOP().OwnerID,
451 message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons); 451 message, new UUID("00000000-0000-2222-3333-100000001000"), chat_channel, buttons);
452 452
453 } 453 }
454 454
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
index 45bb005..f2324d2 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs
@@ -205,10 +205,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
205 { 205 {
206 get 206 get
207 { 207 {
208 List<EntityBase> ents = m_internalScene.Entities.GetAllByType<ScenePresence>(); 208 EntityBase[] ents = m_internalScene.Entities.GetAllByType<ScenePresence>();
209 IAvatar[] rets = new IAvatar[ents.Count]; 209 IAvatar[] rets = new IAvatar[ents.Length];
210 210
211 for (int i = 0; i < ents.Count; i++) 211 for (int i = 0; i < ents.Length; i++)
212 { 212 {
213 EntityBase ent = ents[i]; 213 EntityBase ent = ents[i];
214 rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); 214 rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security);
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index 61cbb90..cc51c3b 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -824,5 +824,5 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
824 RegionMoneyRequest = 1, 824 RegionMoneyRequest = 1,
825 Gift = 2, 825 Gift = 2,
826 Purchase = 3 826 Purchase = 3
827 } 827 }
828} \ No newline at end of file 828} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index 3ed338b..421da36 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -568,8 +568,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
568 { 568 {
569 m_copse = new List<Copse>(); 569 m_copse = new List<Copse>();
570 570
571 List<EntityBase> objs = m_scene.GetEntities(); 571 EntityBase[] objs = m_scene.GetEntities();
572
573 foreach (EntityBase obj in objs) 572 foreach (EntityBase obj in objs)
574 { 573 {
575 if (obj is SceneObjectGroup) 574 if (obj is SceneObjectGroup)
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
index a0d6197..f424e7f 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerIndividualEventForwarder.cs
@@ -49,7 +49,7 @@ namespace OpenSim.Region.RegionCombinerModule
49 public void ClientConnect(IClientAPI client) 49 public void ClientConnect(IClientAPI client)
50 { 50 {
51 m_virtScene.UnSubscribeToClientPrimEvents(client); 51 m_virtScene.UnSubscribeToClientPrimEvents(client);
52 m_virtScene.UnSubscribeToClientPrimRezEvents(client); 52 m_virtScene.UnSubscribeToClientPrimRezEvents(client);
53 m_virtScene.UnSubscribeToClientInventoryEvents(client); 53 m_virtScene.UnSubscribeToClientInventoryEvents(client);
54 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client); 54 ((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
55 //m_virtScene.UnSubscribeToClientTeleportEvents(client); 55 //m_virtScene.UnSubscribeToClientTeleportEvents(client);
@@ -66,7 +66,7 @@ namespace OpenSim.Region.RegionCombinerModule
66 client.OnRezObject += LocalRezObject; 66 client.OnRezObject += LocalRezObject;
67 67
68 m_rootScene.SubscribeToClientInventoryEvents(client); 68 m_rootScene.SubscribeToClientInventoryEvents(client);
69 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client); 69 ((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
70 //m_rootScene.SubscribeToClientTeleportEvents(client); 70 //m_rootScene.SubscribeToClientTeleportEvents(client);
71 m_rootScene.SubscribeToClientScriptEvents(client); 71 m_rootScene.SubscribeToClientScriptEvents(client);
72 72
diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
index 33ff707..be5411a 100644
--- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
+++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs
@@ -118,7 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel
118 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); 118 return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
119 } 119 }
120 } 120 }
121 121
122 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); 122 ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
123 obj.LandData.Name = "NO LAND"; 123 obj.LandData.Name = "NO LAND";
124 return obj; 124 return obj;
@@ -142,14 +142,14 @@ public class RegionCombinerLargeLandChannel : ILandChannel
142 142
143 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) 143 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
144 { 144 {
145 RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id); 145 RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
146 } 146 }
147 147
148 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) 148 public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
149 { 149 {
150 RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id); 150 RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
151 } 151 }
152 152
153 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) 153 public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
154 { 154 {
155 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient); 155 RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 512957d..a5b3cd0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -4298,9 +4298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4298 } 4298 }
4299 4299
4300 4300
4301 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4301 pinfo = World.PresenceService.GetAgent(uuid);
4302 if (pinfos != null && pinfos.Length > 0)
4303 pinfo = pinfos[0];
4304 4302
4305 ce = new UserInfoCacheEntry(); 4303 ce = new UserInfoCacheEntry();
4306 ce.time = Util.EnvironmentTickCount(); 4304 ce.time = Util.EnvironmentTickCount();
@@ -4319,11 +4317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4319 4317
4320 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000) 4318 if (Util.EnvironmentTickCount() < ce.time || (Util.EnvironmentTickCount() - ce.time) >= 20000)
4321 { 4319 {
4322 PresenceInfo[] pinfos = World.PresenceService.GetAgents(new string[] { uuid.ToString() }); 4320 pinfo = World.PresenceService.GetAgent(uuid);
4323 if (pinfos != null && pinfos.Length > 0)
4324 pinfo = pinfos[0];
4325 else
4326 pinfo = null;
4327 4321
4328 ce.time = Util.EnvironmentTickCount(); 4322 ce.time = Util.EnvironmentTickCount();
4329 ce.pinfo = pinfo; 4323 ce.pinfo = pinfo;
@@ -8482,7 +8476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8482 res.Add(new LSL_Integer((int)me.ControlPermissions)); 8476 res.Add(new LSL_Integer((int)me.ControlPermissions));
8483 break; 8477 break;
8484 } 8478 }
8485 } 8479 }
8486 8480
8487 return res; 8481 return res;
8488 } 8482 }
@@ -8498,7 +8492,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8498 if (face < 0 || face > m_host.GetNumberOfSides() - 1) 8492 if (face < 0 || face > m_host.GetNumberOfSides() - 1)
8499 return ScriptBaseClass.LSL_STATUS_OK; 8493 return ScriptBaseClass.LSL_STATUS_OK;
8500 8494
8501 return SetPrimMediaParams(face, rules); 8495 return SetPrimMediaParams(face, rules);
8502 } 8496 }
8503 8497
8504 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) 8498 private LSL_Integer SetPrimMediaParams(int face, LSL_List rules)
@@ -8587,7 +8581,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8587 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); 8581 me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++);
8588 break; 8582 break;
8589 } 8583 }
8590 } 8584 }
8591 8585
8592 module.SetMediaEntry(m_host, face, me); 8586 module.SetMediaEntry(m_host, face, me);
8593 8587
@@ -8607,7 +8601,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8607 8601
8608 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); 8602 IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>();
8609 if (null == module) 8603 if (null == module)
8610 throw new Exception("Media on a prim functions not available"); 8604 throw new Exception("Media on a prim functions not available");
8611 8605
8612 module.ClearMediaEntry(m_host, face); 8606 module.ClearMediaEntry(m_host, face);
8613 8607
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index a08b135..6827ede 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -1197,7 +1197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1197 1197
1198 World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID); 1198 World.LandChannel.Join(startx,starty,endx,endy,m_host.OwnerID);
1199 } 1199 }
1200 1200
1201 public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2) 1201 public void osParcelSubdivide(LSL_Vector pos1, LSL_Vector pos2)
1202 { 1202 {
1203 CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide"); 1203 CheckThreatLevel(ThreatLevel.High, "osParcelSubdivide");
@@ -1220,7 +1220,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1220 // can modify it 1220 // can modify it
1221 1221
1222 ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y); 1222 ILandObject startLandObject = World.LandChannel.GetLandObject((int)pos.x, (int)pos.y);
1223 if (startLandObject == null) 1223 if (startLandObject == null)
1224 { 1224 {
1225 OSSLShoutError("There is no land at that location"); 1225 OSSLShoutError("There is no land at that location");
1226 return; 1226 return;
@@ -1237,7 +1237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1237 UUID uuid; 1237 UUID uuid;
1238 1238
1239 // Process the rules, not sure what the impact would be of changing owner or group 1239 // Process the rules, not sure what the impact would be of changing owner or group
1240 for (int idx = 0; idx < rules.Length; ) 1240 for (int idx = 0; idx < rules.Length;)
1241 { 1241 {
1242 int code = rules.GetLSLIntegerItem(idx++); 1242 int code = rules.GetLSLIntegerItem(idx++);
1243 string arg = rules.GetLSLStringItem(idx++); 1243 string arg = rules.GetLSLStringItem(idx++);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index a5b1124..3b7de53 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
286 } 286 }
287 else 287 else
288 { 288 {
289 Entities = m_CmdManager.m_ScriptEngine.World.GetEntities(); 289 Entities = new List<EntityBase>(m_CmdManager.m_ScriptEngine.World.GetEntities());
290 } 290 }
291 SceneObjectPart SensePoint = ts.host; 291 SceneObjectPart SensePoint = ts.host;
292 292
@@ -417,7 +417,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
417 List<SensedEntity> sensedEntities = new List<SensedEntity>(); 417 List<SensedEntity> sensedEntities = new List<SensedEntity>();
418 418
419 // If nobody about quit fast 419 // If nobody about quit fast
420 if(m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0) 420 if (m_CmdManager.m_ScriptEngine.World.GetRootAgentCount() == 0)
421 return sensedEntities; 421 return sensedEntities;
422 422
423 SceneObjectPart SensePoint = ts.host; 423 SceneObjectPart SensePoint = ts.host;
@@ -496,7 +496,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
496 { 496 {
497 ScenePresence sp; 497 ScenePresence sp;
498 // Try direct lookup by UUID 498 // Try direct lookup by UUID
499 if(!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp)) 499 if (!m_CmdManager.m_ScriptEngine.World.TryGetScenePresence(ts.keyID, out sp))
500 return sensedEntities; 500 return sensedEntities;
501 senseEntity(sp); 501 senseEntity(sp);
502 } 502 }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index e5e8a56..e82d297 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -632,7 +632,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
632 bool postOnRez = (bool)p[4]; 632 bool postOnRez = (bool)p[4];
633 StateSource stateSource = (StateSource)p[5]; 633 StateSource stateSource = (StateSource)p[5];
634 634
635 lock(m_CompileDict) 635 lock (m_CompileDict)
636 { 636 {
637 if (!m_CompileDict.ContainsKey(itemID)) 637 if (!m_CompileDict.ContainsKey(itemID))
638 return false; 638 return false;
diff --git a/OpenSim/Server/Base/ServerUtils.cs b/OpenSim/Server/Base/ServerUtils.cs
index e7a8294..f4472c7 100644
--- a/OpenSim/Server/Base/ServerUtils.cs
+++ b/OpenSim/Server/Base/ServerUtils.cs
@@ -62,7 +62,7 @@ namespace OpenSim.Server.Base
62 /// </summary> 62 /// </summary>
63 /// <param name="dllName"></param> 63 /// <param name="dllName"></param>
64 /// <param name="args">The arguments which control which constructor is invoked on the plugin</param> 64 /// <param name="args">The arguments which control which constructor is invoked on the plugin</param>
65 /// <returns></returns> 65 /// <returns></returns>
66 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class 66 public static T LoadPlugin<T>(string dllName, Object[] args) where T:class
67 { 67 {
68 string[] parts = dllName.Split(new char[] {':'}); 68 string[] parts = dllName.Split(new char[] {':'});
diff --git a/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
new file mode 100644
index 0000000..39baa32
--- /dev/null
+++ b/OpenSim/Server/Handlers/Hypergrid/HeloServerConnector.cs
@@ -0,0 +1,79 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Net;
32using System.Reflection;
33using Nini.Config;
34using log4net;
35using OpenSim.Server.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Server.Handlers.Base;
39
40namespace OpenSim.Server.Handlers.Hypergrid
41{
42 public class HeloServiceInConnector : ServiceConnector
43 {
44 public HeloServiceInConnector(IConfigSource config, IHttpServer server, string configName) :
45 base(config, server, configName)
46 {
47 server.AddStreamHandler(new HeloServerGetHandler("opensim-robust"));
48 }
49 }
50
51 public class HeloServerGetHandler : BaseStreamHandler
52 {
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private string m_HandlersType;
56
57 public HeloServerGetHandler(string handlersType) :
58 base("GET", "/helo")
59 {
60 m_HandlersType = handlersType;
61 }
62
63 public override byte[] Handle(string path, Stream requestData,
64 OSHttpRequest httpRequest, OSHttpResponse httpResponse)
65 {
66 return OKResponse(httpResponse);
67 }
68
69 private byte[] OKResponse(OSHttpResponse httpResponse)
70 {
71 m_log.Debug("[HELO]: hi, I was called");
72 httpResponse.AddHeader("X-Handlers-Provided", m_HandlersType);
73 httpResponse.StatusCode = (int)HttpStatusCode.OK;
74 httpResponse.StatusDescription = "OK";
75 return new byte[0];
76 }
77
78 }
79}
diff --git a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
index 34df54a..5c31639 100644
--- a/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/HGAssetServiceConnector.cs
@@ -32,6 +32,8 @@ using System.Collections.Generic;
32using System.Reflection; 32using System.Reflection;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Services.Interfaces; 34using OpenSim.Services.Interfaces;
35using OpenSim.Services.Connectors.Hypergrid;
36using OpenSim.Services.Connectors.SimianGrid;
35 37
36namespace OpenSim.Services.Connectors 38namespace OpenSim.Services.Connectors
37{ 39{
@@ -41,7 +43,7 @@ namespace OpenSim.Services.Connectors
41 LogManager.GetLogger( 43 LogManager.GetLogger(
42 MethodBase.GetCurrentMethod().DeclaringType); 44 MethodBase.GetCurrentMethod().DeclaringType);
43 45
44 private Dictionary<string, AssetServicesConnector> m_connectors = new Dictionary<string, AssetServicesConnector>(); 46 private Dictionary<string, IAssetService> m_connectors = new Dictionary<string, IAssetService>();
45 47
46 public HGAssetServiceConnector(IConfigSource source) 48 public HGAssetServiceConnector(IConfigSource source)
47 { 49 {
@@ -81,7 +83,7 @@ namespace OpenSim.Services.Connectors
81 83
82 private IAssetService GetConnector(string url) 84 private IAssetService GetConnector(string url)
83 { 85 {
84 AssetServicesConnector connector = null; 86 IAssetService connector = null;
85 lock (m_connectors) 87 lock (m_connectors)
86 { 88 {
87 if (m_connectors.ContainsKey(url)) 89 if (m_connectors.ContainsKey(url))
@@ -90,12 +92,17 @@ namespace OpenSim.Services.Connectors
90 } 92 }
91 else 93 else
92 { 94 {
93 // We're instantiating this class explicitly, but this won't 95 // Still not as flexible as I would like this to be,
94 // work in general, because the remote grid may be running 96 // but good enough for now
95 // an asset server that has a different protocol. 97 string connectorType = new HeloServicesConnector(url).Helo();
96 // Eventually we will want a piece of protocol asking 98 m_log.DebugFormat("[HG ASSET SERVICE]: HELO returned {0}", connectorType);
97 // the remote server about its kind. Definitely cool thing to do! 99 if (connectorType == "opensim-simian")
98 connector = new AssetServicesConnector(url); 100 {
101 connector = new SimianAssetServiceConnector(url);
102 }
103 else
104 connector = new AssetServicesConnector(url);
105
99 m_connectors.Add(url, connector); 106 m_connectors.Add(url, connector);
100 } 107 }
101 } 108 }
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
index f5b5982..479a80e 100644
--- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs
@@ -86,7 +86,7 @@ namespace OpenSim.Services.Connectors.Hypergrid
86 paramList.Add(hash); 86 paramList.Add(hash);
87 87
88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList); 88 XmlRpcRequest request = new XmlRpcRequest("link_region", paramList);
89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/" ); 89 string uri = "http://" + ((info.ServerURI != null && info.ServerURI != string.Empty && !info.ServerURI.StartsWith("http:")) ? info.ServerURI : info.ExternalEndPoint.Address + ":" + info.HttpPort + "/");
90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri); 90 m_log.Debug("[GATEKEEPER SERVICE CONNECTOR]: Linking to " + uri);
91 XmlRpcResponse response = null; 91 XmlRpcResponse response = null;
92 try 92 try
diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
new file mode 100644
index 0000000..7b166c1
--- /dev/null
+++ b/OpenSim/Services/Connectors/Hypergrid/HeloServiceConnector.cs
@@ -0,0 +1,75 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using log4net;
29using System;
30using System.Net;
31using System.Reflection;
32using Nini.Config;
33
34namespace OpenSim.Services.Connectors
35{
36 public class HeloServicesConnector
37 {
38 private static readonly ILog m_log =
39 LogManager.GetLogger(
40 MethodBase.GetCurrentMethod().DeclaringType);
41
42 private string m_ServerURI = String.Empty;
43
44 public HeloServicesConnector()
45 {
46 }
47
48 public HeloServicesConnector(string serverURI)
49 {
50 m_ServerURI = serverURI.TrimEnd('/');
51 }
52
53
54 public virtual string Helo()
55 {
56 HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI + "/helo");
57
58 try
59 {
60 WebResponse response = req.GetResponse();
61 if (response.Headers.Get("X-Handlers-Provided") == null) // just in case this ever returns a null
62 return string.Empty;
63 return response.Headers.Get("X-Handlers-Provided");
64 }
65 catch (Exception e)
66 {
67 m_log.DebugFormat("[HELO SERVICE]: Unable to perform HELO request to {0}: {1}", m_ServerURI, e.Message);
68 }
69
70 // fail
71 return string.Empty;
72 }
73
74 }
75}
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
index e25e7eb..403ee15 100644
--- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
+++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs
@@ -526,7 +526,7 @@ namespace OpenSim.Services.Connectors
526 InventoryFolderBase folder = new InventoryFolderBase(); 526 InventoryFolderBase folder = new InventoryFolderBase();
527 527
528 try 528 try
529 { 529 {
530 folder.ParentID = new UUID(data["ParentID"].ToString()); 530 folder.ParentID = new UUID(data["ParentID"].ToString());
531 folder.Type = short.Parse(data["Type"].ToString()); 531 folder.Type = short.Parse(data["Type"].ToString());
532 folder.Version = ushort.Parse(data["Version"].ToString()); 532 folder.Version = ushort.Parse(data["Version"].ToString());
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
index a871d07..67a06f3 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianActivityDetector.cs
@@ -26,11 +26,9 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections.Generic;
30using System.Reflection; 29using System.Reflection;
31using OpenSim.Framework; 30using OpenSim.Framework;
32using OpenSim.Region.Framework.Scenes; 31using OpenSim.Region.Framework.Scenes;
33using OpenSim.Services.Interfaces;
34using OpenMetaverse; 32using OpenMetaverse;
35using log4net; 33using log4net;
36 34
@@ -71,7 +69,10 @@ namespace OpenSim.Services.Connectors.SimianGrid
71 public void OnMakeRootAgent(ScenePresence sp) 69 public void OnMakeRootAgent(ScenePresence sp)
72 { 70 {
73 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName); 71 m_log.DebugFormat("[SIMIAN ACTIVITY DETECTOR]: Detected root presence {0} in {1}", sp.UUID, sp.Scene.RegionInfo.RegionName);
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 72 Util.FireAndForget(delegate(object o)
73 {
74 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
75 });
75 } 76 }
76 77
77 public void OnNewClient(IClientAPI client) 78 public void OnNewClient(IClientAPI client)
@@ -107,7 +108,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
107 108
108 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID) 109 void OnEnteringNewParcel(ScenePresence sp, int localLandID, UUID regionID)
109 { 110 {
110 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat); 111 // Asynchronously update the position stored in the session table for this agent
112 Util.FireAndForget(delegate(object o)
113 {
114 m_GridUserService.SetLastPosition(sp.UUID.ToString(), sp.ControllingClient.SessionId, sp.Scene.RegionInfo.RegionID, sp.AbsolutePosition, sp.Lookat);
115 });
111 } 116 }
112 } 117 }
113} 118}
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 6d5b30e..30d3147 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -84,6 +84,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
84 CommonInit(source); 84 CommonInit(source);
85 } 85 }
86 86
87 public SimianAssetServiceConnector(string url)
88 {
89 m_serverUrl = url;
90 }
91
87 public void Initialise(IConfigSource source) 92 public void Initialise(IConfigSource source)
88 { 93 {
89 IConfig moduleConfig = source.Configs["Modules"]; 94 IConfig moduleConfig = source.Configs["Modules"];
@@ -119,6 +124,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
119 124
120 public AssetBase Get(string id) 125 public AssetBase Get(string id)
121 { 126 {
127 if (String.IsNullOrEmpty(m_serverUrl))
128 {
129 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
130 throw new InvalidOperationException();
131 }
132
122 // Cache fetch 133 // Cache fetch
123 if (m_cache != null) 134 if (m_cache != null)
124 { 135 {
@@ -145,6 +156,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
145 /// <returns></returns> 156 /// <returns></returns>
146 public AssetMetadata GetMetadata(string id) 157 public AssetMetadata GetMetadata(string id)
147 { 158 {
159 if (String.IsNullOrEmpty(m_serverUrl))
160 {
161 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
162 throw new InvalidOperationException();
163 }
164
148 AssetMetadata metadata = null; 165 AssetMetadata metadata = null;
149 166
150 // Cache fetch 167 // Cache fetch
@@ -216,6 +233,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
216 /// <returns>True if the id was parseable, false otherwise</returns> 233 /// <returns>True if the id was parseable, false otherwise</returns>
217 public bool Get(string id, Object sender, AssetRetrieved handler) 234 public bool Get(string id, Object sender, AssetRetrieved handler)
218 { 235 {
236 if (String.IsNullOrEmpty(m_serverUrl))
237 {
238 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
239 throw new InvalidOperationException();
240 }
241
219 // Cache fetch 242 // Cache fetch
220 if (m_cache != null) 243 if (m_cache != null)
221 { 244 {
@@ -246,6 +269,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
246 /// <returns></returns> 269 /// <returns></returns>
247 public string Store(AssetBase asset) 270 public string Store(AssetBase asset)
248 { 271 {
272 if (String.IsNullOrEmpty(m_serverUrl))
273 {
274 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
275 throw new InvalidOperationException();
276 }
277
249 bool storedInCache = false; 278 bool storedInCache = false;
250 string errorMessage = null; 279 string errorMessage = null;
251 280
@@ -378,6 +407,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
378 /// <returns></returns> 407 /// <returns></returns>
379 public bool Delete(string id) 408 public bool Delete(string id)
380 { 409 {
410 if (String.IsNullOrEmpty(m_serverUrl))
411 {
412 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
413 throw new InvalidOperationException();
414 }
415
381 //string errorMessage = String.Empty; 416 //string errorMessage = String.Empty;
382 string url = m_serverUrl + id; 417 string url = m_serverUrl + id;
383 418
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 3505c64..4d0d53e 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -28,8 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Net;
33using System.Reflection; 31using System.Reflection;
34using log4net; 32using log4net;
35using Mono.Addins; 33using Mono.Addins;
@@ -37,7 +35,6 @@ using Nini.Config;
37using OpenSim.Framework; 35using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
index 5b18aef..6f2d735 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs
@@ -30,13 +30,10 @@ using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
34using Nini.Config; 33using Nini.Config;
35using OpenMetaverse; 34using OpenMetaverse;
36using OpenMetaverse.StructuredData; 35using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 36using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
41 38
42using FriendInfo = OpenSim.Services.Interfaces.FriendInfo; 39using FriendInfo = OpenSim.Services.Interfaces.FriendInfo;
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index 470eccd..21ad4ab 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -37,7 +37,6 @@ using OpenMetaverse.StructuredData;
37using OpenSim.Framework; 37using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
40using OpenSim.Server.Base;
41using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
42 41
43namespace OpenSim.Services.Connectors.SimianGrid 42namespace OpenSim.Services.Connectors.SimianGrid
@@ -91,6 +90,11 @@ namespace OpenSim.Services.Connectors.SimianGrid
91 CommonInit(source); 90 CommonInit(source);
92 } 91 }
93 92
93 public SimianInventoryServiceConnector(string url)
94 {
95 m_serverUrl = url;
96 }
97
94 public void Initialise(IConfigSource source) 98 public void Initialise(IConfigSource source)
95 { 99 {
96 IConfig moduleConfig = source.Configs["Modules"]; 100 IConfig moduleConfig = source.Configs["Modules"];
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 077be3c..a344594 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -28,17 +28,14 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.Net;
32using System.Reflection; 31using System.Reflection;
33using log4net; 32using log4net;
34using Mono.Addins; 33using Mono.Addins;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Framework; 35using OpenSim.Framework;
37using OpenSim.Framework.Servers.HttpServer;
38using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
39using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
40using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
41using OpenSim.Server.Base;
42using OpenMetaverse; 39using OpenMetaverse;
43using OpenMetaverse.StructuredData; 40using OpenMetaverse.StructuredData;
44 41
@@ -358,25 +355,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
358 return null; 355 return null;
359 } 356 }
360 357
361// private OSDMap GetSessionData(UUID sessionID)
362// {
363// m_log.DebugFormat("[SIMIAN PRESENCE CONNECTOR]: Requesting session data for session " + sessionID);
364//
365// NameValueCollection requestArgs = new NameValueCollection
366// {
367// { "RequestMethod", "GetSession" },
368// { "SessionID", sessionID.ToString() }
369// };
370//
371// OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
372// if (response["Success"].AsBoolean())
373// return response;
374// else
375// m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve session data for session " + sessionID);
376//
377// return null;
378// }
379
380 private List<PresenceInfo> GetSessions(UUID userID) 358 private List<PresenceInfo> GetSessions(UUID userID)
381 { 359 {
382 List<PresenceInfo> presences = new List<PresenceInfo>(1); 360 List<PresenceInfo> presences = new List<PresenceInfo>(1);
@@ -429,39 +407,6 @@ namespace OpenSim.Services.Connectors.SimianGrid
429 return success; 407 return success;
430 } 408 }
431 409
432 ///// <summary>
433 ///// Fetch the last known avatar location with GetSession and persist it
434 ///// as user data with AddUserData
435 ///// </summary>
436 //private bool SetLastLocation(UUID sessionID)
437 //{
438 // NameValueCollection requestArgs = new NameValueCollection
439 // {
440 // { "RequestMethod", "GetSession" },
441 // { "SessionID", sessionID.ToString() }
442 // };
443
444 // OSDMap response = WebUtil.PostToService(m_serverUrl, requestArgs);
445 // bool success = response["Success"].AsBoolean();
446
447 // if (success)
448 // {
449 // UUID userID = response["UserID"].AsUUID();
450 // UUID sceneID = response["SceneID"].AsUUID();
451 // Vector3 position = response["ScenePosition"].AsVector3();
452 // Vector3 lookAt = response["SceneLookAt"].AsVector3();
453
454 // return SetLastLocation(userID, sceneID, position, lookAt);
455 // }
456 // else
457 // {
458 // m_log.Warn("[SIMIAN PRESENCE CONNECTOR]: Failed to retrieve presence information for session " + sessionID +
459 // " while saving last location: " + response["Message"].AsString());
460 // }
461
462 // return success;
463 //}
464
465 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse) 410 private PresenceInfo ResponseToPresenceInfo(OSDMap sessionResponse, OSDMap userResponse)
466 { 411 {
467 if (sessionResponse == null) 412 if (sessionResponse == null)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
index 0ef4974..b7e8538 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs
@@ -291,8 +291,8 @@ namespace OpenSim.Services.Connectors.SimianGrid
291 // Check if the user is online 291 // Check if the user is online
292 if (client.Scene is Scene) 292 if (client.Scene is Scene)
293 { 293 {
294 OpenSim.Services.Interfaces.PresenceInfo[] presences = ((Scene)client.Scene).PresenceService.GetAgents(new string[] { avatarID.ToString() }); 294 OpenSim.Services.Interfaces.PresenceInfo presence = ((Scene)client.Scene).PresenceService.GetAgent(avatarID);
295 if (presences != null && presences.Length > 0) 295 if (presence != null)
296 flags |= ProfileFlags.Online; 296 flags |= ProfileFlags.Online;
297 } 297 }
298 298
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index 694aa72..ddd2322 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -28,7 +28,6 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections.Specialized; 30using System.Collections.Specialized;
31using System.IO;
32using System.Reflection; 31using System.Reflection;
33using OpenSim.Framework; 32using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 33using OpenSim.Region.Framework.Interfaces;
@@ -49,13 +48,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 48 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 49 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
51 { 50 {
51 private const double CACHE_EXPIRATION_SECONDS = 120.0;
52
52 private static readonly ILog m_log = 53 private static readonly ILog m_log =
53 LogManager.GetLogger( 54 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 55 MethodBase.GetCurrentMethod().DeclaringType);
55 56
56 private string m_serverUrl = String.Empty; 57 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 58 private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
58 private bool m_Enabled = false; 59 private bool m_Enabled;
59 60
60 #region ISharedRegionModule 61 #region ISharedRegionModule
61 62
@@ -141,7 +142,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
141 { "UserID", userID.ToString() } 142 { "UserID", userID.ToString() }
142 }; 143 };
143 144
144 return GetUser(requestArgs); 145 account = GetUser(requestArgs);
146
147 if (account == null)
148 {
149 // Store null responses too, to avoid repeated lookups for missing accounts
150 m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
151 }
152
153 return account;
145 } 154 }
146 155
147 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 156 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -216,7 +225,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
216 if (success) 225 if (success)
217 { 226 {
218 // Cache the user account info 227 // Cache the user account info
219 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 228 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
220 } 229 }
221 else 230 else
222 { 231 {
@@ -281,7 +290,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
281 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 290 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
282 291
283 // Cache the user account info 292 // Cache the user account info
284 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 293 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
285 294
286 return account; 295 return account;
287 } 296 }
diff --git a/OpenSim/Services/Connectors/Simulation/EstateDataService.cs b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
new file mode 100644
index 0000000..87c49d3
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/EstateDataService.cs
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using System.Reflection;
35using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Services.Connectors
43{
44 public class EstateDataService : ServiceBase, IEstateDataService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected IEstateDataStore m_database;
51
52 public EstateDataService(IConfigSource config)
53 : base(config)
54 {
55 string dllName = String.Empty;
56 string connString = String.Empty;
57
58 // Try reading the [DatabaseService] section, if it exists
59 IConfig dbConfig = config.Configs["DatabaseService"];
60 if (dbConfig != null)
61 {
62 dllName = dbConfig.GetString("StorageProvider", String.Empty);
63 connString = dbConfig.GetString("EstateConnectionString", String.Empty);
64 if (String.IsNullOrEmpty(connString))
65 connString = dbConfig.GetString("ConnectionString", String.Empty);
66 }
67
68 // We tried, but this doesn't exist. We can't proceed
69 if (dllName == String.Empty)
70 throw new Exception("No StorageProvider configured");
71
72 m_database = LoadPlugin<IEstateDataStore>(dllName, new Object[] { connString });
73 if (m_database == null)
74 throw new Exception("Could not find a storage interface in the given module");
75 }
76
77 public EstateSettings LoadEstateSettings(UUID regionID, bool create)
78 {
79 return m_database.LoadEstateSettings(regionID, create);
80 }
81
82 public EstateSettings LoadEstateSettings(int estateID)
83 {
84 return m_database.LoadEstateSettings(estateID);
85 }
86
87 public void StoreEstateSettings(EstateSettings es)
88 {
89 m_database.StoreEstateSettings(es);
90 }
91
92 public List<int> GetEstates(string search)
93 {
94 return m_database.GetEstates(search);
95 }
96
97 public bool LinkRegion(UUID regionID, int estateID)
98 {
99 return m_database.LinkRegion(regionID, estateID);
100 }
101
102 public List<UUID> GetRegions(int estateID)
103 {
104 return m_database.GetRegions(estateID);
105 }
106
107 public bool DeleteEstate(int estateID)
108 {
109 return m_database.DeleteEstate(estateID);
110 }
111 }
112}
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
new file mode 100644
index 0000000..946f7e4
--- /dev/null
+++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs
@@ -0,0 +1,140 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using OpenMetaverse;
31using log4net;
32using Mono.Addins;
33using Nini.Config;
34using System.Reflection;
35using OpenSim.Services.Base;
36using OpenSim.Services.Interfaces;
37using OpenSim.Data;
38using OpenSim.Framework;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Services.Connectors
43{
44 public class SimulationDataService : ServiceBase, ISimulationDataService
45 {
46 private static readonly ILog m_log =
47 LogManager.GetLogger(
48 MethodBase.GetCurrentMethod().DeclaringType);
49
50 protected ISimulationDataStore m_database;
51
52 public SimulationDataService(IConfigSource config)
53 : base(config)
54 {
55 string dllName = String.Empty;
56 string connString = String.Empty;
57
58 // Try reading the [DatabaseService] section, if it exists
59 IConfig dbConfig = config.Configs["DatabaseService"];
60 if (dbConfig != null)
61 {
62 dllName = dbConfig.GetString("StorageProvider", String.Empty);
63 connString = dbConfig.GetString("ConnectionString", String.Empty);
64 }
65
66 // We tried, but this doesn't exist. We can't proceed
67 if (dllName == String.Empty)
68 throw new Exception("No StorageProvider configured");
69
70 m_database = LoadPlugin<ISimulationDataStore>(dllName, new Object[] { connString });
71 if (m_database == null)
72 throw new Exception("Could not find a storage interface in the given module");
73 }
74
75 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
76 {
77 m_database.StoreObject(obj, regionUUID);
78 }
79
80 public void RemoveObject(UUID uuid, UUID regionUUID)
81 {
82 m_database.RemoveObject(uuid, regionUUID);
83 }
84
85 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
86 {
87 m_database.StorePrimInventory(primID, items);
88 }
89
90 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
91 {
92 return m_database.LoadObjects(regionUUID);
93 }
94
95 public void StoreTerrain(double[,] terrain, UUID regionID)
96 {
97 m_database.StoreTerrain(terrain, regionID);
98 }
99
100 public double[,] LoadTerrain(UUID regionID)
101 {
102 return m_database.LoadTerrain(regionID);
103 }
104
105 public void StoreLandObject(ILandObject Parcel)
106 {
107 m_database.StoreLandObject(Parcel);
108 }
109
110 public void RemoveLandObject(UUID globalID)
111 {
112 m_database.RemoveLandObject(globalID);
113 }
114
115 public List<LandData> LoadLandObjects(UUID regionUUID)
116 {
117 return m_database.LoadLandObjects(regionUUID);
118 }
119
120 public void StoreRegionSettings(RegionSettings rs)
121 {
122 m_database.StoreRegionSettings(rs);
123 }
124
125 public RegionSettings LoadRegionSettings(UUID regionUUID)
126 {
127 return m_database.LoadRegionSettings(regionUUID);
128 }
129
130 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
131 {
132 return m_database.LoadRegionWindlightSettings(regionUUID);
133 }
134
135 public void StoreRegionWindlightSettings(RegionLightShareData wl)
136 {
137 m_database.StoreRegionWindlightSettings(wl);
138 }
139 }
140}
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs
index 86bca79..e543337 100644
--- a/OpenSim/Services/InventoryService/InventoryService.cs
+++ b/OpenSim/Services/InventoryService/InventoryService.cs
@@ -276,11 +276,11 @@ namespace OpenSim.Services.InventoryService
276 List<InventoryFolderBase> folders = RequestSubFolders(root.ID); 276 List<InventoryFolderBase> folders = RequestSubFolders(root.ID);
277 277
278 foreach (InventoryFolderBase folder in folders) 278 foreach (InventoryFolderBase folder in folders)
279 { 279 {
280 if (folder.Type == (short)type) 280 if (folder.Type == (short)type)
281 { 281 {
282// m_log.DebugFormat( 282// m_log.DebugFormat(
283// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type); 283// "[INVENTORY SERVICE]: Found folder {0} type {1}", folder.Name, (AssetType)folder.Type);
284 284
285 return folder; 285 return folder;
286 } 286 }
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 5ccb912..1e4b6c2 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -314,7 +314,7 @@ namespace OpenSim.Services.LLLoginService
314 { 314 {
315 // something went wrong, make something up, so that we don't have to test this anywhere else 315 // something went wrong, make something up, so that we don't have to test this anywhere else
316 guinfo = new GridUserInfo(); 316 guinfo = new GridUserInfo();
317 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); 317 guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30);
318 } 318 }
319 319
320 // 320 //
diff --git a/OpenSim/Services/UserAccountService/UserAccountService.cs b/OpenSim/Services/UserAccountService/UserAccountService.cs
index 326e502..f376cf8 100644
--- a/OpenSim/Services/UserAccountService/UserAccountService.cs
+++ b/OpenSim/Services/UserAccountService/UserAccountService.cs
@@ -97,10 +97,10 @@ namespace OpenSim.Services.UserAccountService
97 public UserAccount GetUserAccount(UUID scopeID, string firstName, 97 public UserAccount GetUserAccount(UUID scopeID, string firstName,
98 string lastName) 98 string lastName)
99 { 99 {
100// m_log.DebugFormat( 100// m_log.DebugFormat(
101// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}", 101// "[USER ACCOUNT SERVICE]: Retrieving account by username for {0} {1}, scope {2}",
102// firstName, lastName, scopeID); 102// firstName, lastName, scopeID);
103 103
104 UserAccountData[] d; 104 UserAccountData[] d;
105 105
106 if (scopeID != UUID.Zero) 106 if (scopeID != UUID.Zero)
@@ -235,10 +235,10 @@ namespace OpenSim.Services.UserAccountService
235 235
236 public bool StoreUserAccount(UserAccount data) 236 public bool StoreUserAccount(UserAccount data)
237 { 237 {
238// m_log.DebugFormat( 238// m_log.DebugFormat(
239// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}", 239// "[USER ACCOUNT SERVICE]: Storing user account for {0} {1} {2}, scope {3}",
240// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID); 240// data.FirstName, data.LastName, data.PrincipalID, data.ScopeID);
241 241
242 UserAccountData d = new UserAccountData(); 242 UserAccountData d = new UserAccountData();
243 243
244 d.FirstName = data.FirstName; 244 d.FirstName = data.FirstName;
@@ -285,7 +285,7 @@ namespace OpenSim.Services.UserAccountService
285 #endregion 285 #endregion
286 286
287 #region Console commands 287 #region Console commands
288 288
289 /// <summary> 289 /// <summary>
290 /// Handle the create user command from the console. 290 /// Handle the create user command from the console.
291 /// </summary> 291 /// </summary>
@@ -297,12 +297,14 @@ namespace OpenSim.Services.UserAccountService
297 string password; 297 string password;
298 string email; 298 string email;
299 299
300 List<char> excluded = new List<char>(new char[]{' '});
301
300 if (cmdparams.Length < 3) 302 if (cmdparams.Length < 3)
301 firstName = MainConsole.Instance.CmdPrompt("First name", "Default"); 303 firstName = MainConsole.Instance.CmdPrompt("First name", "Default", excluded);
302 else firstName = cmdparams[2]; 304 else firstName = cmdparams[2];
303 305
304 if (cmdparams.Length < 4) 306 if (cmdparams.Length < 4)
305 lastName = MainConsole.Instance.CmdPrompt("Last name", "User"); 307 lastName = MainConsole.Instance.CmdPrompt("Last name", "User", excluded);
306 else lastName = cmdparams[3]; 308 else lastName = cmdparams[3];
307 309
308 if (cmdparams.Length < 5) 310 if (cmdparams.Length < 5)
diff --git a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
index 2a055cc..de6e815 100644
--- a/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/MockRegionDataPlugin.cs
@@ -35,11 +35,86 @@ using OpenSim.Region.Framework.Scenes;
35 35
36namespace OpenSim.Data.Null 36namespace OpenSim.Data.Null
37{ 37{
38 public class NullDataService : ISimulationDataService
39 {
40 private NullDataStore m_store;
41
42 public NullDataService()
43 {
44 m_store = new NullDataStore();
45 }
46
47 public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
48 {
49 m_store.StoreObject(obj, regionUUID);
50 }
51
52 public void RemoveObject(UUID uuid, UUID regionUUID)
53 {
54 m_store.RemoveObject(uuid, regionUUID);
55 }
56
57 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
58 {
59 m_store.StorePrimInventory(primID, items);
60 }
61
62 public List<SceneObjectGroup> LoadObjects(UUID regionUUID)
63 {
64 return m_store.LoadObjects(regionUUID);
65 }
66
67 public void StoreTerrain(double[,] terrain, UUID regionID)
68 {
69 m_store.StoreTerrain(terrain, regionID);
70 }
71
72 public double[,] LoadTerrain(UUID regionID)
73 {
74 return m_store.LoadTerrain(regionID);
75 }
76
77 public void StoreLandObject(ILandObject Parcel)
78 {
79 m_store.StoreLandObject(Parcel);
80 }
81
82 public void RemoveLandObject(UUID globalID)
83 {
84 m_store.RemoveLandObject(globalID);
85 }
86
87 public List<LandData> LoadLandObjects(UUID regionUUID)
88 {
89 return m_store.LoadLandObjects(regionUUID);
90 }
91
92 public void StoreRegionSettings(RegionSettings rs)
93 {
94 m_store.StoreRegionSettings(rs);
95 }
96
97 public RegionSettings LoadRegionSettings(UUID regionUUID)
98 {
99 return m_store.LoadRegionSettings(regionUUID);
100 }
101
102 public RegionLightShareData LoadRegionWindlightSettings(UUID regionUUID)
103 {
104 return m_store.LoadRegionWindlightSettings(regionUUID);
105 }
106
107 public void StoreRegionWindlightSettings(RegionLightShareData wl)
108 {
109 m_store.StoreRegionWindlightSettings(wl);
110 }
111 }
112
38 /// <summary> 113 /// <summary>
39 /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that 114 /// Mock region data plugin. This obeys the api contract for persistence but stores everything in memory, so that
40 /// tests can check correct persistence. 115 /// tests can check correct persistence.
41 /// </summary> 116 /// </summary>
42 public class NullDataStore : IRegionDataStore 117 public class NullDataStore : ISimulationDataStore
43 { 118 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 119 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 120
@@ -99,7 +174,7 @@ namespace OpenSim.Data.Null
99 } 174 }
100 175
101 public void RemoveObject(UUID obj, UUID regionUUID) 176 public void RemoveObject(UUID obj, UUID regionUUID)
102 { 177 {
103 // All parts belonging to the object with the uuid are removed. 178 // All parts belonging to the object with the uuid are removed.
104 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_sceneObjectParts.Values); 179 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_sceneObjectParts.Values);
105 foreach (SceneObjectPart part in parts) 180 foreach (SceneObjectPart part in parts)
@@ -108,13 +183,12 @@ namespace OpenSim.Data.Null
108 { 183 {
109 m_log.DebugFormat( 184 m_log.DebugFormat(
110 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}", 185 "[MOCK REGION DATA PLUGIN]: Removing part {0} {1} as part of object {2} from {3}",
111 part.Name, part.UUID, obj, regionUUID); 186 part.Name, part.UUID, obj, regionUUID);
112 m_sceneObjectParts.Remove(part.UUID); 187 m_sceneObjectParts.Remove(part.UUID);
113 } 188 }
114 } 189 }
115 } 190 }
116 191
117 // see IRegionDatastore
118 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items) 192 public void StorePrimInventory(UUID primID, ICollection<TaskInventoryItem> items)
119 { 193 {
120 m_primItems[primID] = items; 194 m_primItems[primID] = items;
@@ -130,7 +204,7 @@ namespace OpenSim.Data.Null
130 if (prim.IsRoot) 204 if (prim.IsRoot)
131 { 205 {
132 m_log.DebugFormat( 206 m_log.DebugFormat(
133 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID); 207 "[MOCK REGION DATA PLUGIN]: Loading root part {0} {1} in {2}", prim.Name, prim.UUID, regionUUID);
134 objects[prim.UUID] = new SceneObjectGroup(prim); 208 objects[prim.UUID] = new SceneObjectGroup(prim);
135 } 209 }
136 } 210 }
diff --git a/OpenSim/Tests/Common/Mock/TestScene.cs b/OpenSim/Tests/Common/Mock/TestScene.cs
index 615e519..0e1433a 100644
--- a/OpenSim/Tests/Common/Mock/TestScene.cs
+++ b/OpenSim/Tests/Common/Mock/TestScene.cs
@@ -31,6 +31,7 @@ using OpenSim.Framework;
31using OpenSim.Framework.Communications; 31using OpenSim.Framework.Communications;
32using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
33using OpenSim.Region.Framework; 33using OpenSim.Region.Framework;
34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Tests.Common.Mock 37namespace OpenSim.Tests.Common.Mock
@@ -39,20 +40,15 @@ namespace OpenSim.Tests.Common.Mock
39 { 40 {
40 public TestScene( 41 public TestScene(
41 RegionInfo regInfo, AgentCircuitManager authen, 42 RegionInfo regInfo, AgentCircuitManager authen,
42 SceneCommunicationService sceneGridService, StorageManager storeManager, 43 SceneCommunicationService sceneGridService, ISimulationDataService simDataService, IEstateDataService estateDataService,
43 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim, 44 ModuleLoader moduleLoader, bool dumpAssetsToFile, bool physicalPrim,
44 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) 45 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
45 : base(regInfo, authen, sceneGridService, storeManager, moduleLoader, 46 : base(regInfo, authen, sceneGridService, simDataService, estateDataService, moduleLoader,
46 dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion) 47 dumpAssetsToFile, physicalPrim, SeeIntoRegionFromNeighbor, config, simulatorVersion)
47 { 48 {
48 } 49 }
49 50
50 /// <summary> 51 /// <summary>
51 /// Allow retrieval for test check purposes
52 /// </summary>
53 public StorageManager StorageManager { get { return m_storageManager; } }
54
55 /// <summary>
56 /// Temporarily override session authentication for tests (namely teleport). 52 /// Temporarily override session authentication for tests (namely teleport).
57 /// </summary> 53 /// </summary>
58 /// 54 ///
@@ -69,6 +65,6 @@ namespace OpenSim.Tests.Common.Mock
69 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter 65 public AsyncSceneObjectGroupDeleter SceneObjectGroupDeleter
70 { 66 {
71 get { return m_asyncSceneObjectDeleter; } 67 get { return m_asyncSceneObjectDeleter; }
72 } 68 }
73 } 69 }
74} \ No newline at end of file 70} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Setup/AssetHelpers.cs b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
index f9a80b0..8647cfe 100644
--- a/OpenSim/Tests/Common/Setup/AssetHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/AssetHelpers.cs
@@ -54,8 +54,8 @@ namespace OpenSim.Tests.Common
54 { 54 {
55 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId); 55 AssetBase asset = CreateAsset(UUID.Random(), AssetType.Notecard, "hello", creatorId);
56 scene.AssetService.Store(asset); 56 scene.AssetService.Store(asset);
57 return asset; 57 return asset;
58 } 58 }
59 59
60 /// <summary> 60 /// <summary>
61 /// Create an asset from the given scene object. 61 /// Create an asset from the given scene object.
diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
index 9318a27..fc9db03 100644
--- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
+++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Tests.Common.Setup
58 public class SceneSetupHelpers 58 public class SceneSetupHelpers
59 { 59 {
60 // These static variables in order to allow regions to be linked by shared modules and same 60 // These static variables in order to allow regions to be linked by shared modules and same
61 // CommunicationsManager. 61 // CommunicationsManager.
62 private static ISharedRegionModule m_assetService = null; 62 private static ISharedRegionModule m_assetService = null;
63// private static ISharedRegionModule m_authenticationService = null; 63// private static ISharedRegionModule m_authenticationService = null;
64 private static ISharedRegionModule m_inventoryService = null; 64 private static ISharedRegionModule m_inventoryService = null;
@@ -69,19 +69,19 @@ namespace OpenSim.Tests.Common.Setup
69 /// <summary> 69 /// <summary>
70 /// Set up a test scene 70 /// Set up a test scene
71 /// </summary> 71 /// </summary>
72 /// 72 ///
73 /// Automatically starts service threads, as would the normal runtime. 73 /// Automatically starts service threads, as would the normal runtime.
74 /// 74 ///
75 /// <returns></returns> 75 /// <returns></returns>
76 public static TestScene SetupScene() 76 public static TestScene SetupScene()
77 { 77 {
78 return SetupScene(""); 78 return SetupScene("");
79 } 79 }
80 80
81 /// <summary> 81 /// <summary>
82 /// Set up a test scene 82 /// Set up a test scene
83 /// </summary> 83 /// </summary>
84 /// 84 ///
85 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 85 /// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
86 /// <returns></returns> 86 /// <returns></returns>
87 public static TestScene SetupScene(String realServices) 87 public static TestScene SetupScene(String realServices)
@@ -94,7 +94,7 @@ namespace OpenSim.Tests.Common.Setup
94 ///// <summary> 94 ///// <summary>
95 ///// Set up a test scene 95 ///// Set up a test scene
96 ///// </summary> 96 ///// </summary>
97 ///// 97 /////
98 ///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param> 98 ///// <param name="realServices">Starts real inventory and asset services, as opposed to mock ones, if true</param>
99 ///// <param name="cm">This should be the same if simulating two scenes within a standalone</param> 99 ///// <param name="cm">This should be the same if simulating two scenes within a standalone</param>
100 ///// <returns></returns> 100 ///// <returns></returns>
@@ -157,23 +157,24 @@ namespace OpenSim.Tests.Common.Setup
157 AgentCircuitManager acm = new AgentCircuitManager(); 157 AgentCircuitManager acm = new AgentCircuitManager();
158 SceneCommunicationService scs = new SceneCommunicationService(); 158 SceneCommunicationService scs = new SceneCommunicationService();
159 159
160 StorageManager sm = new StorageManager("OpenSim.Tests.Common.dll", "", ""); 160 ISimulationDataService simDataService = OpenSim.Server.Base.ServerUtils.LoadPlugin<ISimulationDataService>("OpenSim.Tests.Common.dll", null);
161 IEstateDataService estateDataService = null;
161 IConfigSource configSource = new IniConfigSource(); 162 IConfigSource configSource = new IniConfigSource();
162 163
163 TestScene testScene = new TestScene( 164 TestScene testScene = new TestScene(
164 regInfo, acm, scs, sm, null, false, false, false, configSource, null); 165 regInfo, acm, scs, simDataService, estateDataService, null, false, false, false, configSource, null);
165 166
166 INonSharedRegionModule capsModule = new CapabilitiesModule(); 167 INonSharedRegionModule capsModule = new CapabilitiesModule();
167 capsModule.Initialise(new IniConfigSource()); 168 capsModule.Initialise(new IniConfigSource());
168 testScene.AddRegionModule(capsModule.Name, capsModule); 169 testScene.AddRegionModule(capsModule.Name, capsModule);
169 capsModule.AddRegion(testScene); 170 capsModule.AddRegion(testScene);
170 171
171 IRegionModule godsModule = new GodsModule(); 172 IRegionModule godsModule = new GodsModule();
172 godsModule.Initialise(testScene, new IniConfigSource()); 173 godsModule.Initialise(testScene, new IniConfigSource());
173 testScene.AddModule(godsModule.Name, godsModule); 174 testScene.AddModule(godsModule.Name, godsModule);
174 realServices = realServices.ToLower(); 175 realServices = realServices.ToLower();
175 // IConfigSource config = new IniConfigSource(); 176 // IConfigSource config = new IniConfigSource();
176 177
177 // If we have a brand new scene, need to initialize shared region modules 178 // If we have a brand new scene, need to initialize shared region modules
178 if ((m_assetService == null && m_inventoryService == null) || newScene) 179 if ((m_assetService == null && m_inventoryService == null) || newScene)
179 { 180 {
@@ -184,13 +185,13 @@ namespace OpenSim.Tests.Common.Setup
184 185
185 // For now, always started a 'real' authentication service 186 // For now, always started a 'real' authentication service
186 StartAuthenticationService(testScene, true); 187 StartAuthenticationService(testScene, true);
187 188
188 if (realServices.Contains("inventory")) 189 if (realServices.Contains("inventory"))
189 StartInventoryService(testScene, true); 190 StartInventoryService(testScene, true);
190 else 191 else
191 StartInventoryService(testScene, false); 192 StartInventoryService(testScene, false);
192 193
193 StartGridService(testScene, true); 194 StartGridService(testScene, true);
194 StartUserAccountService(testScene); 195 StartUserAccountService(testScene);
195 StartPresenceService(testScene); 196 StartPresenceService(testScene);
196 } 197 }
@@ -207,7 +208,7 @@ namespace OpenSim.Tests.Common.Setup
207 m_presenceService.RegionLoaded(testScene); 208 m_presenceService.RegionLoaded(testScene);
208 209
209 } 210 }
210 211
211 m_inventoryService.PostInitialise(); 212 m_inventoryService.PostInitialise();
212 m_assetService.PostInitialise(); 213 m_assetService.PostInitialise();
213 m_userAccountService.PostInitialise(); 214 m_userAccountService.PostInitialise();
@@ -250,7 +251,7 @@ namespace OpenSim.Tests.Common.Setup
250 else 251 else
251 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService"); 252 config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockAssetService");
252 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 253 config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
253 assetService.Initialise(config); 254 assetService.Initialise(config);
254 assetService.AddRegion(testScene); 255 assetService.AddRegion(testScene);
255 assetService.RegionLoaded(testScene); 256 assetService.RegionLoaded(testScene);
256 testScene.AddRegionModule(assetService.Name, assetService); 257 testScene.AddRegionModule(assetService.Name, assetService);
@@ -277,7 +278,7 @@ namespace OpenSim.Tests.Common.Setup
277 testScene.AddRegionModule(service.Name, service); 278 testScene.AddRegionModule(service.Name, service);
278 //m_authenticationService = service; 279 //m_authenticationService = service;
279 } 280 }
280 281
281 private static void StartInventoryService(Scene testScene, bool real) 282 private static void StartInventoryService(Scene testScene, bool real)
282 { 283 {
283 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector(); 284 ISharedRegionModule inventoryService = new LocalInventoryServicesConnector();
@@ -285,7 +286,7 @@ namespace OpenSim.Tests.Common.Setup
285 config.AddConfig("Modules"); 286 config.AddConfig("Modules");
286 config.AddConfig("InventoryService"); 287 config.AddConfig("InventoryService");
287 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector"); 288 config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
288 289
289 if (real) 290 if (real)
290 { 291 {
291 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService"); 292 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
@@ -294,7 +295,7 @@ namespace OpenSim.Tests.Common.Setup
294 { 295 {
295 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService"); 296 config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Tests.Common.dll:MockInventoryService");
296 } 297 }
297 298
298 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); 299 config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");
299 inventoryService.Initialise(config); 300 inventoryService.Initialise(config);
300 inventoryService.AddRegion(testScene); 301 inventoryService.AddRegion(testScene);
@@ -338,14 +339,14 @@ namespace OpenSim.Tests.Common.Setup
338 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll"); 339 config.Configs["UserAccountService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
339 config.Configs["UserAccountService"].Set( 340 config.Configs["UserAccountService"].Set(
340 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService"); 341 "LocalServiceModule", "OpenSim.Services.UserAccountService.dll:UserAccountService");
341 342
342 if (m_userAccountService == null) 343 if (m_userAccountService == null)
343 { 344 {
344 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector(); 345 ISharedRegionModule userAccountService = new LocalUserAccountServicesConnector();
345 userAccountService.Initialise(config); 346 userAccountService.Initialise(config);
346 m_userAccountService = userAccountService; 347 m_userAccountService = userAccountService;
347 } 348 }
348 349
349 m_userAccountService.AddRegion(testScene); 350 m_userAccountService.AddRegion(testScene);
350 m_userAccountService.RegionLoaded(testScene); 351 m_userAccountService.RegionLoaded(testScene);
351 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService); 352 testScene.AddRegionModule(m_userAccountService.Name, m_userAccountService);
@@ -559,5 +560,4 @@ namespace OpenSim.Tests.Common.Setup
559 sogd.InventoryDeQueueAndDelete(); 560 sogd.InventoryDeQueueAndDelete();
560 } 561 }
561 } 562 }
562
563} 563}
diff --git a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
index 915af7e..135c50e 100644
--- a/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserInventoryTestUtils.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Tests.Common
42 42
43 public static InventoryItemBase CreateInventoryItem( 43 public static InventoryItemBase CreateInventoryItem(
44 Scene scene, string itemName, UUID itemId, string folderPath, UUID userId) 44 Scene scene, string itemName, UUID itemId, string folderPath, UUID userId)
45 { 45 {
46 InventoryItemBase item = new InventoryItemBase(); 46 InventoryItemBase item = new InventoryItemBase();
47 item.Name = itemName; 47 item.Name = itemName;
48 item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID; 48 item.AssetID = AssetHelpers.CreateAsset(scene, userId).FullID;
@@ -52,7 +52,7 @@ namespace OpenSim.Tests.Common
52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); 52 InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object);
53 53
54 item.Folder = objsFolder.ID; 54 item.Folder = objsFolder.ID;
55 scene.AddInventoryItem(item); 55 scene.AddInventoryItem(item);
56 56
57 return item; 57 return item;
58 } 58 }
diff --git a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
index 26156f3..d01521d 100644
--- a/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
+++ b/OpenSim/Tests/Common/Setup/UserProfileTestUtils.cs
@@ -53,7 +53,7 @@ namespace OpenSim.Tests.Common.Setup
53// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099"); 53// UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000099");
54// return CreateUserWithInventory(commsManager, userId, callback); 54// return CreateUserWithInventory(commsManager, userId, callback);
55// } 55// }
56// 56//
57// /// <summary> 57// /// <summary>
58// /// Create a test user with a standard inventory 58// /// Create a test user with a standard inventory
59// /// </summary> 59// /// </summary>
@@ -108,11 +108,11 @@ namespace OpenSim.Tests.Common.Setup
108// { 108// {
109// LocalUserServices lus = (LocalUserServices)commsManager.UserService; 109// LocalUserServices lus = (LocalUserServices)commsManager.UserService;
110// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId); 110// lus.AddUser(firstName, lastName, password, "bill@bailey.com", 1000, 1000, userId);
111// 111//
112// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId); 112// CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
113// userInfo.OnInventoryReceived += callback; 113// userInfo.OnInventoryReceived += callback;
114// userInfo.FetchInventory(); 114// userInfo.FetchInventory();
115// 115//
116// return userInfo; 116// return userInfo;
117// } 117// }
118 118
@@ -140,6 +140,6 @@ namespace OpenSim.Tests.Common.Setup
140 scene.UserAccountService.StoreUserAccount(ua); 140 scene.UserAccountService.StoreUserAccount(ua);
141 scene.InventoryService.CreateUserInventory(ua.PrincipalID); 141 scene.InventoryService.CreateUserInventory(ua.PrincipalID);
142 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw); 142 scene.AuthenticationService.SetPassword(ua.PrincipalID, pw);
143 } 143 }
144 } 144 }
145} \ No newline at end of file 145} \ No newline at end of file