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
{
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_description = String.Empty;
private DateTime m_creation_date;
@ -174,13 +176,25 @@ namespace OpenSim.Framework
public UUID FullID
{
get { return m_fullid; }
set { m_fullid = value; }
set { m_fullid = value; m_id = m_fullid.ToString(); }
}
public string ID
{
get { return m_fullid.ToString(); }
set { m_fullid = new UUID(value); }
//get { return m_fullid.ToString(); }
//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

View File

@ -146,7 +146,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
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)
return m_AssetService.Get(id);
@ -155,15 +157,18 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
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)
return asset.Metadata;
asset = m_AssetService.Get(id);
if (asset != null)
if (asset != null)
{
m_Cache.Cache(asset);
if (m_Cache != null)
m_Cache.Cache(asset);
return asset.Metadata;
}
@ -180,7 +185,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
asset = m_AssetService.Get(id);
if (asset != null)
{
m_Cache.Cache(asset);
if (m_Cache != null)
m_Cache.Cache(asset);
return asset.Data;
}
@ -189,7 +195,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
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)
{
@ -199,7 +207,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
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);
handler(assetID, s, a);
});
@ -207,7 +215,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public string Store(AssetBase asset)
{
m_Cache.Cache(asset);
if (m_Cache != null)
m_Cache.Cache(asset);
if (asset.Temporary || asset.Local)
return asset.ID;
return m_AssetService.Store(asset);
@ -215,11 +224,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
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)
{
asset.Data = data;
m_Cache.Cache(asset);
if (m_Cache != null)
m_Cache.Cache(asset);
}
return m_AssetService.UpdateContent(id, data);
@ -227,7 +239,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
public bool Delete(string id)
{
m_Cache.Expire(id);
if (m_Cache != null)
m_Cache.Expire(id);
return m_AssetService.Delete(id);
}

View File

@ -46,12 +46,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
#region Fields
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
private Dictionary<string, InventoryClient> m_inventoryServers = new Dictionary<string, InventoryClient>();
@ -103,11 +97,6 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
return false;
}
private bool IsInAssetMap(UUID uuid)
{
return m_assetMap.ContainsKey(uuid);
}
private AssetBase FetchAsset(string url, UUID assetID, bool isTexture)
{
AssetBase asset = m_scene.AssetService.Get(url + "/" + assetID.ToString());

View File

@ -55,6 +55,7 @@ namespace OpenSim.Server.Handlers.Asset
m_AssetService =
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 AssetServerPostHandler(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.Handlers.Base;
namespace OpenSim.Region.SimulatorServices
namespace OpenSim.SimulatorServices
{
public class RegionAssetService : ISharedRegionModule
{
@ -55,6 +55,8 @@ namespace OpenSim.Region.SimulatorServices
enabled = ((!config.Configs["Startup"].GetBoolean("gridmode", true)) &&
config.Configs["Startup"].GetBoolean("hypergrid", true)) ||
((config.Configs["MXP"] != null) && config.Configs["MXP"].GetBoolean("Enabled", true));
m_log.DebugFormat("[RegionAssetService]: enabled? {0}", enabled);
m_Config = config;
}
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>