Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
9ab5c5040d
|
@ -35,6 +35,9 @@ namespace OpenSim.Framework
|
||||||
|
|
||||||
private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray)
|
private void LoadPermsFromConfig(IConfig assetConfig, string variable, bool[] bitArray)
|
||||||
{
|
{
|
||||||
|
if (assetConfig == null)
|
||||||
|
return;
|
||||||
|
|
||||||
string perms = assetConfig.GetString(variable, String.Empty);
|
string perms = assetConfig.GetString(variable, String.Empty);
|
||||||
string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
string[] parts = perms.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
foreach (string s in parts)
|
foreach (string s in parts)
|
||||||
|
|
|
@ -71,6 +71,21 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
#region Internal functions
|
#region Internal functions
|
||||||
|
|
||||||
|
public AssetMetadata FetchMetadata(string url, UUID assetID)
|
||||||
|
{
|
||||||
|
if (!url.EndsWith("/") && !url.EndsWith("="))
|
||||||
|
url = url + "/";
|
||||||
|
|
||||||
|
AssetMetadata meta = m_scene.AssetService.GetMetadata(url + assetID.ToString());
|
||||||
|
|
||||||
|
if (meta != null)
|
||||||
|
m_log.DebugFormat("[HG ASSET MAPPER]: Fetched metadata for asset {0} of type {1} from {2} ", assetID, meta.Type, url);
|
||||||
|
else
|
||||||
|
m_log.DebugFormat("[HG ASSET MAPPER]: Unable to fetched metadata for asset {0} from {1} ", assetID, url);
|
||||||
|
|
||||||
|
return meta;
|
||||||
|
}
|
||||||
|
|
||||||
public AssetBase FetchAsset(string url, UUID assetID)
|
public AssetBase FetchAsset(string url, UUID assetID)
|
||||||
{
|
{
|
||||||
if (!url.EndsWith("/") && !url.EndsWith("="))
|
if (!url.EndsWith("/") && !url.EndsWith("="))
|
||||||
|
@ -222,28 +237,19 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
||||||
|
|
||||||
public void Get(UUID assetID, UUID ownerID, string userAssetURL)
|
public void Get(UUID assetID, UUID ownerID, string userAssetURL)
|
||||||
{
|
{
|
||||||
// Get the item from the remote asset server onto the local AssetCache
|
// Get the item from the remote asset server onto the local AssetService
|
||||||
// and place an entry in m_assetMap
|
|
||||||
|
|
||||||
m_log.Debug("[HG ASSET MAPPER]: Fetching object " + assetID + " from asset server " + userAssetURL);
|
AssetMetadata meta = FetchMetadata(userAssetURL, assetID);
|
||||||
AssetBase asset = FetchAsset(userAssetURL, assetID);
|
if (meta == null)
|
||||||
|
return;
|
||||||
|
|
||||||
if (asset != null)
|
// The act of gathering UUIDs downloads the assets from the remote server
|
||||||
{
|
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
||||||
// OK, now fetch the inside.
|
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
||||||
Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
|
uuidGatherer.GatherAssetUuids(assetID, (AssetType)meta.Type, ids);
|
||||||
HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
|
|
||||||
uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
|
|
||||||
if (ids.ContainsKey(assetID))
|
|
||||||
ids.Remove(assetID);
|
|
||||||
foreach (UUID uuid in ids.Keys)
|
|
||||||
FetchAsset(userAssetURL, uuid);
|
|
||||||
|
|
||||||
m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", asset.ID, userAssetURL);
|
m_log.DebugFormat("[HG ASSET MAPPER]: Successfully fetched asset {0} from asset server {1}", assetID, userAssetURL);
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_log.Warn("[HG ASSET MAPPER]: Could not fetch asset from remote asset server " + userAssetURL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
|
||||||
m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
|
m_LocalAssetServiceURI = m_LocalAssetServiceURI.Trim('/');
|
||||||
|
|
||||||
IConfig hgConfig = source.Configs["HGAssetService"];
|
IConfig hgConfig = source.Configs["HGAssetService"];
|
||||||
m_AssetPerms = new AssetPermissions(hgConfig);
|
m_AssetPerms = new AssetPermissions(hgConfig); // it's ok if arg is null
|
||||||
|
|
||||||
m_Enabled = true;
|
m_Enabled = true;
|
||||||
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
|
m_log.Info("[HG ASSET CONNECTOR]: HG asset broker enabled");
|
||||||
|
|
Loading…
Reference in New Issue