Merge branch 'master' into careminster-presence-refactor

Also prevent god takes from ending up in Lost and Found
This commit is contained in:
Melanie
2010-12-03 02:36:13 +00:00
45 changed files with 1185 additions and 548 deletions

View File

@@ -43,44 +43,51 @@ namespace OpenSim.Services.AssetService
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
protected static AssetService m_RootInstance;
public AssetService(IConfigSource config) : base(config)
{
MainConsole.Instance.Commands.AddCommand("kfs", false,
"show digest",
"show digest <ID>",
"Show asset digest", HandleShowDigest);
MainConsole.Instance.Commands.AddCommand("kfs", false,
"delete asset",
"delete asset <ID>",
"Delete asset from database", HandleDeleteAsset);
if (m_AssetLoader != null)
if (m_RootInstance == null)
{
IConfig assetConfig = config.Configs["AssetService"];
if (assetConfig == null)
throw new Exception("No AssetService configuration");
m_RootInstance = this;
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
String.Empty);
MainConsole.Instance.Commands.AddCommand("kfs", false,
"show digest",
"show digest <ID>",
"Show asset digest", HandleShowDigest);
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
MainConsole.Instance.Commands.AddCommand("kfs", false,
"delete asset",
"delete asset <ID>",
"Delete asset from database", HandleDeleteAsset);
if (assetLoaderEnabled)
if (m_AssetLoader != null)
{
m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
delegate(AssetBase a)
{
Store(a);
});
IConfig assetConfig = config.Configs["AssetService"];
if (assetConfig == null)
throw new Exception("No AssetService configuration");
string loaderArgs = assetConfig.GetString("AssetLoaderArgs",
String.Empty);
bool assetLoaderEnabled = assetConfig.GetBoolean("AssetLoaderEnabled", true);
if (assetLoaderEnabled)
{
m_log.InfoFormat("[ASSET]: Loading default asset set from {0}", loaderArgs);
m_AssetLoader.ForEachDefaultXmlAsset(loaderArgs,
delegate(AssetBase a)
{
Store(a);
});
}
m_log.Info("[ASSET SERVICE]: Local asset service enabled");
}
m_log.Info("[ASSET SERVICE]: Local asset service enabled");
}
}
public AssetBase Get(string id)
public virtual AssetBase Get(string id)
{
UUID assetID;
@@ -93,12 +100,12 @@ namespace OpenSim.Services.AssetService
return m_Database.GetAsset(assetID);
}
public AssetBase GetCached(string id)
public virtual AssetBase GetCached(string id)
{
return Get(id);
}
public AssetMetadata GetMetadata(string id)
public virtual AssetMetadata GetMetadata(string id)
{
UUID assetID;
@@ -112,7 +119,7 @@ namespace OpenSim.Services.AssetService
return null;
}
public byte[] GetData(string id)
public virtual byte[] GetData(string id)
{
UUID assetID;
@@ -123,7 +130,7 @@ namespace OpenSim.Services.AssetService
return asset.Data;
}
public bool Get(string id, Object sender, AssetRetrieved handler)
public virtual bool Get(string id, Object sender, AssetRetrieved handler)
{
//m_log.DebugFormat("[AssetService]: Get asset async {0}", id);
@@ -141,7 +148,7 @@ namespace OpenSim.Services.AssetService
return true;
}
public string Store(AssetBase asset)
public virtual string Store(AssetBase asset)
{
//m_log.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
if (!m_Database.StoreAsset(asset))
@@ -157,7 +164,7 @@ namespace OpenSim.Services.AssetService
return false;
}
public bool Delete(string id)
public virtual bool Delete(string id)
{
m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id);
UUID assetID;