aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2010-09-08 01:05:56 +0100
committerJustin Clark-Casey (justincc)2010-09-08 01:05:56 +0100
commitb8d14fcc4a7d819af5015144518ce31cd86d0383 (patch)
tree67119cd2cb9bf00e7bbc9ef0e9c4f139f4dbc643 /OpenSim/Services
parentIf a scene object part UUID is changed (only possible when not in a scene), t... (diff)
parentRolling back the recent libomv update but keeping the ExpiringCache cleanups ... (diff)
downloadopensim-SC_OLD-b8d14fcc4a7d819af5015144518ce31cd86d0383.zip
opensim-SC_OLD-b8d14fcc4a7d819af5015144518ce31cd86d0383.tar.gz
opensim-SC_OLD-b8d14fcc4a7d819af5015144518ce31cd86d0383.tar.bz2
opensim-SC_OLD-b8d14fcc4a7d819af5015144518ce31cd86d0383.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs67
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs47
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs35
-rw-r--r--OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs55
7 files changed, 185 insertions, 124 deletions
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
index 99e6983..8f601e8 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
81 81
82 public SimianAssetServiceConnector(IConfigSource source) 82 public SimianAssetServiceConnector(IConfigSource source)
83 { 83 {
84 Initialise(source); 84 CommonInit(source);
85 } 85 }
86 86
87 public void Initialise(IConfigSource source) 87 public void Initialise(IConfigSource source)
@@ -91,31 +91,40 @@ namespace OpenSim.Services.Connectors.SimianGrid
91 { 91 {
92 string name = moduleConfig.GetString("AssetServices", ""); 92 string name = moduleConfig.GetString("AssetServices", "");
93 if (name == Name) 93 if (name == Name)
94 { 94 CommonInit(source);
95 IConfig gridConfig = source.Configs["AssetService"]; 95 }
96 if (gridConfig != null) 96 }
97 {
98 string serviceUrl = gridConfig.GetString("AssetServerURI");
99 if (!String.IsNullOrEmpty(serviceUrl))
100 {
101 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
102 serviceUrl = serviceUrl + '/';
103 m_serverUrl = serviceUrl;
104 }
105 }
106 97
107 if (String.IsNullOrEmpty(m_serverUrl)) 98 private void CommonInit(IConfigSource source)
108 m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector"); 99 {
109 else 100 IConfig gridConfig = source.Configs["AssetService"];
110 m_Enabled = true; 101 if (gridConfig != null)
102 {
103 string serviceUrl = gridConfig.GetString("AssetServerURI");
104 if (!String.IsNullOrEmpty(serviceUrl))
105 {
106 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
107 serviceUrl = serviceUrl + '/';
108 m_serverUrl = serviceUrl;
111 } 109 }
112 } 110 }
111
112 if (String.IsNullOrEmpty(m_serverUrl))
113 m_log.Info("[SIMIAN ASSET CONNECTOR]: No AssetServerURI specified, disabling connector");
114 else
115 m_Enabled = true;
113 } 116 }
114 117
115 #region IAssetService 118 #region IAssetService
116 119
117 public AssetBase Get(string id) 120 public AssetBase Get(string id)
118 { 121 {
122 if (String.IsNullOrEmpty(m_serverUrl))
123 {
124 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
125 throw new InvalidOperationException();
126 }
127
119 // Cache fetch 128 // Cache fetch
120 if (m_cache != null) 129 if (m_cache != null)
121 { 130 {
@@ -142,6 +151,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
142 /// <returns></returns> 151 /// <returns></returns>
143 public AssetMetadata GetMetadata(string id) 152 public AssetMetadata GetMetadata(string id)
144 { 153 {
154 if (String.IsNullOrEmpty(m_serverUrl))
155 {
156 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
157 throw new InvalidOperationException();
158 }
159
145 AssetMetadata metadata = null; 160 AssetMetadata metadata = null;
146 161
147 // Cache fetch 162 // Cache fetch
@@ -213,6 +228,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
213 /// <returns>True if the id was parseable, false otherwise</returns> 228 /// <returns>True if the id was parseable, false otherwise</returns>
214 public bool Get(string id, Object sender, AssetRetrieved handler) 229 public bool Get(string id, Object sender, AssetRetrieved handler)
215 { 230 {
231 if (String.IsNullOrEmpty(m_serverUrl))
232 {
233 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
234 throw new InvalidOperationException();
235 }
236
216 // Cache fetch 237 // Cache fetch
217 if (m_cache != null) 238 if (m_cache != null)
218 { 239 {
@@ -243,6 +264,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
243 /// <returns></returns> 264 /// <returns></returns>
244 public string Store(AssetBase asset) 265 public string Store(AssetBase asset)
245 { 266 {
267 if (String.IsNullOrEmpty(m_serverUrl))
268 {
269 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
270 throw new InvalidOperationException();
271 }
272
246 bool storedInCache = false; 273 bool storedInCache = false;
247 string errorMessage = null; 274 string errorMessage = null;
248 275
@@ -375,6 +402,12 @@ namespace OpenSim.Services.Connectors.SimianGrid
375 /// <returns></returns> 402 /// <returns></returns>
376 public bool Delete(string id) 403 public bool Delete(string id)
377 { 404 {
405 if (String.IsNullOrEmpty(m_serverUrl))
406 {
407 m_log.Error("[SIMIAN ASSET CONNECTOR]: No AssetServerURI configured");
408 throw new InvalidOperationException();
409 }
410
378 //string errorMessage = String.Empty; 411 //string errorMessage = String.Empty;
379 string url = m_serverUrl + id; 412 string url = m_serverUrl + id;
380 413
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
index 68f73ee..51a09f8 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
69 69
70 public SimianAuthenticationServiceConnector(IConfigSource source) 70 public SimianAuthenticationServiceConnector(IConfigSource source)
71 { 71 {
72 Initialise(source); 72 CommonInit(source);
73 } 73 }
74 74
75 public void Initialise(IConfigSource source) 75 public void Initialise(IConfigSource source)
@@ -79,24 +79,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
79 { 79 {
80 string name = moduleConfig.GetString("AuthenticationServices", ""); 80 string name = moduleConfig.GetString("AuthenticationServices", "");
81 if (name == Name) 81 if (name == Name)
82 { 82 CommonInit(source);
83 IConfig gridConfig = source.Configs["AuthenticationService"]; 83 }
84 if (gridConfig != null) 84 }
85 {
86 string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
87 if (!String.IsNullOrEmpty(serviceUrl))
88 {
89 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
90 serviceUrl = serviceUrl + '/';
91 m_serverUrl = serviceUrl;
92 m_Enabled = true;
93 }
94 }
95 85
96 if (String.IsNullOrEmpty(m_serverUrl)) 86 private void CommonInit(IConfigSource source)
97 m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector"); 87 {
88 IConfig gridConfig = source.Configs["AuthenticationService"];
89 if (gridConfig != null)
90 {
91 string serviceUrl = gridConfig.GetString("AuthenticationServerURI");
92 if (!String.IsNullOrEmpty(serviceUrl))
93 {
94 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
95 serviceUrl = serviceUrl + '/';
96 m_serverUrl = serviceUrl;
97 m_Enabled = true;
98 } 98 }
99 } 99 }
100
101 if (String.IsNullOrEmpty(m_serverUrl))
102 m_log.Info("[SIMIAN AUTH CONNECTOR]: No AuthenticationServerURI specified, disabling connector");
100 } 103 }
101 104
102 public string Authenticate(UUID principalID, string password, int lifetime) 105 public string Authenticate(UUID principalID, string password, int lifetime)
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
index 7e56bd1..3505c64 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs
@@ -74,7 +74,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
74 74
75 public SimianAvatarServiceConnector(IConfigSource source) 75 public SimianAvatarServiceConnector(IConfigSource source)
76 { 76 {
77 Initialise(source); 77 CommonInit(source);
78 } 78 }
79 79
80 public void Initialise(IConfigSource source) 80 public void Initialise(IConfigSource source)
@@ -84,24 +84,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
84 { 84 {
85 string name = moduleConfig.GetString("AvatarServices", ""); 85 string name = moduleConfig.GetString("AvatarServices", "");
86 if (name == Name) 86 if (name == Name)
87 { 87 CommonInit(source);
88 IConfig gridConfig = source.Configs["AvatarService"]; 88 }
89 if (gridConfig != null) 89 }
90 {
91 string serviceUrl = gridConfig.GetString("AvatarServerURI");
92 if (!String.IsNullOrEmpty(serviceUrl))
93 {
94 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
95 serviceUrl = serviceUrl + '/';
96 m_serverUrl = serviceUrl;
97 m_Enabled = true;
98 }
99 }
100 90
101 if (String.IsNullOrEmpty(m_serverUrl)) 91 private void CommonInit(IConfigSource source)
102 m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector"); 92 {
93 IConfig gridConfig = source.Configs["AvatarService"];
94 if (gridConfig != null)
95 {
96 string serviceUrl = gridConfig.GetString("AvatarServerURI");
97 if (!String.IsNullOrEmpty(serviceUrl))
98 {
99 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
100 serviceUrl = serviceUrl + '/';
101 m_serverUrl = serviceUrl;
102 m_Enabled = true;
103 } 103 }
104 } 104 }
105
106 if (String.IsNullOrEmpty(m_serverUrl))
107 m_log.Info("[SIMIAN AVATAR CONNECTOR]: No AvatarServerURI specified, disabling connector");
105 } 108 }
106 109
107 #region IAvatarService 110 #region IAvatarService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
index a94620b..4409d5c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
98 98
99 public SimianGridServiceConnector(IConfigSource source) 99 public SimianGridServiceConnector(IConfigSource source)
100 { 100 {
101 Initialise(source); 101 CommonInit(source);
102 } 102 }
103 103
104 public void Initialise(IConfigSource source) 104 public void Initialise(IConfigSource source)
@@ -108,24 +108,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
108 { 108 {
109 string name = moduleConfig.GetString("GridServices", ""); 109 string name = moduleConfig.GetString("GridServices", "");
110 if (name == Name) 110 if (name == Name)
111 { 111 CommonInit(source);
112 IConfig gridConfig = source.Configs["GridService"]; 112 }
113 if (gridConfig != null) 113 }
114 {
115 string serviceUrl = gridConfig.GetString("GridServerURI");
116 if (!String.IsNullOrEmpty(serviceUrl))
117 {
118 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
119 serviceUrl = serviceUrl + '/';
120 m_serverUrl = serviceUrl;
121 m_Enabled = true;
122 }
123 }
124 114
125 if (String.IsNullOrEmpty(m_serverUrl)) 115 private void CommonInit(IConfigSource source)
126 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector"); 116 {
117 IConfig gridConfig = source.Configs["GridService"];
118 if (gridConfig != null)
119 {
120 string serviceUrl = gridConfig.GetString("GridServerURI");
121 if (!String.IsNullOrEmpty(serviceUrl))
122 {
123 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
124 serviceUrl = serviceUrl + '/';
125 m_serverUrl = serviceUrl;
126 m_Enabled = true;
127 } 127 }
128 } 128 }
129
130 if (String.IsNullOrEmpty(m_serverUrl))
131 m_log.Info("[SIMIAN GRID CONNECTOR]: No GridServerURI specified, disabling connector");
129 } 132 }
130 133
131 #region IGridService 134 #region IGridService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
index eb118ae..470eccd 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
88 88
89 public SimianInventoryServiceConnector(IConfigSource source) 89 public SimianInventoryServiceConnector(IConfigSource source)
90 { 90 {
91 Initialise(source); 91 CommonInit(source);
92 } 92 }
93 93
94 public void Initialise(IConfigSource source) 94 public void Initialise(IConfigSource source)
@@ -98,36 +98,39 @@ namespace OpenSim.Services.Connectors.SimianGrid
98 { 98 {
99 string name = moduleConfig.GetString("InventoryServices", ""); 99 string name = moduleConfig.GetString("InventoryServices", "");
100 if (name == Name) 100 if (name == Name)
101 CommonInit(source);
102 }
103 }
104
105 private void CommonInit(IConfigSource source)
106 {
107 IConfig gridConfig = source.Configs["InventoryService"];
108 if (gridConfig != null)
109 {
110 string serviceUrl = gridConfig.GetString("InventoryServerURI");
111 if (!String.IsNullOrEmpty(serviceUrl))
101 { 112 {
102 IConfig gridConfig = source.Configs["InventoryService"]; 113 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
114 serviceUrl = serviceUrl + '/';
115 m_serverUrl = serviceUrl;
116
117 gridConfig = source.Configs["UserAccountService"];
103 if (gridConfig != null) 118 if (gridConfig != null)
104 { 119 {
105 string serviceUrl = gridConfig.GetString("InventoryServerURI"); 120 serviceUrl = gridConfig.GetString("UserAccountServerURI");
106 if (!String.IsNullOrEmpty(serviceUrl)) 121 if (!String.IsNullOrEmpty(serviceUrl))
107 { 122 {
108 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("=")) 123 m_userServerUrl = serviceUrl;
109 serviceUrl = serviceUrl + '/'; 124 m_Enabled = true;
110 m_serverUrl = serviceUrl;
111
112 gridConfig = source.Configs["UserAccountService"];
113 if (gridConfig != null)
114 {
115 serviceUrl = gridConfig.GetString("UserAccountServerURI");
116 if (!String.IsNullOrEmpty(serviceUrl))
117 {
118 m_userServerUrl = serviceUrl;
119 m_Enabled = true;
120 }
121 }
122 } 125 }
123 } 126 }
124
125 if (String.IsNullOrEmpty(m_serverUrl))
126 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
127 else if (String.IsNullOrEmpty(m_userServerUrl))
128 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
129 } 127 }
130 } 128 }
129
130 if (String.IsNullOrEmpty(m_serverUrl))
131 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No InventoryServerURI specified, disabling connector");
132 else if (String.IsNullOrEmpty(m_userServerUrl))
133 m_log.Info("[SIMIAN INVENTORY CONNECTOR]: No UserAccountServerURI specified, disabling connector");
131 } 134 }
132 135
133 /// <summary> 136 /// <summary>
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
index 074c80f..077be3c 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
99 99
100 public SimianPresenceServiceConnector(IConfigSource source) 100 public SimianPresenceServiceConnector(IConfigSource source)
101 { 101 {
102 Initialise(source); 102 CommonInit(source);
103 } 103 }
104 104
105 public void Initialise(IConfigSource source) 105 public void Initialise(IConfigSource source)
@@ -109,24 +109,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
109 { 109 {
110 string name = moduleConfig.GetString("PresenceServices", ""); 110 string name = moduleConfig.GetString("PresenceServices", "");
111 if (name == Name) 111 if (name == Name)
112 CommonInit(source);
113 }
114 }
115
116 private void CommonInit(IConfigSource source)
117 {
118 IConfig gridConfig = source.Configs["PresenceService"];
119 if (gridConfig != null)
120 {
121 string serviceUrl = gridConfig.GetString("PresenceServerURI");
122 if (!String.IsNullOrEmpty(serviceUrl))
112 { 123 {
113 IConfig gridConfig = source.Configs["PresenceService"]; 124 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
114 if (gridConfig != null) 125 serviceUrl = serviceUrl + '/';
115 { 126 m_serverUrl = serviceUrl;
116 string serviceUrl = gridConfig.GetString("PresenceServerURI"); 127 m_Enabled = true;
117 if (!String.IsNullOrEmpty(serviceUrl))
118 {
119 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
120 serviceUrl = serviceUrl + '/';
121 m_serverUrl = serviceUrl;
122 m_Enabled = true;
123 }
124 }
125
126 if (String.IsNullOrEmpty(m_serverUrl))
127 m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
128 } 128 }
129 } 129 }
130
131 if (String.IsNullOrEmpty(m_serverUrl))
132 m_log.Info("[SIMIAN PRESENCE CONNECTOR]: No PresenceServerURI specified, disabling connector");
130 } 133 }
131 134
132 #region IPresenceService 135 #region IPresenceService
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
index deb8695..1ac9882 100644
--- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
+++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs
@@ -49,13 +49,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule 50 public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule
51 { 51 {
52 private const double CACHE_EXPIRATION_SECONDS = 120.0;
53
52 private static readonly ILog m_log = 54 private static readonly ILog m_log =
53 LogManager.GetLogger( 55 LogManager.GetLogger(
54 MethodBase.GetCurrentMethod().DeclaringType); 56 MethodBase.GetCurrentMethod().DeclaringType);
55 57
56 private string m_serverUrl = String.Empty; 58 private string m_serverUrl = String.Empty;
57 private ExpiringCache<UUID, UserAccount> m_accountCache; 59 private ExpiringCache<UUID, UserAccount> m_accountCache = new ExpiringCache<UUID,UserAccount>();
58 private bool m_Enabled = false; 60 private bool m_Enabled;
59 61
60 #region ISharedRegionModule 62 #region ISharedRegionModule
61 63
@@ -73,7 +75,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
73 75
74 public SimianUserAccountServiceConnector(IConfigSource source) 76 public SimianUserAccountServiceConnector(IConfigSource source)
75 { 77 {
76 Initialise(source); 78 CommonInit(source);
77 } 79 }
78 80
79 public void Initialise(IConfigSource source) 81 public void Initialise(IConfigSource source)
@@ -83,24 +85,27 @@ namespace OpenSim.Services.Connectors.SimianGrid
83 { 85 {
84 string name = moduleConfig.GetString("UserAccountServices", ""); 86 string name = moduleConfig.GetString("UserAccountServices", "");
85 if (name == Name) 87 if (name == Name)
86 { 88 CommonInit(source);
87 IConfig gridConfig = source.Configs["UserAccountService"]; 89 }
88 if (gridConfig != null) 90 }
89 {
90 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
91 if (!String.IsNullOrEmpty(serviceUrl))
92 {
93 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
94 serviceUrl = serviceUrl + '/';
95 m_serverUrl = serviceUrl;
96 m_Enabled = true;
97 }
98 }
99 91
100 if (String.IsNullOrEmpty(m_serverUrl)) 92 private void CommonInit(IConfigSource source)
101 m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector"); 93 {
94 IConfig gridConfig = source.Configs["UserAccountService"];
95 if (gridConfig != null)
96 {
97 string serviceUrl = gridConfig.GetString("UserAccountServerURI");
98 if (!String.IsNullOrEmpty(serviceUrl))
99 {
100 if (!serviceUrl.EndsWith("/") && !serviceUrl.EndsWith("="))
101 serviceUrl = serviceUrl + '/';
102 m_serverUrl = serviceUrl;
103 m_Enabled = true;
102 } 104 }
103 } 105 }
106
107 if (String.IsNullOrEmpty(m_serverUrl))
108 m_log.Info("[SIMIAN ACCOUNT CONNECTOR]: No UserAccountServerURI specified, disabling connector");
104 } 109 }
105 110
106 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName) 111 public UserAccount GetUserAccount(UUID scopeID, string firstName, string lastName)
@@ -138,7 +143,15 @@ namespace OpenSim.Services.Connectors.SimianGrid
138 { "UserID", userID.ToString() } 143 { "UserID", userID.ToString() }
139 }; 144 };
140 145
141 return GetUser(requestArgs); 146 account = GetUser(requestArgs);
147
148 if (account == null)
149 {
150 // Store null responses too, to avoid repeated lookups for missing accounts
151 m_accountCache.AddOrUpdate(userID, null, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
152 }
153
154 return account;
142 } 155 }
143 156
144 public List<UserAccount> GetUserAccounts(UUID scopeID, string query) 157 public List<UserAccount> GetUserAccounts(UUID scopeID, string query)
@@ -213,7 +226,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
213 if (success) 226 if (success)
214 { 227 {
215 // Cache the user account info 228 // Cache the user account info
216 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 229 m_accountCache.AddOrUpdate(data.PrincipalID, data, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
217 } 230 }
218 else 231 else
219 { 232 {
@@ -278,7 +291,7 @@ namespace OpenSim.Services.Connectors.SimianGrid
278 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName); 291 GetFirstLastName(response["Name"].AsString(), out account.FirstName, out account.LastName);
279 292
280 // Cache the user account info 293 // Cache the user account info
281 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromMinutes(2.0d)); 294 m_accountCache.AddOrUpdate(account.PrincipalID, account, DateTime.Now + TimeSpan.FromSeconds(CACHE_EXPIRATION_SECONDS));
282 295
283 return account; 296 return account;
284 } 297 }