29 using System.Collections;
30 using System.Collections.Generic;
33 using System.Reflection;
39 using OpenMetaverse.StructuredData;
40 using OpenSim.Framework;
41 using OpenSim.Region.Framework.Interfaces;
42 using OpenSim.Region.Framework.Scenes;
43 using OpenSim.Region.Framework.Scenes.Serialization;
44 using OpenSim.Services.Interfaces;
45 using OpenSim.Services.Connectors.Simulation;
48 namespace OpenSim.
Region.CoreModules.ServiceConnectorsOut.Simulation
50 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"RemoteSimulationConnectorModule")]
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
55 private bool initialized =
false;
56 protected bool m_enabled =
false;
64 #region Region Module interface
66 public virtual void Initialise(IConfigSource configSource)
68 IConfig moduleConfig = configSource.Configs[
"Modules"];
69 if (moduleConfig != null)
71 string name = moduleConfig.GetString(
"SimulationServices",
"");
76 m_localBackend.InitialiseService(configSource);
82 m_log.Info(
"[REMOTE SIMULATION CONNECTOR]: Remote simulation enabled.");
112 m_localBackend.RemoveScene(scene);
123 public Type ReplaceableInterface
128 public virtual string Name
130 get {
return "RemoteSimulationConnectorModule"; }
135 m_localBackend.Init(scene);
147 #region ISimulationService
151 return m_localBackend.GetScene(regionId);
156 return m_localBackend;
165 if (destination == null)
167 reason =
"Given destination was null";
168 m_log.DebugFormat(
"[REMOTE SIMULATION CONNECTOR]: CreateAgent was given a null destination");
173 if (m_localBackend.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason))
177 if (!m_localBackend.IsLocalRegion(destination.
RegionID))
179 return m_remoteConnector.CreateAgent(source, destination, aCircuit, teleportFlags, ctx, out reason);
186 if (destination == null)
190 if (m_localBackend.IsLocalRegion(destination.
RegionID))
191 return m_localBackend.UpdateAgent(destination, cAgentData, ctx);
193 return m_remoteConnector.UpdateAgent(destination, cAgentData, ctx);
198 if (destination == null)
202 if (m_localBackend.IsLocalRegion(destination.
RegionID))
203 return m_localBackend.UpdateAgent(destination, cAgentData);
205 return m_remoteConnector.UpdateAgent(destination, cAgentData);
210 reason =
"Communications failure";
212 if (destination == null)
216 if (m_localBackend.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason))
220 if (!m_localBackend.IsLocalRegion(destination.
RegionID))
221 return m_remoteConnector.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, features, ctx, out reason);
229 if (m_localBackend.ReleaseAgent(origin,
id, uri))
233 if (!m_localBackend.IsLocalRegion(origin))
234 return m_remoteConnector.ReleaseAgent(origin,
id, uri);
241 if (destination == null)
245 if (m_localBackend.CloseAgent(destination,
id, auth_token))
249 if (!m_localBackend.IsLocalRegion(destination.
RegionID))
250 return m_remoteConnector.CloseAgent(destination,
id, auth_token);
261 if (destination == null)
265 if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall))
272 if (!m_localBackend.IsLocalRegion(destination.
RegionID))
273 return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall);
IScene GetScene(UUID regionId)
Retrieve the scene with the given region ID.
void RegionLoaded(Scene scene)
This will be called once for every scene loaded. In a shared module this will be multiple times in on...
SimulationServiceConnector m_remoteConnector
virtual void InitEach(Scene scene)
bool QueryAccess(GridRegion destination, UUID agentID, string agentHomeURI, bool viaTeleport, Vector3 position, List< UUID > features, EntityTransferContext ctx, out string reason)
Returns whether a propspective user is allowed to visit the region.
void RemoveRegion(Scene scene)
This is called whenever a Scene is removed. For shared modules, this can happen several times...
bool CloseAgent(GridRegion destination, UUID id, string auth_token)
Close agent.
virtual void Initialise(IConfigSource configSource)
This is called to initialize the region module. For shared modules, this is called exactly once...
bool ReleaseAgent(UUID origin, UUID id, string uri)
Message from receiving region to departing region, telling it got contacted by the client...
OpenSim.Services.Interfaces.GridRegion GridRegion
virtual void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
Circuit data for an agent. Connection information shared between regions that accept UDP connections ...
LocalSimulationConnectorModule m_localBackend
virtual void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...
Replacement for ChildAgentDataUpdate. Used over RESTComms and LocalComms.
bool UpdateAgent(GridRegion destination, AgentData cAgentData, EntityTransferContext ctx)
Full child agent update.
bool UpdateAgent(GridRegion destination, AgentPosition cAgentData)
Short child agent update, mostly for position.
void AddRegion(Scene scene)
This is called whenever a Scene is added. For shared modules, this can happen several times...
bool CreateAgent(GridRegion source, GridRegion destination, AgentCircuitData aCircuit, uint teleportFlags, EntityTransferContext ctx, out string reason)
ISimulationService GetInnerService()
bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall)
virtual void InitOnce(Scene scene)