aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authordiva2009-05-22 04:23:59 +0000
committerdiva2009-05-22 04:23:59 +0000
commitda170cde4684ea0f8ed90ea4ed0b30172ad9981d (patch)
tree0ffc809b31853d81479fee0c4e053025d31adb9d
parentRemoving the [UserService] section, because it's not working yet. (diff)
downloadopensim-SC_OLD-da170cde4684ea0f8ed90ea4ed0b30172ad9981d.zip
opensim-SC_OLD-da170cde4684ea0f8ed90ea4ed0b30172ad9981d.tar.gz
opensim-SC_OLD-da170cde4684ea0f8ed90ea4ed0b30172ad9981d.tar.bz2
opensim-SC_OLD-da170cde4684ea0f8ed90ea4ed0b30172ad9981d.tar.xz
Cleaning up a few HG things. HG Posts may now work in grids, but if the home grid is a standalone, this still doesn't work -- something wrong with RegionAssetService's DB connection.
-rw-r--r--OpenSim/Framework/AssetBase.cs20
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs35
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs11
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs1
-rw-r--r--OpenSim/SimulatorServices/RegionAssetService.cs4
-rw-r--r--OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml14
6 files changed, 59 insertions, 26 deletions
diff --git a/OpenSim/Framework/AssetBase.cs b/OpenSim/Framework/AssetBase.cs
index 0551533..361a6fa 100644
--- a/OpenSim/Framework/AssetBase.cs
+++ b/OpenSim/Framework/AssetBase.cs
@@ -160,6 +160,8 @@ namespace OpenSim.Framework
160 public class AssetMetadata 160 public class AssetMetadata
161 { 161 {
162 private UUID m_fullid; 162 private UUID m_fullid;
163 // m_id added as a dirty hack to transition from FullID to ID
164 private string m_id;
163 private string m_name = String.Empty; 165 private string m_name = String.Empty;
164 private string m_description = String.Empty; 166 private string m_description = String.Empty;
165 private DateTime m_creation_date; 167 private DateTime m_creation_date;
@@ -174,13 +176,25 @@ namespace OpenSim.Framework
174 public UUID FullID 176 public UUID FullID
175 { 177 {
176 get { return m_fullid; } 178 get { return m_fullid; }
177 set { m_fullid = value; } 179 set { m_fullid = value; m_id = m_fullid.ToString(); }
178 } 180 }
179 181
180 public string ID 182 public string ID
181 { 183 {
182 get { return m_fullid.ToString(); } 184 //get { return m_fullid.ToString(); }
183 set { m_fullid = new UUID(value); } 185 //set { m_fullid = new UUID(value); }
186 get { return m_id; }
187 set
188 {
189 UUID uuid = UUID.Zero;
190 if (UUID.TryParse(value, out uuid))
191 {
192 m_fullid = uuid;
193 m_id = m_fullid.ToString();
194 }
195 else
196 m_id = value;
197 }
184 } 198 }
185 199
186 public string Name 200 public string Name
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
index 4e802ed..3750991 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
@@ -146,7 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
146 146
147 public AssetBase Get(string id) 147 public AssetBase Get(string id)
148 { 148 {
149 AssetBase asset = m_Cache.Get(id); 149 AssetBase asset = null;
150 if (m_Cache != null)
151 asset = m_Cache.Get(id);
150 152
151 if (asset == null) 153 if (asset == null)
152 return m_AssetService.Get(id); 154 return m_AssetService.Get(id);
@@ -155,15 +157,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
155 157
156 public AssetMetadata GetMetadata(string id) 158 public AssetMetadata GetMetadata(string id)
157 { 159 {
158 AssetBase asset = m_Cache.Get(id); 160 AssetBase asset = null;
161 if (m_Cache != null)
162 asset = m_Cache.Get(id);
159 163
160 if (asset != null) 164 if (asset != null)
161 return asset.Metadata; 165 return asset.Metadata;
162 166
163 asset = m_AssetService.Get(id); 167 asset = m_AssetService.Get(id);
164 if (asset != null) 168 if (asset != null)
165 { 169 {
166 m_Cache.Cache(asset); 170 if (m_Cache != null)
171 m_Cache.Cache(asset);
167 return asset.Metadata; 172 return asset.Metadata;
168 } 173 }
169 174
@@ -180,7 +185,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
180 asset = m_AssetService.Get(id); 185 asset = m_AssetService.Get(id);
181 if (asset != null) 186 if (asset != null)
182 { 187 {
183 m_Cache.Cache(asset); 188 if (m_Cache != null)
189 m_Cache.Cache(asset);
184 return asset.Data; 190 return asset.Data;
185 } 191 }
186 192
@@ -189,7 +195,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
189 195
190 public bool Get(string id, Object sender, AssetRetrieved handler) 196 public bool Get(string id, Object sender, AssetRetrieved handler)
191 { 197 {
192 AssetBase asset = m_Cache.Get(id); 198 AssetBase asset = null;
199 if (m_Cache != null)
200 m_Cache.Get(id);
193 201
194 if (asset != null) 202 if (asset != null)
195 { 203 {
@@ -199,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
199 207
200 return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) 208 return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
201 { 209 {
202 if (a != null) 210 if ((a != null) && (m_Cache != null))
203 m_Cache.Cache(a); 211 m_Cache.Cache(a);
204 handler(assetID, s, a); 212 handler(assetID, s, a);
205 }); 213 });
@@ -207,7 +215,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
207 215
208 public string Store(AssetBase asset) 216 public string Store(AssetBase asset)
209 { 217 {
210 m_Cache.Cache(asset); 218 if (m_Cache != null)
219 m_Cache.Cache(asset);
211 if (asset.Temporary || asset.Local) 220 if (asset.Temporary || asset.Local)
212 return asset.ID; 221 return asset.ID;
213 return m_AssetService.Store(asset); 222 return m_AssetService.Store(asset);
@@ -215,11 +224,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
215 224
216 public bool UpdateContent(string id, byte[] data) 225 public bool UpdateContent(string id, byte[] data)
217 { 226 {
218 AssetBase asset = m_Cache.Get(id); 227 AssetBase asset = null;
228 if (m_Cache != null)
229 m_Cache.Get(id);
219 if (asset != null) 230 if (asset != null)
220 { 231 {
221 asset.Data = data; 232 asset.Data = data;
222 m_Cache.Cache(asset); 233 if (m_Cache != null)
234 m_Cache.Cache(asset);
223 } 235 }
224 236
225 return m_AssetService.UpdateContent(id, data); 237 return m_AssetService.UpdateContent(id, data);
@@ -227,7 +239,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
227 239
228 public bool Delete(string id) 240 public bool Delete(string id)
229 { 241 {
230 m_Cache.Expire(id); 242 if (m_Cache != null)
243 m_Cache.Expire(id);
231 244
232 return m_AssetService.Delete(id); 245 return m_AssetService.Delete(id);
233 } 246 }
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 1750bbf..720a09b 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -46,12 +46,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
46 #region Fields 46 #region Fields
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 // This maps between asset server URLs and asset server clients
50 private Dictionary<string, GridAssetClient> m_assetServers = new Dictionary<string, GridAssetClient>();
51
52 // This maps between asset UUIDs and asset servers
53 private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>();
54
55 // This maps between inventory server urls and inventory server clients 49 // This maps between inventory server urls and inventory server clients
56 private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); 50 private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
57 51
@@ -103,11 +97,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
103 return false; 97 return false;
104 } 98 }
105 99
106 private bool IsInAssetMap(UUID uuid)
107 {
108 return m_assetMap.ContainsKey(uuid);
109 }
110
111 private AssetBase FetchAsset(string url, UUID assetID, bool isTexture) 100 private AssetBase FetchAsset(string url, UUID assetID, bool isTexture)
112 { 101 {
113 AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); 102 AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString());
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index 686e6dd..39780e1 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
55 m_AssetService = 55 m_AssetService =
56 ServerUtils.LoadPlugin<IAssetService>(assetService, args); 56 ServerUtils.LoadPlugin<IAssetService>(assetService, args);
57 57
58 //System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
58 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); 59 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
59 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); 60 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
60 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); 61 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService));
diff --git a/OpenSim/SimulatorServices/RegionAssetService.cs b/OpenSim/SimulatorServices/RegionAssetService.cs
index 06f42d3..a9080f7 100644
--- a/OpenSim/SimulatorServices/RegionAssetService.cs
+++ b/OpenSim/SimulatorServices/RegionAssetService.cs
@@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Server.Base; 37using OpenSim.Server.Base;
38using OpenSim.Server.Handlers.Base; 38using OpenSim.Server.Handlers.Base;
39 39
40namespace OpenSim.Region.SimulatorServices 40namespace OpenSim.SimulatorServices
41{ 41{
42 public class RegionAssetService : ISharedRegionModule 42 public class RegionAssetService : ISharedRegionModule
43 { 43 {
@@ -55,6 +55,8 @@ namespace OpenSim.Region.SimulatorServices
55 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && 55 enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
56 config.Configs["Startup"].GetBoolean("hypergrid", true)) || 56 config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
57 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); 57 ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
58 m_log.DebugFormat("[RegionAssetService]: enabled? {0}", enabled);
59 m_Config = config;
58 } 60 }
59 61
60 public void PostInitialise() 62 public void PostInitialise()
diff --git a/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml b/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml
new file mode 100644
index 0000000..accc467
--- /dev/null
+++ b/OpenSim/SimulatorServices/Resources/SimulatorServices.addin.xml
@@ -0,0 +1,14 @@
1<Addin id="OpenSim.SimulatorServices" version="0.2">
2 <Runtime>
3 <Import assembly="OpenSim.SimulatorServices.dll"/>
4 </Runtime>
5
6 <Dependencies>
7 <Addin id="OpenSim" version="0.5" />
8 </Dependencies>
9
10 <Extension path = "/OpenSim/RegionModules">
11 <RegionModule id="RegionAssetService" type="OpenSim.SimulatorServices.RegionAssetService" />
12 </Extension>
13
14</Addin>