aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/RegionLoader
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Framework/RegionLoader
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Framework/RegionLoader')
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs116
-rw-r--r--OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs33
-rw-r--r--OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs130
4 files changed, 0 insertions, 312 deletions
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
deleted file mode 100644
index d670f2f..0000000
--- a/OpenSim/Framework/RegionLoader/Filesystem/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Filesystem")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("4ab5c74b-e886-40a1-b67d-a04df285e706")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs b/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
deleted file mode 100644
index 8332c14..0000000
--- a/OpenSim/Framework/RegionLoader/Filesystem/RegionLoaderFileSystem.cs
+++ /dev/null
@@ -1,116 +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 log4net;
29using System;
30using System.Collections.Generic;
31using System.IO;
32using System.Reflection;
33using Nini.Config;
34
35namespace OpenSim.Framework.RegionLoader.Filesystem
36{
37 public class RegionLoaderFileSystem : IRegionLoader
38 {
39 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40
41 private IConfigSource m_configSource;
42
43 public void SetIniConfigSource(IConfigSource configSource)
44 {
45 m_configSource = configSource;
46 }
47
48 public RegionInfo[] LoadRegions()
49 {
50 string regionConfigPath = Path.Combine(Util.configDir(), "Regions");
51 bool allowRegionless = false;
52
53 try
54 {
55 IConfig startupConfig = (IConfig)m_configSource.Configs["Startup"];
56 regionConfigPath = startupConfig.GetString("regionload_regionsdir", regionConfigPath).Trim();
57 allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
58 }
59 catch (Exception)
60 {
61 // No INI setting recorded.
62 }
63
64 if (!Directory.Exists(regionConfigPath))
65 {
66 Directory.CreateDirectory(regionConfigPath);
67 }
68
69 string[] configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
70 string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
71
72 // Create an empty Regions.ini if there are no existing config files.
73 if (!allowRegionless && configFiles.Length == 0 && iniFiles.Length == 0)
74 {
75 new RegionInfo("DEFAULT REGION CONFIG", Path.Combine(regionConfigPath, "Regions.ini"), false, m_configSource);
76 iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
77 }
78
79 m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config files from {0}", regionConfigPath);
80
81 List<RegionInfo> regionInfos = new List<RegionInfo>();
82
83 int i = 0;
84 foreach (string file in iniFiles)
85 {
86 m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
87
88 IConfigSource source = new IniConfigSource(file);
89
90 foreach (IConfig config in source.Configs)
91 {
92 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource, config.Name);
93 regionInfos.Add(regionInfo);
94
95 m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
96
97 i++;
98 }
99 }
100
101 foreach (string file in configFiles)
102 {
103 m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loading config file {0}", file);
104
105 RegionInfo regionInfo = new RegionInfo("REGION CONFIG #" + (i + 1), file, false, m_configSource);
106 regionInfos.Add(regionInfo);
107
108 m_log.InfoFormat("[REGION LOADER FILE SYSTEM]: Loaded config for region {0}", regionInfo.RegionName);
109
110 i++;
111 }
112
113 return regionInfos.ToArray();
114 }
115 }
116} \ No newline at end of file
diff --git a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs b/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
deleted file mode 100644
index 7309a12..0000000
--- a/OpenSim/Framework/RegionLoader/Web/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
1using System.Reflection;
2using System.Runtime.CompilerServices;
3using System.Runtime.InteropServices;
4
5// General Information about an assembly is controlled through the following
6// set of attributes. Change these attribute values to modify the information
7// associated with an assembly.
8[assembly: AssemblyTitle("OpenSim.Framework.RegionLoader.Web")]
9[assembly: AssemblyDescription("")]
10[assembly: AssemblyConfiguration("")]
11[assembly: AssemblyCompany("http://opensimulator.org")]
12[assembly: AssemblyProduct("OpenSim")]
13[assembly: AssemblyCopyright("OpenSimulator developers")]
14[assembly: AssemblyTrademark("")]
15[assembly: AssemblyCulture("")]
16
17// Setting ComVisible to false makes the types in this assembly not visible
18// to COM components. If you need to access a type in this assembly from
19// COM, set the ComVisible attribute to true on that type.
20[assembly: ComVisible(false)]
21
22// The following GUID is for the ID of the typelib if this project is exposed to COM
23[assembly: Guid("985afff8-e7ed-4056-acce-39abf7a43d33")]
24
25// Version information for an assembly consists of the following four values:
26//
27// Major Version
28// Minor Version
29// Build Number
30// Revision
31//
32[assembly: AssemblyVersion("0.7.5.*")]
33[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
deleted file mode 100644
index a2f5d9c..0000000
--- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs
+++ /dev/null
@@ -1,130 +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.IO;
30using System.Net;
31using System.Reflection;
32using System.Xml;
33using log4net;
34using Nini.Config;
35
36namespace OpenSim.Framework.RegionLoader.Web
37{
38 public class RegionLoaderWebServer : IRegionLoader
39 {
40 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
41
42 private IConfigSource m_configSource;
43
44 public void SetIniConfigSource(IConfigSource configSource)
45 {
46 m_configSource = configSource;
47 }
48
49 public RegionInfo[] LoadRegions()
50 {
51 if (m_configSource == null)
52 {
53 m_log.Error("[WEBLOADER]: Unable to load configuration source!");
54 return null;
55 }
56 else
57 {
58 IConfig startupConfig = (IConfig) m_configSource.Configs["Startup"];
59 string url = startupConfig.GetString("regionload_webserver_url", String.Empty).Trim();
60 bool allowRegionless = startupConfig.GetBoolean("allow_regionless", false);
61
62 if (url == String.Empty)
63 {
64 m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
65 return null;
66 }
67 else
68 {
69 RegionInfo[] regionInfos = new RegionInfo[] {};
70 int regionCount = 0;
71 HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url);
72 webRequest.Timeout = 30000; //30 Second Timeout
73 m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url);
74
75 try
76 {
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;
81 string tempStr = reader.ReadLine();
82 while (tempStr != null)
83 {
84 xmlSource = xmlSource + tempStr;
85 tempStr = reader.ReadLine();
86 }
87 m_log.Debug("[WEBLOADER]: Done downloading region information from server. Total Bytes: " +
88 xmlSource.Length);
89 XmlDocument xmlDoc = new XmlDocument();
90 xmlDoc.LoadXml(xmlSource);
91 if (xmlDoc.FirstChild.Name == "Regions")
92 {
93 regionCount = xmlDoc.FirstChild.ChildNodes.Count;
94
95 if (regionCount > 0)
96 {
97 regionInfos = new RegionInfo[regionCount];
98 int i;
99 for (i = 0; i < xmlDoc.FirstChild.ChildNodes.Count; i++)
100 {
101 m_log.Debug(xmlDoc.FirstChild.ChildNodes[i].OuterXml);
102 regionInfos[i] =
103 new RegionInfo("REGION CONFIG #" + (i + 1), xmlDoc.FirstChild.ChildNodes[i],false,m_configSource);
104 }
105 }
106 }
107 }
108 catch (WebException ex)
109 {
110 if (((HttpWebResponse)ex.Response).StatusCode == HttpStatusCode.NotFound)
111 {
112 if (!allowRegionless)
113 throw ex;
114 }
115 else
116 throw ex;
117 }
118
119 if (regionCount > 0 | allowRegionless)
120 return regionInfos;
121 else
122 {
123 m_log.Error("[WEBLOADER]: No region configs were available.");
124 return null;
125 }
126 }
127 }
128 }
129 }
130}