diff options
author | Diva Canto | 2009-08-19 17:36:34 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-19 17:36:34 -0700 |
commit | a3db2936f7b9297815244d39cdb33c26d17c70e2 (patch) | |
tree | 6f5c6626f94f878a020412f348dcbc51aadd2312 /OpenSim | |
parent | Fixes GetItem and GetFolder for SQLite. Turns out some methods were no-op in ... (diff) | |
parent | Fixing a spot I missed in assets. Switching Grid to the new naming schema wit... (diff) | |
download | opensim-SC_OLD-a3db2936f7b9297815244d39cdb33c26d17c70e2.zip opensim-SC_OLD-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.gz opensim-SC_OLD-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.bz2 opensim-SC_OLD-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to '')
24 files changed, 115 insertions, 164 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index f723ebf..5deb44e 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs | |||
@@ -36,15 +36,9 @@ namespace OpenSim.Data | |||
36 | { | 36 | { |
37 | public abstract class AssetDataBase : IAssetDataPlugin | 37 | public abstract class AssetDataBase : IAssetDataPlugin |
38 | { | 38 | { |
39 | public virtual AssetBase FetchAsset(UUID uuid) | 39 | public abstract AssetBase GetAsset(UUID uuid); |
40 | { | ||
41 | return FetchStoredAsset(uuid); | ||
42 | } | ||
43 | |||
44 | protected abstract AssetBase FetchStoredAsset(UUID uuid); | ||
45 | 40 | ||
46 | public abstract void CreateAsset(AssetBase asset); | 41 | public abstract void StoreAsset(AssetBase asset); |
47 | public abstract void UpdateAsset(AssetBase asset); | ||
48 | public abstract bool ExistsAsset(UUID uuid); | 42 | public abstract bool ExistsAsset(UUID uuid); |
49 | 43 | ||
50 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); | 44 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); |
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs index 5a30455..a03488b 100644 --- a/OpenSim/Data/GridDataBase.cs +++ b/OpenSim/Data/GridDataBase.cs | |||
@@ -38,9 +38,8 @@ namespace OpenSim.Data | |||
38 | public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); | 38 | public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); |
39 | public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); | 39 | public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); |
40 | public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); | 40 | public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); |
41 | public abstract DataResponse AddProfile(RegionProfileData profile); | 41 | public abstract DataResponse StoreProfile(RegionProfileData profile); |
42 | public abstract ReservationData GetReservationAtPoint(uint x, uint y); | 42 | public abstract ReservationData GetReservationAtPoint(uint x, uint y); |
43 | public abstract DataResponse UpdateProfile(RegionProfileData profile); | ||
44 | public abstract DataResponse DeleteProfile(string uuid); | 43 | public abstract DataResponse DeleteProfile(string uuid); |
45 | 44 | ||
46 | public abstract void Initialise(); | 45 | public abstract void Initialise(); |
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index d13732b..2149bca 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs | |||
@@ -33,9 +33,8 @@ namespace OpenSim.Data | |||
33 | { | 33 | { |
34 | public interface IAssetDataPlugin : IPlugin | 34 | public interface IAssetDataPlugin : IPlugin |
35 | { | 35 | { |
36 | AssetBase FetchAsset(UUID uuid); | 36 | AssetBase GetAsset(UUID uuid); |
37 | void CreateAsset(AssetBase asset); | 37 | void StoreAsset(AssetBase asset); |
38 | void UpdateAsset(AssetBase asset); | ||
39 | bool ExistsAsset(UUID uuid); | 38 | bool ExistsAsset(UUID uuid); |
40 | List<AssetMetadata> FetchAssetMetadataSet(int start, int count); | 39 | List<AssetMetadata> FetchAssetMetadataSet(int start, int count); |
41 | void Initialise(string connect); | 40 | void Initialise(string connect); |
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs index 4bf8646..8bd3811 100644 --- a/OpenSim/Data/IGridData.cs +++ b/OpenSim/Data/IGridData.cs | |||
@@ -99,18 +99,11 @@ namespace OpenSim.Data | |||
99 | bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); | 99 | bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Adds a new profile to the database | 102 | /// Adds or updates a profile in the database |
103 | /// </summary> | 103 | /// </summary> |
104 | /// <param name="profile">The profile to add</param> | 104 | /// <param name="profile">The profile to add</param> |
105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> | 105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> |
106 | DataResponse AddProfile(RegionProfileData profile); | 106 | DataResponse StoreProfile(RegionProfileData profile); |
107 | |||
108 | /// <summary> | ||
109 | /// Updates a profile in the database | ||
110 | /// </summary> | ||
111 | /// <param name="profile"></param> | ||
112 | /// <returns></returns> | ||
113 | DataResponse UpdateProfile(RegionProfileData profile); | ||
114 | 107 | ||
115 | /// <summary> | 108 | /// <summary> |
116 | /// Remove a profile from the database | 109 | /// Remove a profile from the database |
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index a542584..d193cf5 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -122,7 +122,7 @@ namespace OpenSim.Data.MSSQL | |||
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="assetID">the asset UUID</param> | 123 | /// <param name="assetID">the asset UUID</param> |
124 | /// <returns></returns> | 124 | /// <returns></returns> |
125 | override protected AssetBase FetchStoredAsset(UUID assetID) | 125 | override public AssetBase GetAsset(UUID assetID) |
126 | { | 126 | { |
127 | string sql = "SELECT * FROM assets WHERE id = @id"; | 127 | string sql = "SELECT * FROM assets WHERE id = @id"; |
128 | using (AutoClosingSqlCommand command = m_database.Query(sql)) | 128 | using (AutoClosingSqlCommand command = m_database.Query(sql)) |
@@ -152,7 +152,16 @@ namespace OpenSim.Data.MSSQL | |||
152 | /// Create asset in m_database | 152 | /// Create asset in m_database |
153 | /// </summary> | 153 | /// </summary> |
154 | /// <param name="asset">the asset</param> | 154 | /// <param name="asset">the asset</param> |
155 | override public void CreateAsset(AssetBase asset) | 155 | override public void StoreAsset(AssetBase asset) |
156 | { | ||
157 | if (ExistsAsset(asset.FullID)) | ||
158 | UpdateAsset(asset); | ||
159 | else | ||
160 | InsertAsset(asset); | ||
161 | } | ||
162 | |||
163 | |||
164 | private void InsertAsset(AssetBase asset) | ||
156 | { | 165 | { |
157 | if (ExistsAsset(asset.FullID)) | 166 | if (ExistsAsset(asset.FullID)) |
158 | { | 167 | { |
@@ -208,7 +217,7 @@ namespace OpenSim.Data.MSSQL | |||
208 | /// Update asset in m_database | 217 | /// Update asset in m_database |
209 | /// </summary> | 218 | /// </summary> |
210 | /// <param name="asset">the asset</param> | 219 | /// <param name="asset">the asset</param> |
211 | override public void UpdateAsset(AssetBase asset) | 220 | private void UpdateAsset(AssetBase asset) |
212 | { | 221 | { |
213 | string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType, | 222 | string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType, |
214 | local = @local, temporary = @temporary, data = @data | 223 | local = @local, temporary = @temporary, data = @data |
@@ -250,7 +259,7 @@ namespace OpenSim.Data.MSSQL | |||
250 | } | 259 | } |
251 | } | 260 | } |
252 | 261 | ||
253 | // Commented out since currently unused - this probably should be called in FetchAsset() | 262 | // Commented out since currently unused - this probably should be called in GetAsset() |
254 | // private void UpdateAccessTime(AssetBase asset) | 263 | // private void UpdateAccessTime(AssetBase asset) |
255 | // { | 264 | // { |
256 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) | 265 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) |
@@ -276,7 +285,7 @@ namespace OpenSim.Data.MSSQL | |||
276 | /// <returns>true if exist.</returns> | 285 | /// <returns>true if exist.</returns> |
277 | override public bool ExistsAsset(UUID uuid) | 286 | override public bool ExistsAsset(UUID uuid) |
278 | { | 287 | { |
279 | if (FetchAsset(uuid) != null) | 288 | if (GetAsset(uuid) != null) |
280 | { | 289 | { |
281 | return true; | 290 | return true; |
282 | } | 291 | } |
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs index 0ebbf4e..8a3d332 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs | |||
@@ -272,26 +272,23 @@ namespace OpenSim.Data.MSSQL | |||
272 | /// </summary> | 272 | /// </summary> |
273 | /// <param name="profile">The profile to add</param> | 273 | /// <param name="profile">The profile to add</param> |
274 | /// <returns>A dataresponse enum indicating success</returns> | 274 | /// <returns>A dataresponse enum indicating success</returns> |
275 | override public DataResponse AddProfile(RegionProfileData profile) | 275 | override public DataResponse StoreProfile(RegionProfileData profile) |
276 | { | 276 | { |
277 | if (InsertRegionRow(profile)) | 277 | if (GetProfileByUUID(profile.UUID) == null) |
278 | { | 278 | { |
279 | return DataResponse.RESPONSE_OK; | 279 | if (InsertRegionRow(profile)) |
280 | { | ||
281 | return DataResponse.RESPONSE_OK; | ||
282 | } | ||
280 | } | 283 | } |
281 | return DataResponse.RESPONSE_ERROR; | 284 | else |
282 | } | ||
283 | |||
284 | /// <summary> | ||
285 | /// Update the specified region in the database | ||
286 | /// </summary> | ||
287 | /// <param name="profile">The profile to update</param> | ||
288 | /// <returns>A dataresponse enum indicating success</returns> | ||
289 | override public DataResponse UpdateProfile(RegionProfileData profile) | ||
290 | { | ||
291 | if (UpdateRegionRow(profile)) | ||
292 | { | 285 | { |
293 | return DataResponse.RESPONSE_OK; | 286 | if (UpdateRegionRow(profile)) |
287 | { | ||
288 | return DataResponse.RESPONSE_OK; | ||
289 | } | ||
294 | } | 290 | } |
291 | |||
295 | return DataResponse.RESPONSE_ERROR; | 292 | return DataResponse.RESPONSE_ERROR; |
296 | } | 293 | } |
297 | 294 | ||
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 0865083..1b4377a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -135,7 +135,7 @@ namespace OpenSim.Data.MySQL | |||
135 | /// <param name="assetID">Asset UUID to fetch</param> | 135 | /// <param name="assetID">Asset UUID to fetch</param> |
136 | /// <returns>Return the asset</returns> | 136 | /// <returns>Return the asset</returns> |
137 | /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks> | 137 | /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks> |
138 | override protected AssetBase FetchStoredAsset(UUID assetID) | 138 | override public AssetBase GetAsset(UUID assetID) |
139 | { | 139 | { |
140 | AssetBase asset = null; | 140 | AssetBase asset = null; |
141 | lock (_dbConnection) | 141 | lock (_dbConnection) |
@@ -192,7 +192,7 @@ namespace OpenSim.Data.MySQL | |||
192 | /// </summary> | 192 | /// </summary> |
193 | /// <param name="asset">Asset UUID to create</param> | 193 | /// <param name="asset">Asset UUID to create</param> |
194 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 194 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
195 | override public void CreateAsset(AssetBase asset) | 195 | override public void StoreAsset(AssetBase asset) |
196 | { | 196 | { |
197 | lock (_dbConnection) | 197 | lock (_dbConnection) |
198 | { | 198 | { |
@@ -285,15 +285,6 @@ namespace OpenSim.Data.MySQL | |||
285 | } | 285 | } |
286 | 286 | ||
287 | /// <summary> | 287 | /// <summary> |
288 | /// Update a asset in database, see <see cref="CreateAsset"/> | ||
289 | /// </summary> | ||
290 | /// <param name="asset">Asset UUID to update</param> | ||
291 | override public void UpdateAsset(AssetBase asset) | ||
292 | { | ||
293 | CreateAsset(asset); | ||
294 | } | ||
295 | |||
296 | /// <summary> | ||
297 | /// check if the asset UUID exist in database | 288 | /// check if the asset UUID exist in database |
298 | /// </summary> | 289 | /// </summary> |
299 | /// <param name="uuid">The asset UUID</param> | 290 | /// <param name="uuid">The asset UUID</param> |
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs index 0a5800b..1ec2609 100644 --- a/OpenSim/Data/MySQL/MySQLGridData.cs +++ b/OpenSim/Data/MySQL/MySQLGridData.cs | |||
@@ -391,7 +391,7 @@ namespace OpenSim.Data.MySQL | |||
391 | /// </summary> | 391 | /// </summary> |
392 | /// <param name="profile">The profile to add</param> | 392 | /// <param name="profile">The profile to add</param> |
393 | /// <returns>Successful?</returns> | 393 | /// <returns>Successful?</returns> |
394 | override public DataResponse AddProfile(RegionProfileData profile) | 394 | override public DataResponse StoreProfile(RegionProfileData profile) |
395 | { | 395 | { |
396 | MySQLSuperManager dbm = GetLockedConnection(); | 396 | MySQLSuperManager dbm = GetLockedConnection(); |
397 | try { | 397 | try { |
@@ -408,17 +408,6 @@ namespace OpenSim.Data.MySQL | |||
408 | } | 408 | } |
409 | 409 | ||
410 | /// <summary> | 410 | /// <summary> |
411 | /// Update a sim profile | ||
412 | /// </summary> | ||
413 | /// <param name="profile">The profile to update</param> | ||
414 | /// <returns>Sucessful?</returns> | ||
415 | /// <remarks>Same as AddProfile</remarks> | ||
416 | override public DataResponse UpdateProfile(RegionProfileData profile) | ||
417 | { | ||
418 | return AddProfile(profile); | ||
419 | } | ||
420 | |||
421 | /// <summary> | ||
422 | /// Deletes a sim profile from the database | 411 | /// Deletes a sim profile from the database |
423 | /// </summary> | 412 | /// </summary> |
424 | /// <param name="uuid">the sim UUID</param> | 413 | /// <param name="uuid">the sim UUID</param> |
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 9d8cec5..aaba15c 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -65,30 +65,24 @@ namespace OpenSim.Data.NHibernate | |||
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | override protected AssetBase FetchStoredAsset(UUID uuid) | 68 | override public AssetBase GetAsset(UUID uuid) |
69 | { | 69 | { |
70 | return (AssetBase)manager.Get(typeof(AssetBase), uuid); | 70 | return (AssetBase)manager.Get(typeof(AssetBase), uuid); |
71 | } | 71 | } |
72 | 72 | ||
73 | private void Save(AssetBase asset) | 73 | override public void StoreAsset(AssetBase asset) |
74 | { | 74 | { |
75 | AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID); | 75 | AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID); |
76 | if (temp == null) | 76 | if (temp == null) |
77 | { | 77 | { |
78 | m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); | ||
78 | manager.Insert(asset); | 79 | manager.Insert(asset); |
79 | } | 80 | } |
80 | } | 81 | else |
81 | 82 | { | |
82 | override public void CreateAsset(AssetBase asset) | 83 | m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); |
83 | { | 84 | manager.Update(asset); |
84 | m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); | 85 | } |
85 | Save(asset); | ||
86 | } | ||
87 | |||
88 | override public void UpdateAsset(AssetBase asset) | ||
89 | { | ||
90 | m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); | ||
91 | manager.Update(asset); | ||
92 | } | 86 | } |
93 | 87 | ||
94 | // private void LogAssetLoad(AssetBase asset) | 88 | // private void LogAssetLoad(AssetBase asset) |
@@ -107,7 +101,7 @@ namespace OpenSim.Data.NHibernate | |||
107 | override public bool ExistsAsset(UUID uuid) | 101 | override public bool ExistsAsset(UUID uuid) |
108 | { | 102 | { |
109 | m_log.InfoFormat("[NHIBERNATE] ExistsAsset: {0}", uuid); | 103 | m_log.InfoFormat("[NHIBERNATE] ExistsAsset: {0}", uuid); |
110 | return (FetchAsset(uuid) != null); | 104 | return (GetAsset(uuid) != null); |
111 | } | 105 | } |
112 | 106 | ||
113 | /// <summary> | 107 | /// <summary> |
diff --git a/OpenSim/Data/NHibernate/NHibernateGridData.cs b/OpenSim/Data/NHibernate/NHibernateGridData.cs index fe8da59..018af62 100644 --- a/OpenSim/Data/NHibernate/NHibernateGridData.cs +++ b/OpenSim/Data/NHibernate/NHibernateGridData.cs | |||
@@ -117,7 +117,7 @@ namespace OpenSim.Data.NHibernate | |||
117 | throw new NotImplementedException(); | 117 | throw new NotImplementedException(); |
118 | } | 118 | } |
119 | 119 | ||
120 | public override DataResponse AddProfile(RegionProfileData profile) | 120 | public override DataResponse StoreProfile(RegionProfileData profile) |
121 | { | 121 | { |
122 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) | 122 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) |
123 | { | 123 | { |
@@ -126,21 +126,9 @@ namespace OpenSim.Data.NHibernate | |||
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
129 | return DataResponse.RESPONSE_ERROR; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public override DataResponse UpdateProfile(RegionProfileData profile) | ||
134 | { | ||
135 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null) | ||
136 | { | ||
137 | manager.Update(profile); | 129 | manager.Update(profile); |
138 | return DataResponse.RESPONSE_OK; | 130 | return DataResponse.RESPONSE_OK; |
139 | } | 131 | } |
140 | else | ||
141 | { | ||
142 | return DataResponse.RESPONSE_ERROR; | ||
143 | } | ||
144 | } | 132 | } |
145 | 133 | ||
146 | public override DataResponse DeleteProfile(string uuid) | 134 | public override DataResponse DeleteProfile(string uuid) |
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 72af7a0..3831467 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite | |||
90 | /// </summary> | 90 | /// </summary> |
91 | /// <param name="uuid">UUID of ... ?</param> | 91 | /// <param name="uuid">UUID of ... ?</param> |
92 | /// <returns>Asset base</returns> | 92 | /// <returns>Asset base</returns> |
93 | override protected AssetBase FetchStoredAsset(UUID uuid) | 93 | override public AssetBase GetAsset(UUID uuid) |
94 | { | 94 | { |
95 | lock (this) | 95 | lock (this) |
96 | { | 96 | { |
@@ -119,18 +119,16 @@ namespace OpenSim.Data.SQLite | |||
119 | /// Create an asset | 119 | /// Create an asset |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="asset">Asset Base</param> | 121 | /// <param name="asset">Asset Base</param> |
122 | override public void CreateAsset(AssetBase asset) | 122 | override public void StoreAsset(AssetBase asset) |
123 | { | 123 | { |
124 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 124 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
125 | if (ExistsAsset(asset.FullID)) | 125 | if (ExistsAsset(asset.FullID)) |
126 | { | 126 | { |
127 | //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); | 127 | LogAssetLoad(asset); |
128 | } | 128 | |
129 | else | ||
130 | { | ||
131 | lock (this) | 129 | lock (this) |
132 | { | 130 | { |
133 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 131 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
134 | { | 132 | { |
135 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 133 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
136 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 134 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
@@ -144,29 +142,22 @@ namespace OpenSim.Data.SQLite | |||
144 | } | 142 | } |
145 | } | 143 | } |
146 | } | 144 | } |
147 | } | 145 | else |
148 | |||
149 | /// <summary> | ||
150 | /// Update an asset | ||
151 | /// </summary> | ||
152 | /// <param name="asset"></param> | ||
153 | override public void UpdateAsset(AssetBase asset) | ||
154 | { | ||
155 | LogAssetLoad(asset); | ||
156 | |||
157 | lock (this) | ||
158 | { | 146 | { |
159 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 147 | lock (this) |
160 | { | 148 | { |
161 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 149 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
162 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 150 | { |
163 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 151 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
164 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 152 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
165 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 153 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); |
166 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 154 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
167 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 155 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
168 | 156 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | |
169 | cmd.ExecuteNonQuery(); | 157 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
158 | |||
159 | cmd.ExecuteNonQuery(); | ||
160 | } | ||
170 | } | 161 | } |
171 | } | 162 | } |
172 | } | 163 | } |
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs index 4107594..18abb88 100644 --- a/OpenSim/Data/SQLite/SQLiteGridData.cs +++ b/OpenSim/Data/SQLite/SQLiteGridData.cs | |||
@@ -203,7 +203,7 @@ namespace OpenSim.Data.SQLite | |||
203 | /// </summary> | 203 | /// </summary> |
204 | /// <param name="profile">The profile to add</param> | 204 | /// <param name="profile">The profile to add</param> |
205 | /// <returns>A dataresponse enum indicating success</returns> | 205 | /// <returns>A dataresponse enum indicating success</returns> |
206 | override public DataResponse AddProfile(RegionProfileData profile) | 206 | override public DataResponse StoreProfile(RegionProfileData profile) |
207 | { | 207 | { |
208 | if (database.insertRow(profile)) | 208 | if (database.insertRow(profile)) |
209 | { | 209 | { |
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | override public DataResponse UpdateProfile(RegionProfileData profile) | 218 | /// <summary> |
219 | { | ||
220 | return AddProfile(profile); | ||
221 | } | ||
222 | |||
223 | /// <summary> | ||
224 | /// Deletes a sim profile from the database | 219 | /// Deletes a sim profile from the database |
225 | /// </summary> | 220 | /// </summary> |
226 | /// <param name="uuid">the sim UUID</param> | 221 | /// <param name="uuid">the sim UUID</param> |
227 | /// <returns>Successful?</returns> | 222 | /// <returns>Successful?</returns> |
228 | //public DataResponse DeleteProfile(RegionProfileData profile) | ||
229 | override public DataResponse DeleteProfile(string uuid) | 223 | override public DataResponse DeleteProfile(string uuid) |
230 | { | 224 | { |
231 | Dictionary<string, string> param = new Dictionary<string, string>(); | 225 | Dictionary<string, string> param = new Dictionary<string, string>(); |
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 09131c1..1969d76 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -84,34 +84,34 @@ namespace OpenSim.Data.Tests | |||
84 | scrambler.Scramble(a2); | 84 | scrambler.Scramble(a2); |
85 | scrambler.Scramble(a3); | 85 | scrambler.Scramble(a3); |
86 | 86 | ||
87 | db.CreateAsset(a1); | 87 | db.StoreAsset(a1); |
88 | db.CreateAsset(a2); | 88 | db.StoreAsset(a2); |
89 | db.CreateAsset(a3); | 89 | db.StoreAsset(a3); |
90 | 90 | ||
91 | AssetBase a1a = db.FetchAsset(uuid1); | 91 | AssetBase a1a = db.GetAsset(uuid1); |
92 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); | 92 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); |
93 | 93 | ||
94 | AssetBase a2a = db.FetchAsset(uuid2); | 94 | AssetBase a2a = db.GetAsset(uuid2); |
95 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); | 95 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); |
96 | 96 | ||
97 | AssetBase a3a = db.FetchAsset(uuid3); | 97 | AssetBase a3a = db.GetAsset(uuid3); |
98 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); | 98 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); |
99 | 99 | ||
100 | scrambler.Scramble(a1a); | 100 | scrambler.Scramble(a1a); |
101 | scrambler.Scramble(a2a); | 101 | scrambler.Scramble(a2a); |
102 | scrambler.Scramble(a3a); | 102 | scrambler.Scramble(a3a); |
103 | 103 | ||
104 | db.UpdateAsset(a1a); | 104 | db.StoreAsset(a1a); |
105 | db.UpdateAsset(a2a); | 105 | db.StoreAsset(a2a); |
106 | db.UpdateAsset(a3a); | 106 | db.StoreAsset(a3a); |
107 | 107 | ||
108 | AssetBase a1b = db.FetchAsset(uuid1); | 108 | AssetBase a1b = db.GetAsset(uuid1); |
109 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); | 109 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); |
110 | 110 | ||
111 | AssetBase a2b = db.FetchAsset(uuid2); | 111 | AssetBase a2b = db.GetAsset(uuid2); |
112 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); | 112 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); |
113 | 113 | ||
114 | AssetBase a3b = db.FetchAsset(uuid3); | 114 | AssetBase a3b = db.GetAsset(uuid3); |
115 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); | 115 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); |
116 | 116 | ||
117 | Assert.That(db.ExistsAsset(uuid1), Is.True); | 117 | Assert.That(db.ExistsAsset(uuid1), Is.True); |
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs index de8fb48..df6c669 100644 --- a/OpenSim/Data/Tests/BasicGridTest.cs +++ b/OpenSim/Data/Tests/BasicGridTest.cs | |||
@@ -70,7 +70,7 @@ namespace OpenSim.Data.Tests | |||
70 | reg.Uuid = regionUUID; | 70 | reg.Uuid = regionUUID; |
71 | reg.RegionName = regionName; | 71 | reg.RegionName = regionName; |
72 | 72 | ||
73 | db.AddProfile(reg); | 73 | db.StoreProfile(reg); |
74 | 74 | ||
75 | return reg; | 75 | return reg; |
76 | } | 76 | } |
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests | |||
120 | RegionProfileData retreg = db.GetProfileByUUID(region2); | 120 | RegionProfileData retreg = db.GetProfileByUUID(region2); |
121 | retreg.regionName = "Gotham City"; | 121 | retreg.regionName = "Gotham City"; |
122 | 122 | ||
123 | db.UpdateProfile(retreg); | 123 | db.StoreProfile(retreg); |
124 | 124 | ||
125 | retreg = db.GetProfileByUUID(region2); | 125 | retreg = db.GetProfileByUUID(region2); |
126 | Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); | 126 | Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); |
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests | |||
135 | retreg.RegionName = "Gotham Town"; | 135 | retreg.RegionName = "Gotham Town"; |
136 | retreg.Uuid = region1; | 136 | retreg.Uuid = region1; |
137 | 137 | ||
138 | db.AddProfile(retreg); | 138 | db.StoreProfile(retreg); |
139 | 139 | ||
140 | retreg = db.GetProfileByUUID(region2); | 140 | retreg = db.GetProfileByUUID(region2); |
141 | retreg.RegionName = "Gothan Town"; | 141 | retreg.RegionName = "Gothan Town"; |
142 | retreg.Uuid = region3; | 142 | retreg.Uuid = region3; |
143 | 143 | ||
144 | db.AddProfile(retreg); | 144 | db.StoreProfile(retreg); |
145 | 145 | ||
146 | List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); | 146 | List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); |
147 | 147 | ||
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index c9f5236..7f1c7e9 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -184,7 +184,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
184 | // Commented out for now. The implementation needs to be improved by protecting against race conditions, | 184 | // Commented out for now. The implementation needs to be improved by protecting against race conditions, |
185 | // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via | 185 | // probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via |
186 | // returning a read only class from the cache). | 186 | // returning a read only class from the cache). |
187 | // public bool UpdateProfile(UserProfileData userProfile) | 187 | // public bool StoreProfile(UserProfileData userProfile) |
188 | // { | 188 | // { |
189 | // lock (m_userProfilesById) | 189 | // lock (m_userProfilesById) |
190 | // { | 190 | // { |
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 670c9ff..933fa12 100644 --- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
@@ -110,14 +110,14 @@ namespace OpenSim.Framework.Communications.Tests | |||
110 | IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; | 110 | IUserDataPlugin userDataPlugin = commsManager.UserDataPlugin; |
111 | 111 | ||
112 | // Check that we can't update info before it exists | 112 | // Check that we can't update info before it exists |
113 | Assert.That(userCacheService.UpdateProfile(newProfile), Is.False); | 113 | Assert.That(userCacheService.StoreProfile(newProfile), Is.False); |
114 | Assert.That(userDataPlugin.GetUserByUUID(userId), Is.Null); | 114 | Assert.That(userDataPlugin.GetUserByUUID(userId), Is.Null); |
115 | 115 | ||
116 | // Check that we can update a profile once it exists | 116 | // Check that we can update a profile once it exists |
117 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; | 117 | LocalUserServices lus = (LocalUserServices)commsManager.UserService; |
118 | lus.AddUser(firstName, originalLastName, "pingu", "ted@excellentadventure.com", 1000, 1000, userId); | 118 | lus.AddUser(firstName, originalLastName, "pingu", "ted@excellentadventure.com", 1000, 1000, userId); |
119 | 119 | ||
120 | Assert.That(userCacheService.UpdateProfile(newProfile), Is.True); | 120 | Assert.That(userCacheService.StoreProfile(newProfile), Is.True); |
121 | UserProfileData retrievedProfile = userCacheService.GetUserDetails(userId).UserProfile; | 121 | UserProfileData retrievedProfile = userCacheService.GetUserDetails(userId).UserProfile; |
122 | Assert.That(retrievedProfile.SurName, Is.EqualTo(newLastName)); | 122 | Assert.That(retrievedProfile.SurName, Is.EqualTo(newLastName)); |
123 | Assert.That(userDataPlugin.GetUserByUUID(userId).SurName, Is.EqualTo(newLastName)); | 123 | Assert.That(userDataPlugin.GetUserByUUID(userId).SurName, Is.EqualTo(newLastName)); |
diff --git a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs index bc046cf..c6958de 100644 --- a/OpenSim/Framework/Servers/GetAssetStreamHandler.cs +++ b/OpenSim/Framework/Servers/GetAssetStreamHandler.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Servers | |||
57 | 57 | ||
58 | protected override AssetBase GetAsset(UUID assetID) | 58 | protected override AssetBase GetAsset(UUID assetID) |
59 | { | 59 | { |
60 | return m_assetProvider.FetchAsset(assetID); | 60 | return m_assetProvider.GetAsset(assetID); |
61 | } | 61 | } |
62 | } | 62 | } |
63 | } | 63 | } |
diff --git a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs index 419b408..8bf406c 100644 --- a/OpenSim/Framework/Servers/PostAssetStreamHandler.cs +++ b/OpenSim/Framework/Servers/PostAssetStreamHandler.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Servers | |||
57 | AssetBase asset = (AssetBase) xs.Deserialize(request); | 57 | AssetBase asset = (AssetBase) xs.Deserialize(request); |
58 | 58 | ||
59 | m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); | 59 | m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID); |
60 | m_assetProvider.CreateAsset(asset); | 60 | m_assetProvider.StoreAsset(asset); |
61 | 61 | ||
62 | return new byte[] {}; | 62 | return new byte[] {}; |
63 | } | 63 | } |
diff --git a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs index 35da73f..be3f518 100644 --- a/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs +++ b/OpenSim/Framework/Servers/Tests/GetAssetStreamHandlerTests.cs | |||
@@ -128,7 +128,7 @@ namespace OpenSim.Framework.Servers.Tests | |||
128 | IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); | 128 | IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin(); |
129 | handler = new GetAssetStreamHandler(assetDataPlugin); | 129 | handler = new GetAssetStreamHandler(assetDataPlugin); |
130 | 130 | ||
131 | assetDataPlugin.CreateAsset(asset); | 131 | assetDataPlugin.StoreAsset(asset); |
132 | return asset; | 132 | return asset; |
133 | } | 133 | } |
134 | } | 134 | } |
diff --git a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs index 0631ee7..92ac84f 100644 --- a/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs +++ b/OpenSim/Grid/AssetInventoryServer/Plugins/OpenSim/OpenSimAssetStoragePlugin.cs | |||
@@ -57,7 +57,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
57 | metadata = null; | 57 | metadata = null; |
58 | BackendResponse ret; | 58 | BackendResponse ret; |
59 | 59 | ||
60 | AssetBase asset = m_assetProvider.FetchAsset(assetID); | 60 | AssetBase asset = m_assetProvider.GetAsset(assetID); |
61 | 61 | ||
62 | if (asset == null) ret = BackendResponse.NotFound; | 62 | if (asset == null) ret = BackendResponse.NotFound; |
63 | else | 63 | else |
@@ -75,7 +75,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
75 | assetData = null; | 75 | assetData = null; |
76 | BackendResponse ret; | 76 | BackendResponse ret; |
77 | 77 | ||
78 | AssetBase asset = m_assetProvider.FetchAsset(assetID); | 78 | AssetBase asset = m_assetProvider.GetAsset(assetID); |
79 | 79 | ||
80 | if (asset == null) ret = BackendResponse.NotFound; | 80 | if (asset == null) ret = BackendResponse.NotFound; |
81 | else | 81 | else |
@@ -90,7 +90,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
90 | 90 | ||
91 | public BackendResponse TryFetchDataMetadata(UUID assetID, out AssetBase asset) | 91 | public BackendResponse TryFetchDataMetadata(UUID assetID, out AssetBase asset) |
92 | { | 92 | { |
93 | asset = m_assetProvider.FetchAsset(assetID); | 93 | asset = m_assetProvider.GetAsset(assetID); |
94 | 94 | ||
95 | if (asset == null) return BackendResponse.NotFound; | 95 | if (asset == null) return BackendResponse.NotFound; |
96 | 96 | ||
@@ -107,7 +107,7 @@ namespace OpenSim.Grid.AssetInventoryServer.Plugins.OpenSim | |||
107 | { | 107 | { |
108 | BackendResponse ret; | 108 | BackendResponse ret; |
109 | 109 | ||
110 | m_assetProvider.CreateAsset(asset); | 110 | m_assetProvider.StoreAsset(asset); |
111 | ret = BackendResponse.Success; | 111 | ret = BackendResponse.Success; |
112 | 112 | ||
113 | m_server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, asset.FullID, asset.Data.Length, DateTime.Now); | 113 | m_server.MetricsProvider.LogAssetCreate(EXTENSION_NAME, ret, asset.FullID, asset.Data.Length, DateTime.Now); |
diff --git a/OpenSim/Grid/AssetServer/Main.cs b/OpenSim/Grid/AssetServer/Main.cs index f25e847..ac8f888 100644 --- a/OpenSim/Grid/AssetServer/Main.cs +++ b/OpenSim/Grid/AssetServer/Main.cs | |||
@@ -140,7 +140,7 @@ namespace OpenSim.Grid.AssetServer | |||
140 | 140 | ||
141 | protected void StoreAsset(AssetBase asset) | 141 | protected void StoreAsset(AssetBase asset) |
142 | { | 142 | { |
143 | m_assetProvider.CreateAsset(asset); | 143 | m_assetProvider.StoreAsset(asset); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | } | 146 | } |
diff --git a/OpenSim/Grid/GridServer.Modules/GridDBService.cs b/OpenSim/Grid/GridServer.Modules/GridDBService.cs index caa2c10..fd5a09a 100644 --- a/OpenSim/Grid/GridServer.Modules/GridDBService.cs +++ b/OpenSim/Grid/GridServer.Modules/GridDBService.cs | |||
@@ -206,11 +206,11 @@ namespace OpenSim.Grid.GridServer.Modules | |||
206 | { | 206 | { |
207 | if (existingSim == null) | 207 | if (existingSim == null) |
208 | { | 208 | { |
209 | insertResponse = plugin.AddProfile(sim); | 209 | insertResponse = plugin.StoreProfile(sim); |
210 | } | 210 | } |
211 | else | 211 | else |
212 | { | 212 | { |
213 | insertResponse = plugin.UpdateProfile(sim); | 213 | insertResponse = plugin.StoreProfile(sim); |
214 | } | 214 | } |
215 | } | 215 | } |
216 | catch (Exception e) | 216 | catch (Exception e) |
@@ -259,7 +259,7 @@ namespace OpenSim.Grid.GridServer.Modules | |||
259 | if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || | 259 | if ((reserveData != null && reserveData.gridRecvKey == theSim.regionRecvKey) || |
260 | (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) | 260 | (reserveData == null && authkeynode.InnerText != theSim.regionRecvKey)) |
261 | { | 261 | { |
262 | plugin.AddProfile(theSim); | 262 | plugin.StoreProfile(theSim); |
263 | m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); | 263 | m_log.Info("[grid]: New sim added to grid (" + theSim.regionName + ")"); |
264 | logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, | 264 | logToDB(theSim.ToString(), "RestSetSimMethod", String.Empty, 5, |
265 | "Region successfully updated and connected to grid."); | 265 | "Region successfully updated and connected to grid."); |
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index fe663eb..88a905c 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs | |||
@@ -83,7 +83,7 @@ namespace OpenSim.Services.AssetService | |||
83 | if (!UUID.TryParse(id, out assetID)) | 83 | if (!UUID.TryParse(id, out assetID)) |
84 | return null; | 84 | return null; |
85 | 85 | ||
86 | return m_Database.FetchAsset(assetID); | 86 | return m_Database.GetAsset(assetID); |
87 | } | 87 | } |
88 | 88 | ||
89 | public AssetMetadata GetMetadata(string id) | 89 | public AssetMetadata GetMetadata(string id) |
@@ -93,7 +93,7 @@ namespace OpenSim.Services.AssetService | |||
93 | if (!UUID.TryParse(id, out assetID)) | 93 | if (!UUID.TryParse(id, out assetID)) |
94 | return null; | 94 | return null; |
95 | 95 | ||
96 | AssetBase asset = m_Database.FetchAsset(assetID); | 96 | AssetBase asset = m_Database.GetAsset(assetID); |
97 | return asset.Metadata; | 97 | return asset.Metadata; |
98 | } | 98 | } |
99 | 99 | ||
@@ -104,7 +104,7 @@ namespace OpenSim.Services.AssetService | |||
104 | if (!UUID.TryParse(id, out assetID)) | 104 | if (!UUID.TryParse(id, out assetID)) |
105 | return null; | 105 | return null; |
106 | 106 | ||
107 | AssetBase asset = m_Database.FetchAsset(assetID); | 107 | AssetBase asset = m_Database.GetAsset(assetID); |
108 | return asset.Data; | 108 | return asset.Data; |
109 | } | 109 | } |
110 | 110 | ||
@@ -117,7 +117,7 @@ namespace OpenSim.Services.AssetService | |||
117 | if (!UUID.TryParse(id, out assetID)) | 117 | if (!UUID.TryParse(id, out assetID)) |
118 | return false; | 118 | return false; |
119 | 119 | ||
120 | AssetBase asset = m_Database.FetchAsset(assetID); | 120 | AssetBase asset = m_Database.GetAsset(assetID); |
121 | 121 | ||
122 | //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); | 122 | //m_log.DebugFormat("[AssetService]: Got asset {0}", asset); |
123 | 123 | ||
@@ -129,7 +129,7 @@ namespace OpenSim.Services.AssetService | |||
129 | public string Store(AssetBase asset) | 129 | public string Store(AssetBase asset) |
130 | { | 130 | { |
131 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); | 131 | //m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID); |
132 | m_Database.CreateAsset(asset); | 132 | m_Database.StoreAsset(asset); |
133 | 133 | ||
134 | return asset.ID; | 134 | return asset.ID; |
135 | } | 135 | } |
diff --git a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs index 8ab72dc..3981fe9 100644 --- a/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs +++ b/OpenSim/Tests/Common/Mock/TestAssetDataPlugin.cs | |||
@@ -25,6 +25,7 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
28 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenSim.Framework; | 31 | using OpenSim.Framework; |
@@ -46,6 +47,18 @@ namespace OpenSim.Tests.Common.Mock | |||
46 | public void Initialise(string connect) {} | 47 | public void Initialise(string connect) {} |
47 | public void Dispose() {} | 48 | public void Dispose() {} |
48 | 49 | ||
50 | private readonly List<AssetBase> assets = new List<AssetBase>(); | ||
51 | |||
52 | public AssetBase GetAsset(UUID uuid) | ||
53 | { | ||
54 | return assets.Find(x=>x.FullID == uuid); | ||
55 | } | ||
56 | |||
57 | public void StoreAsset(AssetBase asset) | ||
58 | { | ||
59 | assets.Add(asset); | ||
60 | } | ||
61 | |||
49 | public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); } | 62 | public List<AssetMetadata> FetchAssetMetadataSet(int start, int count) { return new List<AssetMetadata>(count); } |
50 | } | 63 | } |
51 | } \ No newline at end of file | 64 | } \ No newline at end of file |