29 using System.Collections;
32 using System.Reflection;
33 using System.Security;
38 using OpenSim.Framework;
39 using OpenSim.Framework.Servers.HttpServer;
40 using OpenMetaverse.StructuredData;
46 private static readonly ILog _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 private IConfigSource m_Config;
48 private Hashtable _info =
new Hashtable();
63 m_Config = configSource;
64 loadGridInfo(configSource);
67 private void loadGridInfo(IConfigSource configSource)
69 _info[
"platform"] =
"OpenSim";
72 IConfig gridCfg = configSource.Configs[
"GridInfoService"];
73 IConfig netCfg = configSource.Configs[
"Network"];
77 foreach (
string k
in gridCfg.GetKeys())
79 _info[k] = gridCfg.GetString(k);
82 else if (null != netCfg)
86 "http://127.0.0.1:{0}/",
88 "http_listener_port", ConfigSettings.DefaultRegionHttpPort.ToString()));
94 _info[
"login"] =
"http://127.0.0.1:9000/";
100 _log.Warn(
"[GRID INFO SERVICE]: Cannot get grid info from config source, using minimal defaults");
103 _log.DebugFormat(
"[GRID INFO SERVICE]: Grid info service initialized with {0} keys", _info.Count);
106 private void IssueWarning()
108 _log.Warn(
"[GRID INFO SERVICE]: found no [GridInfo] section in your configuration files");
109 _log.Warn(
"[GRID INFO SERVICE]: trying to guess sensible defaults, you might want to provide better ones:");
111 foreach (
string k
in _info.Keys)
113 _log.WarnFormat(
"[GRID INFO SERVICE]: {0}: {1}", k, _info[k]);
119 XmlRpcResponse response =
new XmlRpcResponse();
120 Hashtable responseData =
new Hashtable();
122 _log.Debug(
"[GRID INFO SERVICE]: Request for grid info");
124 foreach (
string k
in _info.Keys)
126 responseData[k] = _info[k];
128 response.Value = responseData;
136 StringBuilder sb =
new StringBuilder();
138 sb.Append(
"<gridinfo>\n");
139 foreach (
string k
in _info.Keys)
141 sb.AppendFormat(
"<{0}>{1}</{0}>\n", k, SecurityElement.Escape(_info[k].ToString()));
143 sb.Append(
"</gridinfo>\n");
145 return sb.ToString();
175 foreach (
string k
in _info.Keys)
177 map[k] = OSD.FromString(_info[k].ToString());
180 string HomeURI = Util.GetConfigVarFromSections<
string>(m_Config,
"HomeURI",
181 new string[] {
"Startup",
"Hypergrid" }, String.Empty);
183 if (!String.IsNullOrEmpty(HomeURI))
184 map[
"home"] =
OSD.FromString(HomeURI);
187 IConfig cfg = m_Config.Configs[
"LoginService"];
190 HomeURI = cfg.GetString(
"SRV_HomeURI", HomeURI);
192 if (!String.IsNullOrEmpty(HomeURI))
193 map[
"home"] =
OSD.FromString(HomeURI);
196 return OSDParser.SerializeJsonString(map).ToString();
OpenMetaverse.StructuredData.OSDMap OSDMap
string RestGetGridInfoMethod(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
XmlRpcResponse XmlRpcGridInfoMethod(XmlRpcRequest request, IPEndPoint remoteClient)
OpenMetaverse.StructuredData.OSD OSD
Interactive OpenSim region server
string JsonGetGridInfoMethod(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
Get GridInfo in json format: Used bu the OSSL osGetGrid* Adding the SRV_HomeIRI to the kvp returned f...
GridInfoHandlers(IConfigSource configSource)
Instantiate a GridInfoService object.