diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | 118 |
1 files changed, 116 insertions, 2 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs index 847319c..a35d749 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGrid.cs | |||
@@ -26,8 +26,122 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
30 | using System.Collections.Specialized; | ||
31 | using System.Reflection; | ||
32 | using log4net; | ||
29 | using Mono.Addins; | 33 | using Mono.Addins; |
30 | using Nini.Config; | 34 | using Nini.Config; |
35 | using OpenSim.Framework; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenMetaverse; | ||
40 | using OpenMetaverse.StructuredData; | ||
31 | 41 | ||
32 | [assembly: Addin("SimianGrid", "1.0")] | 42 | [assembly: Addin("SimianGrid", OpenSim.VersionInfo.VersionNumber)] |
33 | [assembly: AddinDependency("OpenSim", "0.5")] | 43 | [assembly: AddinDependency("OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)] |
44 | |||
45 | namespace OpenSim.Services.Connectors.SimianGrid | ||
46 | { | ||
47 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SimianExternalCapsModule")] | ||
48 | public class SimianGrid : ISharedRegionModule | ||
49 | { | ||
50 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
51 | |||
52 | private IConfig m_config = null; | ||
53 | |||
54 | private String m_simianURL; | ||
55 | |||
56 | #region IRegionModule Members | ||
57 | |||
58 | public string Name | ||
59 | { | ||
60 | get { return this.GetType().Name; } | ||
61 | } | ||
62 | |||
63 | public void Initialise(IConfigSource config) | ||
64 | { | ||
65 | try | ||
66 | { | ||
67 | m_config = config.Configs["SimianGrid"]; | ||
68 | |||
69 | if (m_config != null) | ||
70 | { | ||
71 | m_simianURL = m_config.GetString("SimianServiceURL"); | ||
72 | if (String.IsNullOrEmpty(m_simianURL)) | ||
73 | { | ||
74 | // m_log.DebugFormat("[SimianGrid] service URL is not defined"); | ||
75 | return; | ||
76 | } | ||
77 | |||
78 | InitialiseSimCap(); | ||
79 | SimulatorCapability = SimulatorCapability.Trim(); | ||
80 | m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability); | ||
81 | } | ||
82 | } | ||
83 | catch (Exception e) | ||
84 | { | ||
85 | m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message); | ||
86 | return; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | public void PostInitialise() { } | ||
91 | public void Close() { } | ||
92 | public void AddRegion(Scene scene) { } | ||
93 | public void RemoveRegion(Scene scene) { } | ||
94 | public void RegionLoaded(Scene scene) { } | ||
95 | |||
96 | public Type ReplaceableInterface | ||
97 | { | ||
98 | get { return null; } | ||
99 | } | ||
100 | |||
101 | ///<summary> | ||
102 | /// Try a variety of methods for finding the simian simulator capability; first check the | ||
103 | /// configuration itself, then look for a file that contains the cap, then finally look | ||
104 | /// for an environment variable that contains it. | ||
105 | ///</summary> | ||
106 | private void InitialiseSimCap() | ||
107 | { | ||
108 | if (m_config.Contains("SimulatorCapability")) | ||
109 | { | ||
110 | SimulatorCapability = m_config.GetString("SimulatorCapability"); | ||
111 | return; | ||
112 | } | ||
113 | |||
114 | if (m_config.Contains("SimulatorCapabilityFile")) | ||
115 | { | ||
116 | String filename = m_config.GetString("SimulatorCapabilityFile"); | ||
117 | if (System.IO.File.Exists(filename)) | ||
118 | { | ||
119 | SimulatorCapability = System.IO.File.ReadAllText(filename); | ||
120 | return; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | if (m_config.Contains("SimulatorCapabilityVariable")) | ||
125 | { | ||
126 | String envname = m_config.GetString("SimulatorCapabilityVariable"); | ||
127 | String envvalue = System.Environment.GetEnvironmentVariable(envname); | ||
128 | if (envvalue != null) | ||
129 | { | ||
130 | SimulatorCapability = envvalue; | ||
131 | return; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | m_log.WarnFormat("[SimianExternalCaps] no method specified for simulator capability"); | ||
136 | } | ||
137 | |||
138 | #endregion | ||
139 | |||
140 | public static String SimulatorCapability = UUID.Zero.ToString(); | ||
141 | public static OSDMap PostToService(string url, NameValueCollection data) | ||
142 | { | ||
143 | data["cap"] = SimulatorCapability; | ||
144 | return WebUtil.PostToService(url, data); | ||
145 | } | ||
146 | } | ||
147 | } \ No newline at end of file | ||