aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Services/AssetService/XAssetService.cs48
1 files changed, 20 insertions, 28 deletions
diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs
index 7dd48c9..8a2ca7c 100644
--- a/OpenSim/Services/AssetService/XAssetService.cs
+++ b/OpenSim/Services/AssetService/XAssetService.cs
@@ -106,11 +106,20 @@ namespace OpenSim.Services.AssetService
106 AssetBase asset = m_Database.GetAsset(assetID); 106 AssetBase asset = m_Database.GetAsset(assetID);
107 107
108 if (asset != null) 108 if (asset != null)
109 {
109 return asset; 110 return asset;
111 }
110 else if (HasChainedAssetService) 112 else if (HasChainedAssetService)
111 return m_ChainedAssetService.Get(id); 113 {
112 else 114 asset = m_ChainedAssetService.Get(id);
113 return null; 115
116 if (asset != null)
117 MigrateFromChainedService(asset);
118
119 return asset;
120 }
121
122 return null;
114 } 123 }
115 catch (Exception e) 124 catch (Exception e)
116 { 125 {
@@ -127,42 +136,23 @@ namespace OpenSim.Services.AssetService
127 public virtual AssetMetadata GetMetadata(string id) 136 public virtual AssetMetadata GetMetadata(string id)
128 { 137 {
129// m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id); 138// m_log.DebugFormat("[XASSET SERVICE]: Get asset metadata for {0}", id);
130
131 UUID assetID;
132 139
133 if (!UUID.TryParse(id, out assetID)) 140 AssetBase asset = Get(id);
134 return null;
135 141
136 AssetBase asset = m_Database.GetAsset(assetID);
137 if (asset != null) 142 if (asset != null)
138 {
139 return asset.Metadata; 143 return asset.Metadata;
140 }
141 else if (HasChainedAssetService)
142 {
143 return m_ChainedAssetService.GetMetadata(id);
144 }
145 else 144 else
146 {
147 return null; 145 return null;
148 }
149 } 146 }
150 147
151 public virtual byte[] GetData(string id) 148 public virtual byte[] GetData(string id)
152 { 149 {
153// m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id); 150// m_log.DebugFormat("[XASSET SERVICE]: Get asset data for {0}", id);
154 151
155 UUID assetID; 152 AssetBase asset = Get(id);
156
157 if (!UUID.TryParse(id, out assetID))
158 return null;
159
160 AssetBase asset = m_Database.GetAsset(assetID);
161 153
162 if (asset != null) 154 if (asset != null)
163 return asset.Data; 155 return asset.Data;
164 else if (HasChainedAssetService)
165 return m_ChainedAssetService.GetData(id);
166 else 156 else
167 return null; 157 return null;
168 } 158 }
@@ -176,10 +166,7 @@ namespace OpenSim.Services.AssetService
176 if (!UUID.TryParse(id, out assetID)) 166 if (!UUID.TryParse(id, out assetID))
177 return false; 167 return false;
178 168
179 AssetBase asset = m_Database.GetAsset(assetID); 169 AssetBase asset = Get(id);
180
181 if (asset == null && HasChainedAssetService)
182 asset = m_ChainedAssetService.Get(id);
183 170
184 //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset); 171 //m_log.DebugFormat("[XASSET SERVICE]: Got asset {0}", asset);
185 172
@@ -223,5 +210,10 @@ namespace OpenSim.Services.AssetService
223 210
224 return m_Database.Delete(id); 211 return m_Database.Delete(id);
225 } 212 }
213
214 private void MigrateFromChainedService(AssetBase asset)
215 {
216 Util.FireAndForget(o => { Store(asset); m_ChainedAssetService.Delete(asset.ID); });
217 }
226 } 218 }
227} \ No newline at end of file 219} \ No newline at end of file