29 using System.Collections.Generic;
30 using System.Collections.Specialized;
31 using System.Reflection;
35 using OpenSim.Framework;
36 using OpenSim.Region.Framework.Interfaces;
37 using OpenSim.Region.Framework.Scenes;
38 using OpenSim.Services.Interfaces;
40 using OpenMetaverse.StructuredData;
42 [assembly: Addin(
"SimianGrid", OpenSim.VersionInfo.VersionNumber)]
43 [assembly: AddinDependency(
"OpenSim.Region.Framework", OpenSim.VersionInfo.VersionNumber)]
45 namespace OpenSim.Services.Connectors.SimianGrid
47 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"SimianExternalCapsModule")]
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private IConfig m_config = null;
54 private String m_simianURL;
56 #region IRegionModule Members
60 get {
return this.GetType().Name; }
67 m_config = config.Configs[
"SimianGrid"];
71 m_simianURL = m_config.GetString(
"SimianServiceURL");
72 if (
String.IsNullOrEmpty(m_simianURL))
79 SimulatorCapability = SimulatorCapability.Trim();
80 m_log.InfoFormat(
"[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
85 m_log.ErrorFormat(
"[SimianExternalCaps] initialization error: {0}",e.Message);
96 public Type ReplaceableInterface
106 private void InitialiseSimCap()
108 if (m_config.Contains(
"SimulatorCapability"))
110 SimulatorCapability = m_config.GetString(
"SimulatorCapability");
114 if (m_config.Contains(
"SimulatorCapabilityFile"))
116 String filename = m_config.GetString(
"SimulatorCapabilityFile");
117 if (System.IO.File.Exists(filename))
119 SimulatorCapability = System.IO.File.ReadAllText(filename);
124 if (m_config.Contains(
"SimulatorCapabilityVariable"))
126 String envname = m_config.GetString(
"SimulatorCapabilityVariable");
127 String envvalue = System.Environment.GetEnvironmentVariable(envname);
128 if (envvalue != null)
130 SimulatorCapability = envvalue;
135 m_log.WarnFormat(
"[SimianExternalCaps] no method specified for simulator capability");
140 public static String SimulatorCapability = UUID.Zero.ToString();
143 data[
"cap"] = SimulatorCapability;
144 return WebUtil.PostToService(url, data);
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
OpenMetaverse.StructuredData.OSDMap OSDMap
static OSDMap PostToService(string url, NameValueCollection data)
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...