28 using System.Collections.Generic;
29 using System.Reflection;
31 using OpenSim.Region.Framework.Interfaces;
32 using OpenSim.Region.Framework.Scenes;
33 using OpenSim.Server.Base;
34 using OpenSim.Services.Interfaces;
35 using OpenSim.Services.Connectors;
42 namespace OpenSim.
Region.CoreModules.ServiceConnectorsOut.GridUser
44 [Extension(Path =
"/OpenSim/RegionModules", NodeName =
"RegionModule", Id =
"RemoteGridUserServicesConnector")]
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 private const int KEEPTIME = 30;
50 private ExpiringCache<string, GridUserInfo> m_Infos =
new ExpiringCache<string, GridUserInfo>();
52 #region ISharedRegionModule
54 private bool m_Enabled =
false;
59 public Type ReplaceableInterface
66 get {
return "RemoteGridUserServicesConnector"; }
71 IConfig moduleConfig = source.Configs[
"Modules"];
72 if (moduleConfig != null)
74 string name = moduleConfig.GetString(
"GridUserServices",
"");
83 m_log.Info(
"[REMOTE GRID USER CONNECTOR]: Remote grid user enabled");
103 m_ActivityDetector.AddRegion(scene);
105 m_log.InfoFormat(
"[REMOTE GRID USER CONNECTOR]: Enabled remote grid user for region {0}", scene.RegionInfo.RegionName);
114 m_ActivityDetector.RemoveRegion(scene);
126 #region IGridUserService
130 m_log.Warn(
"[REMOTE GRID USER CONNECTOR]: LoggedIn not implemented at the simulators");
134 public bool LoggedOut(
string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
136 if (m_Infos.Contains(userID))
137 m_Infos.Remove(userID);
139 return m_RemoteConnector.LoggedOut(userID, sessionID, region, position, lookat);
143 public bool SetHome(
string userID, UUID regionID, Vector3 position, Vector3 lookAt)
145 if (m_RemoteConnector.SetHome(userID, regionID, position, lookAt))
149 if (m_Infos.TryGetValue(userID, out info))
151 info.HomeRegionID = regionID;
152 info.HomePosition = position;
153 info.HomeLookAt = lookAt;
161 public bool SetLastPosition(
string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
163 if (m_RemoteConnector.SetLastPosition(userID, sessionID, regionID, position, lookAt))
167 if (m_Infos.TryGetValue(userID, out info))
169 info.LastRegionID = regionID;
170 info.LastPosition = position;
171 info.LastLookAt = lookAt;
182 if (m_Infos.TryGetValue(userID, out info))
185 info = m_RemoteConnector.GetGridUserInfo(userID);
187 m_Infos.AddOrUpdate(userID, info, KEEPTIME);
194 return m_RemoteConnector.GetGridUserInfo(userID);
bool LoggedOut(string userID, UUID sessionID, UUID region, Vector3 position, Vector3 lookat)
Informs the grid that a user is logged out and to remove any session data for them ...
bool SetHome(string userID, UUID regionID, Vector3 position, Vector3 lookAt)
GridUserInfo[] GetGridUserInfo(string[] userID)
Records user information specific to a grid but which is not part of a user's account.
GridUserInfo GetGridUserInfo(string userID)
void PostInitialise()
This is called exactly once after all the shared region-modules have been instanciated and IRegionMod...
bool SetLastPosition(string userID, UUID sessionID, UUID regionID, Vector3 position, Vector3 lookAt)
Stores the last known user position at the grid level
GridUserInfo LoggedIn(string userID)
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 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...
void Initialise(IConfigSource source)
This is called to initialize the region module. For shared modules, this is called exactly once...
void Close()
This is the inverse to Initialise. After a Close(), this instance won't be usable anymore...