aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/LoadRegions
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs (renamed from OpenSim/Framework/IRegionLoader.cs)3
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs28
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs13
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs (renamed from OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs)3
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs (renamed from OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs)44
-rw-r--r--OpenSim/ApplicationPlugins/LoadRegions/Resources/LoadRegionsPlugin.addin.xml11
6 files changed, 61 insertions, 41 deletions
diff --git a/OpenSim/Framework/IRegionLoader.cs b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs
index c566fc7..2d1505d 100644
--- a/OpenSim/Framework/IRegionLoader.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/IRegionLoader.cs
@@ -26,8 +26,9 @@
26 */ 26 */
27 27
28using Nini.Config; 28using Nini.Config;
29using OpenSim.Framework;
29 30
30namespace OpenSim.Framework 31namespace OpenSim.ApplicationPlugins.LoadRegions
31{ 32{
32 public interface IRegionLoader 33 public interface IRegionLoader
33 { 34 {
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
index fcb6991..89224a6 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -32,16 +32,17 @@ using System.Threading;
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.RegionLoader.Filesystem;
36using OpenSim.Framework.RegionLoader.Web;
37using OpenSim.Region.CoreModules.Agent.AssetTransaction; 35using OpenSim.Region.CoreModules.Agent.AssetTransaction;
38using OpenSim.Region.CoreModules.Avatar.InstantMessage; 36using OpenSim.Region.CoreModules.Avatar.InstantMessage;
39using OpenSim.Region.CoreModules.Scripting.DynamicTexture; 37using OpenSim.Region.CoreModules.Scripting.DynamicTexture;
40using OpenSim.Region.CoreModules.Scripting.LoadImageURL; 38using OpenSim.Region.CoreModules.Scripting.LoadImageURL;
41using OpenSim.Region.CoreModules.Scripting.XMLRPC; 39using OpenSim.Region.CoreModules.Scripting.XMLRPC;
40using OpenSim.Services.Interfaces;
41using Mono.Addins;
42 42
43namespace OpenSim.ApplicationPlugins.LoadRegions 43namespace OpenSim.ApplicationPlugins.LoadRegions
44{ 44{
45 [Extension(Path="/OpenSim/Startup", Id="LoadRegions", NodeName="Plugin")]
45 public class LoadRegionsPlugin : IApplicationPlugin, IRegionCreator 46 public class LoadRegionsPlugin : IApplicationPlugin, IRegionCreator
46 { 47 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -115,6 +116,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
115 Environment.Exit(1); 116 Environment.Exit(1);
116 } 117 }
117 118
119 List<IScene> createdScenes = new List<IScene>();
120
118 for (int i = 0; i < regionsToLoad.Length; i++) 121 for (int i = 0; i < regionsToLoad.Length; i++)
119 { 122 {
120 IScene scene; 123 IScene scene;
@@ -123,17 +126,22 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
123 ")"); 126 ")");
124 127
125 bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]); 128 bool changed = m_openSim.PopulateRegionEstateInfo(regionsToLoad[i]);
129
126 m_openSim.CreateRegion(regionsToLoad[i], true, out scene); 130 m_openSim.CreateRegion(regionsToLoad[i], true, out scene);
131 createdScenes.Add(scene);
132
127 if (changed) 133 if (changed)
128 regionsToLoad[i].EstateSettings.Save(); 134 m_openSim.EstateDataService.StoreEstateSettings(regionsToLoad[i].EstateSettings);
129 135 }
130 if (scene != null) 136
137 foreach (IScene scene in createdScenes)
138 {
139 scene.Start();
140
141 m_newRegionCreatedHandler = OnNewRegionCreated;
142 if (m_newRegionCreatedHandler != null)
131 { 143 {
132 m_newRegionCreatedHandler = OnNewRegionCreated; 144 m_newRegionCreatedHandler(scene);
133 if (m_newRegionCreatedHandler != null)
134 {
135 m_newRegionCreatedHandler(scene);
136 }
137 } 145 }
138 } 146 }
139 } 147 }
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
index 57615ea..6c3c3e3 100644
--- a/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/Properties/AssemblyInfo.cs
@@ -27,16 +27,17 @@
27 27
28using System.Reflection; 28using System.Reflection;
29using System.Runtime.InteropServices; 29using System.Runtime.InteropServices;
30using Mono.Addins;
30 31
31// General information about an assembly is controlled through the following 32// General information about an assembly is controlled through the following
32// set of attributes. Change these attribute values to modify the information 33// set of attributes. Change these attribute values to modify the information
33// associated with an assembly. 34// associated with an assembly.
34 35
35[assembly : AssemblyTitle("OpenSim.Addin")] 36[assembly : AssemblyTitle("OpenSim.ApplicationPlugins.LoadRegions")]
36[assembly : AssemblyDescription("")] 37[assembly : AssemblyDescription("")]
37[assembly : AssemblyConfiguration("")] 38[assembly : AssemblyConfiguration("")]
38[assembly : AssemblyCompany("http://opensimulator.org")] 39[assembly : AssemblyCompany("http://opensimulator.org")]
39[assembly : AssemblyProduct("OpenSim.Addin")] 40[assembly : AssemblyProduct("OpenSim")]
40[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2009")] 41[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2009")]
41[assembly : AssemblyTrademark("")] 42[assembly : AssemblyTrademark("")]
42[assembly : AssemblyCulture("")] 43[assembly : AssemblyCulture("")]
@@ -60,7 +61,9 @@ using System.Runtime.InteropServices;
60// 61//
61// You can specify all the values or you can default the Build and Revision Numbers 62// You can specify all the values or you can default the Build and Revision Numbers
62// by using the '*' as shown below: 63// by using the '*' as shown below:
63// [assembly: AssemblyVersion("0.7.5.*")] 64// [assembly: AssemblyVersion("0.7.6.*")]
64 65
65[assembly : AssemblyVersion("0.7.5.*")] 66[assembly : AssemblyVersion("0.8.2.*")]
66[assembly : AssemblyFileVersion("0.6.5.0")] \ No newline at end of file 67
68[assembly: Addin("OpenSim.ApplicationPlugins.LoadRegions", OpenSim.VersionInfo.VersionNumber)]
69[assembly: AddinDependency("OpenSim", OpenSim.VersionInfo.VersionNumber)]
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs
index 8332c14..1873a06 100644
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderFileSystem.cs
@@ -31,8 +31,9 @@ using System.Collections.Generic;
31using System.IO; 31using System.IO;
32using System.Reflection; 32using System.Reflection;
33using Nini.Config; 33using Nini.Config;
34using OpenSim.Framework;
34 35
35namespace OpenSim.Framework.RegionLoader.Filesystem 36namespace OpenSim.ApplicationPlugins.LoadRegions
36{ 37{
37 public class RegionLoaderFileSystem : IRegionLoader 38 public class RegionLoaderFileSystem : IRegionLoader
38 { 39 {
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs
index a2f5d9c..850f3e0 100644
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ b/OpenSim/ApplicationPlugins/LoadRegions/RegionLoaderWebServer.cs
@@ -32,8 +32,9 @@ using System.Reflection;
32using System.Xml; 32using System.Xml;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenSim.Framework;
35 36
36namespace OpenSim.Framework.RegionLoader.Web 37namespace OpenSim.ApplicationPlugins.LoadRegions
37{ 38{
38 public class RegionLoaderWebServer : IRegionLoader 39 public class RegionLoaderWebServer : IRegionLoader
39 { 40 {
@@ -74,21 +75,31 @@ namespace OpenSim.Framework.RegionLoader.Web
74 75
75 try 76 try
76 { 77 {
77 HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse();
78 m_log.Debug("[WEBLOADER]: Downloading region information...");
79 StreamReader reader = new StreamReader(webResponse.GetResponseStream());
80 string xmlSource = String.Empty; 78 string xmlSource = String.Empty;
81 string tempStr = reader.ReadLine(); 79
82 while (tempStr != null) 80 using (HttpWebResponse webResponse = (HttpWebResponse) webRequest.GetResponse())
83 { 81 {
84 xmlSource = xmlSource + tempStr; 82 m_log.Debug("[WEBLOADER]: Downloading region information...");
85 tempStr = reader.ReadLine(); 83
84 using (Stream s = webResponse.GetResponseStream())
85 {
86 using (StreamReader reader = new StreamReader(s))
87 {
88 string tempStr = reader.ReadLine();
89 while (tempStr != null)
90 {
91 xmlSource = xmlSource + tempStr;
92 tempStr = reader.ReadLine();
93 }
94 }
95 }
86 } 96 }
97
87 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " + 98 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
88 xmlSource.Length); 99 xmlSource.Length);
89 XmlDocument xmlDoc = new XmlDocument(); 100 XmlDocument xmlDoc = new XmlDocument();
90 xmlDoc.LoadXml(xmlSource); 101 xmlDoc.LoadXml(xmlSource);
91 if (xmlDoc.FirstChild.Name == "Regions") 102 if (xmlDoc.FirstChild.Name == "Nini")
92 { 103 {
93 regionCount = xmlDoc.FirstChild.ChildNodes.Count; 104 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
94 105
@@ -107,17 +118,24 @@ namespace OpenSim.Framework.RegionLoader.Web
107 } 118 }
108 catch (WebException ex) 119 catch (WebException ex)
109 { 120 {
110 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound) 121 using (HttpWebResponse response = (HttpWebResponse)ex.Response)
111 { 122 {
112 if (!allowRegionless) 123 if (response.StatusCode == HttpStatusCode.NotFound)
124 {
125 if (!allowRegionless)
126 throw ex;
127 }
128 else
129 {
113 throw ex; 130 throw ex;
131 }
114 } 132 }
115 else
116 throw ex;
117 } 133 }
118 134
119 if (regionCount > 0 | allowRegionless) 135 if (regionCount > 0 | allowRegionless)
136 {
120 return regionInfos; 137 return regionInfos;
138 }
121 else 139 else
122 { 140 {
123 m_log.Error("[WEBLOADER]: No region configs were available."); 141 m_log.Error("[WEBLOADER]: No region configs were available.");
diff --git a/OpenSim/ApplicationPlugins/LoadRegions/Resources/LoadRegionsPlugin.addin.xml b/OpenSim/ApplicationPlugins/LoadRegions/Resources/LoadRegionsPlugin.addin.xml
deleted file mode 100644
index 37222b7..0000000
--- a/OpenSim/ApplicationPlugins/LoadRegions/Resources/LoadRegionsPlugin.addin.xml
+++ /dev/null
@@ -1,11 +0,0 @@
1<Addin id="OpenSim.ApplicationPlugins.LoadRegions" version="0.1">
2 <Runtime>
3 <Import assembly="OpenSim.ApplicationPlugins.LoadRegions.dll"/>
4 </Runtime>
5 <Dependencies>
6 <Addin id="OpenSim" version="0.5" />
7 </Dependencies>
8 <Extension path = "/OpenSim/Startup">
9 <Plugin id="LoadRegions" type="OpenSim.ApplicationPlugins.LoadRegions.LoadRegionsPlugin" />
10 </Extension>
11</Addin>