diff options
author | Justin Clark-Casey (justincc) | 2013-03-15 22:42:34 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-03-15 22:42:34 +0000 |
commit | 45dee383db016d1840c468b594db28ea714493a5 (patch) | |
tree | 5f22ee4b8e9924210570a97ab39a9c33d6d5721b /OpenSim | |
parent | Migrate assets from chained asset service to xassetservice as they are reques... (diff) | |
download | opensim-SC-45dee383db016d1840c468b594db28ea714493a5.zip opensim-SC-45dee383db016d1840c468b594db28ea714493a5.tar.gz opensim-SC-45dee383db016d1840c468b594db28ea714493a5.tar.bz2 opensim-SC-45dee383db016d1840c468b594db28ea714493a5.tar.xz |
refactor: Reuse Get() method in AssetService to eliminate some copy/paste in other Get methods
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/AssetService/AssetService.cs | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 422fd0a..08fd3f8 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -123,29 +123,20 @@ namespace OpenSim.Services.AssetService | |||
123 | public virtual AssetMetadata GetMetadata(string id) | 123 | public virtual AssetMetadata GetMetadata(string id) |
124 | { | 124 | { |
125 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id); | 125 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset metadata for {0}", id); |
126 | |||
127 | UUID assetID; | ||
128 | 126 | ||
129 | if (!UUID.TryParse(id, out assetID)) | 127 | AssetBase asset = Get(id); |
130 | return null; | ||
131 | 128 | ||
132 | AssetBase asset = m_Database.GetAsset(assetID); | ||
133 | if (asset != null) | 129 | if (asset != null) |
134 | return asset.Metadata; | 130 | return asset.Metadata; |
135 | 131 | else | |
136 | return null; | 132 | return null; |
137 | } | 133 | } |
138 | 134 | ||
139 | public virtual byte[] GetData(string id) | 135 | public virtual byte[] GetData(string id) |
140 | { | 136 | { |
141 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id); | 137 | // m_log.DebugFormat("[ASSET SERVICE]: Get asset data for {0}", id); |
142 | |||
143 | UUID assetID; | ||
144 | 138 | ||
145 | if (!UUID.TryParse(id, out assetID)) | 139 | AssetBase asset = Get(id); |
146 | return null; | ||
147 | |||
148 | AssetBase asset = m_Database.GetAsset(assetID); | ||
149 | 140 | ||
150 | if (asset != null) | 141 | if (asset != null) |
151 | return asset.Data; | 142 | return asset.Data; |
@@ -156,17 +147,8 @@ namespace OpenSim.Services.AssetService | |||
156 | public virtual bool Get(string id, Object sender, AssetRetrieved handler) | 147 | public virtual bool Get(string id, Object sender, AssetRetrieved handler) |
157 | { | 148 | { |
158 | //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); | 149 | //m_log.DebugFormat("[AssetService]: Get asset async {0}", id); |
159 | |||
160 | UUID assetID; | ||
161 | 150 | ||
162 | if (!UUID.TryParse(id, out assetID)) | 151 | handler(id, sender, Get(id)); |
163 | return false; | ||
164 | |||
165 | AssetBase asset = m_Database.GetAsset(assetID); | ||
166 | |||
167 | //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); | ||
168 | |||
169 | handler(id, sender, asset); | ||
170 | 152 | ||
171 | return true; | 153 | return true; |
172 | } | 154 | } |