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.

0.6.6-post-fixes
diva 2009-05-22 04:23:59 +00:00
parent 9de2436c1e
commit da170cde46
6 changed files with 59 additions and 26 deletions

View File

@ -160,6 +160,8 @@ namespace OpenSim.Framework
public class AssetMetadata public class AssetMetadata
{ {
private UUID m_fullid; private UUID m_fullid;
// m_id added as a dirty hack to transition from FullID to ID
private string m_id;
private string m_name = String.Empty; private string m_name = String.Empty;
private string m_description = String.Empty; private string m_description = String.Empty;
private DateTime m_creation_date; private DateTime m_creation_date;
@ -174,13 +176,25 @@ namespace OpenSim.Framework
public UUID FullID public UUID FullID
{ {
get { return m_fullid; } get { return m_fullid; }
set { m_fullid = value; } set { m_fullid = value; m_id = m_fullid.ToString(); }
} }
public string ID public string ID
{ {
get { return m_fullid.ToString(); } //get { return m_fullid.ToString(); }
set { m_fullid = new UUID(value); } //set { m_fullid = new UUID(value); }
get { return m_id; }
set
{
UUID uuid = UUID.Zero;
if (UUID.TryParse(value, out uuid))
{
m_fullid = uuid;
m_id = m_fullid.ToString();
}
else
m_id = value;
}
} }
public string Name public string Name

View File

@ -146,7 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public AssetBase Get(string id) public AssetBase Get(string id)
{ {
AssetBase asset = m_Cache.Get(id); AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset == null) if (asset == null)
return m_AssetService.Get(id); return m_AssetService.Get(id);
@ -155,7 +157,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public AssetMetadata GetMetadata(string id) public AssetMetadata GetMetadata(string id)
{ {
AssetBase asset = m_Cache.Get(id); AssetBase asset = null;
if (m_Cache != null)
asset = m_Cache.Get(id);
if (asset != null) if (asset != null)
return asset.Metadata; return asset.Metadata;
@ -163,6 +167,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
asset = m_AssetService.Get(id); asset = m_AssetService.Get(id);
if (asset != null) if (asset != null)
{ {
if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
return asset.Metadata; return asset.Metadata;
} }
@ -180,6 +185,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
asset = m_AssetService.Get(id); asset = m_AssetService.Get(id);
if (asset != null) if (asset != null)
{ {
if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
return asset.Data; return asset.Data;
} }
@ -189,7 +195,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public bool Get(string id, Object sender, AssetRetrieved handler) public bool Get(string id, Object sender, AssetRetrieved handler)
{ {
AssetBase asset = m_Cache.Get(id); AssetBase asset = null;
if (m_Cache != null)
m_Cache.Get(id);
if (asset != null) if (asset != null)
{ {
@ -199,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a) return m_AssetService.Get(id, sender, delegate (string assetID, Object s, AssetBase a)
{ {
if (a != null) if ((a != null) && (m_Cache != null))
m_Cache.Cache(a); m_Cache.Cache(a);
handler(assetID, s, a); handler(assetID, s, a);
}); });
@ -207,6 +215,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public string Store(AssetBase asset) public string Store(AssetBase asset)
{ {
if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
if (asset.Temporary || asset.Local) if (asset.Temporary || asset.Local)
return asset.ID; return asset.ID;
@ -215,10 +224,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public bool UpdateContent(string id, byte[] data) public bool UpdateContent(string id, byte[] data)
{ {
AssetBase asset = m_Cache.Get(id); AssetBase asset = null;
if (m_Cache != null)
m_Cache.Get(id);
if (asset != null) if (asset != null)
{ {
asset.Data = data; asset.Data = data;
if (m_Cache != null)
m_Cache.Cache(asset); m_Cache.Cache(asset);
} }
@ -227,6 +239,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public bool Delete(string id) public bool Delete(string id)
{ {
if (m_Cache != null)
m_Cache.Expire(id); m_Cache.Expire(id);
return m_AssetService.Delete(id); return m_AssetService.Delete(id);

View File

@ -46,12 +46,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
#region Fields #region Fields
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// This maps between asset server URLs and asset server clients
private Dictionary<string, GridAssetClient> m_assetServers = new Dictionary<string, GridAssetClient>();
// This maps between asset UUIDs and asset servers
private Dictionary<UUID, GridAssetClient> m_assetMap = new Dictionary<UUID, GridAssetClient>();
// This maps between inventory server urls and inventory server clients // This maps between inventory server urls and inventory server clients
private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>(); private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
@ -103,11 +97,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
return false; return false;
} }
private bool IsInAssetMap(UUID uuid)
{
return m_assetMap.ContainsKey(uuid);
}
private AssetBase FetchAsset(string url, UUID assetID, bool isTexture) private AssetBase FetchAsset(string url, UUID assetID, bool isTexture)
{ {
AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString()); AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString());

View File

@ -55,6 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService = m_AssetService =
ServerUtils.LoadPlugin<IAssetService>(assetService, args); ServerUtils.LoadPlugin<IAssetService>(assetService, args);
//System.Console.WriteLine("XXXXXXXXXXXXXXXXXXX m_AssetSetvice == null? " + ((m_AssetService == null) ? "yes" : "no"));
server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService)); server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService));

View File

@ -37,7 +37,7 @@ using OpenSim.Region.Framework.Interfaces;
using OpenSim.Server.Base; using OpenSim.Server.Base;
using OpenSim.Server.Handlers.Base; using OpenSim.Server.Handlers.Base;
namespace OpenSim.Region.SimulatorServices namespace OpenSim.SimulatorServices
{ {
public class RegionAssetService : ISharedRegionModule public class RegionAssetService : ISharedRegionModule
{ {
@ -55,6 +55,8 @@ namespace OpenSim.Region.SimulatorServices
enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) && enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
config.Configs["Startup"].GetBoolean("hypergrid", true)) || config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true)); ((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
m_log.DebugFormat("[RegionAssetService]: enabled? {0}", enabled);
m_Config = config;
} }
public void PostInitialise() public void PostInitialise()

View File

@ -0,0 +1,14 @@
<Addin id="OpenSim.SimulatorServices" version="0.2">
<Runtime>
<Import assembly="OpenSim.SimulatorServices.dll"/>
</Runtime>
<Dependencies>
<Addin id="OpenSim" version="0.5" />
</Dependencies>
<Extension path = "/OpenSim/RegionModules">
<RegionModule id="RegionAssetService" type="OpenSim.SimulatorServices.RegionAssetService" />
</Extension>
</Addin>