diff options
author | Melanie Thielker | 2009-05-10 16:51:14 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-05-10 16:51:14 +0000 |
commit | 65c0996a9cfe1a4dbddad5493d58ddda1ef8a9a6 (patch) | |
tree | 34902bf98eeecdb59975dbfee93d400cc857e06f /OpenSim | |
parent | Create SynchronousRestObjectRequester and make SynchronousRestObjectPoster (diff) | |
download | opensim-SC-65c0996a9cfe1a4dbddad5493d58ddda1ef8a9a6.zip opensim-SC-65c0996a9cfe1a4dbddad5493d58ddda1ef8a9a6.tar.gz opensim-SC-65c0996a9cfe1a4dbddad5493d58ddda1ef8a9a6.tar.bz2 opensim-SC-65c0996a9cfe1a4dbddad5493d58ddda1ef8a9a6.tar.xz |
Use the new async handling class to actually make the new asset service's
async request perform asynchronously
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs | 46 |
1 files changed, 34 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs index 667840f..c409d15 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/RemoteAssetServiceConnector.cs | |||
@@ -141,8 +141,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
141 | 141 | ||
142 | if (asset == null) | 142 | if (asset == null) |
143 | { | 143 | { |
144 | asset = SynchronousRestObjectPoster. | 144 | asset = SynchronousRestObjectRequester. |
145 | BeginPostObject<int, AssetBase>("GET", uri, 0); | 145 | MakeRequest<int, AssetBase>("GET", uri, 0); |
146 | 146 | ||
147 | if (m_Cache != null) | 147 | if (m_Cache != null) |
148 | m_Cache.Cache(asset); | 148 | m_Cache.Cache(asset); |
@@ -162,8 +162,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
162 | 162 | ||
163 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; | 163 | string uri = m_ServerURI + "/assets/" + id + "/metadata"; |
164 | 164 | ||
165 | AssetMetadata asset = SynchronousRestObjectPoster. | 165 | AssetMetadata asset = SynchronousRestObjectRequester. |
166 | BeginPostObject<int, AssetMetadata>("GET", uri, 0); | 166 | MakeRequest<int, AssetMetadata>("GET", uri, 0); |
167 | return asset; | 167 | return asset; |
168 | } | 168 | } |
169 | 169 | ||
@@ -202,16 +202,38 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
202 | 202 | ||
203 | public bool Get(string id, Object sender, AssetRetrieved handler) | 203 | public bool Get(string id, Object sender, AssetRetrieved handler) |
204 | { | 204 | { |
205 | AssetBase asset = Get(id); | 205 | string uri = m_ServerURI + "/assets/" + id; |
206 | handler(id, sender, asset); | 206 | |
207 | AssetBase asset = null; | ||
208 | if (m_Cache != null) | ||
209 | asset = m_Cache.Get(id); | ||
210 | |||
211 | if (asset == null) | ||
212 | { | ||
213 | AsynchronousRestObjectRequester. | ||
214 | MakeRequest<int, AssetBase>("GET", uri, 0, | ||
215 | delegate(AssetBase a) | ||
216 | { | ||
217 | if (m_Cache != null) | ||
218 | m_Cache.Cache(a); | ||
219 | handler(id, sender, a); | ||
220 | }); | ||
221 | |||
222 | } | ||
223 | else | ||
224 | { | ||
225 | handler(id, sender, asset); | ||
226 | } | ||
227 | |||
207 | return true; | 228 | return true; |
208 | } | 229 | } |
230 | |||
209 | public string Store(AssetBase asset) | 231 | public string Store(AssetBase asset) |
210 | { | 232 | { |
211 | string uri = m_ServerURI + "/assets/"; | 233 | string uri = m_ServerURI + "/assets/"; |
212 | 234 | ||
213 | string newID = SynchronousRestObjectPoster. | 235 | string newID = SynchronousRestObjectRequester. |
214 | BeginPostObject<AssetBase, string>("POST", uri, asset); | 236 | MakeRequest<AssetBase, string>("POST", uri, asset); |
215 | 237 | ||
216 | if (newID != String.Empty) | 238 | if (newID != String.Empty) |
217 | { | 239 | { |
@@ -241,8 +263,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
241 | 263 | ||
242 | string uri = m_ServerURI + "/assets/" + id; | 264 | string uri = m_ServerURI + "/assets/" + id; |
243 | 265 | ||
244 | if (SynchronousRestObjectPoster. | 266 | if (SynchronousRestObjectRequester. |
245 | BeginPostObject<AssetBase, bool>("POST", uri, asset)) | 267 | MakeRequest<AssetBase, bool>("POST", uri, asset)) |
246 | { | 268 | { |
247 | if (m_Cache != null) | 269 | if (m_Cache != null) |
248 | m_Cache.Cache(asset); | 270 | m_Cache.Cache(asset); |
@@ -256,8 +278,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset | |||
256 | { | 278 | { |
257 | string uri = m_ServerURI + "/assets/" + id; | 279 | string uri = m_ServerURI + "/assets/" + id; |
258 | 280 | ||
259 | if (SynchronousRestObjectPoster. | 281 | if (SynchronousRestObjectRequester. |
260 | BeginPostObject<int, bool>("DELETE", uri, 0)) | 282 | MakeRequest<int, bool>("DELETE", uri, 0)) |
261 | { | 283 | { |
262 | if (m_Cache != null) | 284 | if (m_Cache != null) |
263 | m_Cache.Expire(id); | 285 | m_Cache.Expire(id); |