diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index 5f34450..37a48bb 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -44,13 +44,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
44 | { | 44 | { |
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 46 | ||
47 | private IImprovedAssetCache m_Cache = null; | 47 | private IAssetCache m_Cache = null; |
48 | 48 | ||
49 | private IAssetService m_AssetService; | 49 | private IAssetService m_AssetService; |
50 | 50 | ||
51 | private bool m_Enabled = false; | 51 | private bool m_Enabled = false; |
52 | 52 | ||
53 | public Type ReplaceableInterface | 53 | public Type ReplaceableInterface |
54 | { | 54 | { |
55 | get { return null; } | 55 | get { return null; } |
56 | } | 56 | } |
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
128 | 128 | ||
129 | if (m_Cache == null) | 129 | if (m_Cache == null) |
130 | { | 130 | { |
131 | m_Cache = scene.RequestModuleInterface<IImprovedAssetCache>(); | 131 | m_Cache = scene.RequestModuleInterface<IAssetCache>(); |
132 | 132 | ||
133 | if (!(m_Cache is ISharedRegionModule)) | 133 | if (!(m_Cache is ISharedRegionModule)) |
134 | m_Cache = null; | 134 | m_Cache = null; |
@@ -155,10 +155,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
155 | public AssetBase Get(string id) | 155 | public AssetBase Get(string id) |
156 | { | 156 | { |
157 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id); | 157 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Synchronously requesting asset {0}", id); |
158 | 158 | ||
159 | AssetBase asset = null; | 159 | AssetBase asset = null; |
160 | if (m_Cache != null) | 160 | if (m_Cache != null) |
161 | asset = m_Cache.Get(id); | 161 | { |
162 | if (!m_Cache.Get(id, out asset)) | ||
163 | return null; | ||
164 | } | ||
162 | 165 | ||
163 | if (asset == null) | 166 | if (asset == null) |
164 | { | 167 | { |
@@ -169,7 +172,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
169 | // if (null == asset) | 172 | // if (null == asset) |
170 | // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); | 173 | // m_log.WarnFormat("[LOCAL ASSET SERVICES CONNECTOR]: Could not synchronously find asset with id {0}", id); |
171 | } | 174 | } |
172 | 175 | ||
173 | return asset; | 176 | return asset; |
174 | } | 177 | } |
175 | 178 | ||
@@ -177,23 +180,27 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
177 | { | 180 | { |
178 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); | 181 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Cache request for {0}", id); |
179 | 182 | ||
183 | AssetBase asset = null; | ||
180 | if (m_Cache != null) | 184 | if (m_Cache != null) |
181 | return m_Cache.Get(id); | 185 | m_Cache.Get(id, out asset); |
182 | 186 | ||
183 | return null; | 187 | return asset; |
184 | } | 188 | } |
185 | 189 | ||
186 | public AssetMetadata GetMetadata(string id) | 190 | public AssetMetadata GetMetadata(string id) |
187 | { | 191 | { |
188 | AssetBase asset = null; | 192 | AssetBase asset = null; |
189 | if (m_Cache != null) | 193 | if (m_Cache != null) |
190 | asset = m_Cache.Get(id); | 194 | { |
195 | if (!m_Cache.Get(id, out asset)) | ||
196 | return null; | ||
197 | } | ||
191 | 198 | ||
192 | if (asset != null) | 199 | if (asset != null) |
193 | return asset.Metadata; | 200 | return asset.Metadata; |
194 | 201 | ||
195 | asset = m_AssetService.Get(id); | 202 | asset = m_AssetService.Get(id); |
196 | if (asset != null) | 203 | if (asset != null) |
197 | { | 204 | { |
198 | if (m_Cache != null) | 205 | if (m_Cache != null) |
199 | m_Cache.Cache(asset); | 206 | m_Cache.Cache(asset); |
@@ -210,7 +217,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
210 | AssetBase asset = null; | 217 | AssetBase asset = null; |
211 | 218 | ||
212 | if (m_Cache != null) | 219 | if (m_Cache != null) |
213 | asset = m_Cache.Get(id); | 220 | { |
221 | if (!m_Cache.Get(id, out asset)) | ||
222 | return null; | ||
223 | } | ||
214 | 224 | ||
215 | if (asset != null) | 225 | if (asset != null) |
216 | return asset.Data; | 226 | return asset.Data; |
@@ -229,10 +239,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
229 | public bool Get(string id, Object sender, AssetRetrieved handler) | 239 | public bool Get(string id, Object sender, AssetRetrieved handler) |
230 | { | 240 | { |
231 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); | 241 | // m_log.DebugFormat("[LOCAL ASSET SERVICES CONNECTOR]: Asynchronously requesting asset {0}", id); |
232 | 242 | ||
233 | if (m_Cache != null) | 243 | if (m_Cache != null) |
234 | { | 244 | { |
235 | AssetBase asset = m_Cache.Get(id); | 245 | AssetBase asset; |
246 | if (!m_Cache.Get(id, out asset)) | ||
247 | return false; | ||
236 | 248 | ||
237 | if (asset != null) | 249 | if (asset != null) |
238 | { | 250 | { |
@@ -264,7 +276,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
264 | { | 276 | { |
265 | if (m_Cache != null) | 277 | if (m_Cache != null) |
266 | m_Cache.Cache(asset); | 278 | m_Cache.Cache(asset); |
267 | 279 | ||
268 | if (asset.Local) | 280 | if (asset.Local) |
269 | { | 281 | { |
270 | // m_log.DebugFormat( | 282 | // m_log.DebugFormat( |
@@ -278,7 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
278 | // m_log.DebugFormat( | 290 | // m_log.DebugFormat( |
279 | // "[LOCAL ASSET SERVICE CONNECTOR]: Passing {0} {1} on to asset service for storage, status Temporary = {2}, Local = {3}", | 291 | // "[LOCAL ASSET SERVICE CONNECTOR]: Passing {0} {1} on to asset service for storage, status Temporary = {2}, Local = {3}", |
280 | // asset.Name, asset.ID, asset.Temporary, asset.Local); | 292 | // asset.Name, asset.ID, asset.Temporary, asset.Local); |
281 | 293 | ||
282 | return m_AssetService.Store(asset); | 294 | return m_AssetService.Store(asset); |
283 | } | 295 | } |
284 | } | 296 | } |
@@ -287,7 +299,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
287 | { | 299 | { |
288 | AssetBase asset = null; | 300 | AssetBase asset = null; |
289 | if (m_Cache != null) | 301 | if (m_Cache != null) |
290 | m_Cache.Get(id); | 302 | m_Cache.Get(id, out asset); |
291 | if (asset != null) | 303 | if (asset != null) |
292 | { | 304 | { |
293 | asset.Data = data; | 305 | asset.Data = data; |