29 using System.Collections;
30 using System.Collections.Generic;
31 using System.Reflection;
40 using OpenMetaverse.StructuredData;
42 using OpenSim.Framework;
43 using OpenSim.Region.Framework.Interfaces;
44 using OpenSim.Region.Framework.Scenes;
45 using OpenSim.Services.Interfaces;
48 namespace OpenSim.Services.Connectors.SimianGrid
50 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"SimianExternalCapsModule")]
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private bool m_enabled =
true;
56 private Scene m_scene;
57 private String m_simianURL;
59 #region IRegionModule Members
63 get {
return this.GetType().Name; }
72 if ((m_config = config.Configs[
"SimianExternalCaps"]) != null)
74 m_enabled = m_config.GetBoolean(
"Enabled", m_enabled);
75 if ((m_config = config.Configs[
"SimianGrid"]) != null)
77 m_simianURL = m_config.GetString(
"SimianServiceURL");
78 if (
String.IsNullOrEmpty(m_simianURL))
91 m_log.ErrorFormat(
"[SimianExternalCaps] initialization error: {0}",e.Message);
113 m_scene.EventManager.OnRegisterCaps -= RegisterCapsEventHandler;
114 m_scene.EventManager.OnDeregisterCaps -= DeregisterCapsEventHandler;
122 m_scene.EventManager.OnRegisterCaps += RegisterCapsEventHandler;
123 m_scene.EventManager.OnDeregisterCaps += DeregisterCapsEventHandler;
126 public Type ReplaceableInterface
133 #region IExternalCapsModule
137 UUID cap = UUID.Random();
151 Dictionary<String,String> subs =
new Dictionary<String,String>();
152 subs[
"%OP%"] = capName;
153 subs[
"%USR%"] = agentID.ToString();
154 subs[
"%CAP%"] = cap.ToString();
155 subs[
"%SIM%"] = m_scene.RegionInfo.RegionID.ToString();
157 caps.RegisterHandler(capName,ExpandSkeletonURL(urlSkel,subs));
163 #region EventHandlers
168 private String ExpandSkeletonURL(String urlSkel, Dictionary<String,String> subs)
172 foreach (KeyValuePair<String,String> kvp
in subs)
174 result = result.Replace(kvp.Key,kvp.Value);
void DeregisterCapsEventHandler(UUID agentID, Caps caps)
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
OpenSim.Framework.Capabilities.Caps Caps
OpenSim.Framework.Capabilities.Caps Caps
void Initialise(IConfigSource config)
This is called to initialize the region module. For shared modules, this is called exactly once...
void RegisterCapsEventHandler(UUID agentID, Caps caps)
bool RegisterExternalUserCapsHandler(UUID agentID, Caps caps, String capName, String urlSkel)
This function extends the simple URL configuration in the caps handlers to facilitate more interestin...
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...