* Added prototypical AvatarFactory module interface to load avatar parameters

* Added dump_assets_to_file option to enable asset dumping for debug
* normalized some namespaces
* InventoryFolder renamed to InventoryFolderImpl to
afrisby
lbsa71 2007-10-26 14:08:36 +00:00
parent 75be841839
commit 070047ce1b
27 changed files with 301 additions and 214 deletions

View File

@ -26,21 +26,9 @@
* *
*/ */
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Security.Cryptography;
using libsecondlife;
using Nwc.XmlRpc;
using OpenSim.Framework.Console;
using OpenSim.Framework.Data;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Inventory;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
namespace OpenSim.Framework.UserManagement namespace OpenSim.Framework.Communications
{ {
public class CAPSService public class CAPSService
{ {

View File

@ -36,17 +36,19 @@ using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Data; using OpenSim.Framework.Data;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Cache
{ {
public class AssetTransactionManager public class AssetTransactionManager
{ {
// Fields // Fields
public CommunicationsManager CommsManager; public CommunicationsManager CommsManager;
public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>(); public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions = new Dictionary<LLUUID, AgentAssetTransactions>();
private bool m_dumpAssetsToFile;
public AssetTransactionManager(CommunicationsManager commsManager) public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
{ {
CommsManager = commsManager; CommsManager = commsManager;
m_dumpAssetsToFile = dumpAssetsToFile;
} }
// Methods // Methods
@ -54,7 +56,7 @@ namespace OpenSim.Framework.Communications.Caches
{ {
if (!this.AgentTransactions.ContainsKey(userID)) if (!this.AgentTransactions.ContainsKey(userID))
{ {
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this); AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
this.AgentTransactions.Add(userID, transactions); this.AgentTransactions.Add(userID, transactions);
return transactions; return transactions;
} }
@ -82,7 +84,7 @@ namespace OpenSim.Framework.Communications.Caches
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal) public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, byte[] data, bool storeLocal)
{ {
// Console.WriteLine("asset upload of " + assetID); // Console.WriteLine("asset upload of " + assetID);
AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId); AgentAssetTransactions transactions = this.GetUserTransActions(remoteClient.AgentId);
if (transactions != null) if (transactions != null)
{ {
@ -104,5 +106,3 @@ namespace OpenSim.Framework.Communications.Caches
} }
} }
} }

View File

@ -39,7 +39,7 @@ using OpenSim.Framework.Utilities;
using OpenSim.Region.Capabilities; using OpenSim.Region.Capabilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Cache
{ {
public class AgentAssetTransactions public class AgentAssetTransactions
{ {
@ -49,12 +49,14 @@ namespace OpenSim.Framework.Communications.Caches
public LLUUID UserID; public LLUUID UserID;
public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>(); public Dictionary<LLUUID, AssetXferUploader> XferUploaders = new Dictionary<LLUUID, AssetXferUploader>();
public AssetTransactionManager Manager; public AssetTransactionManager Manager;
private bool m_dumpAssetsToFile;
// Methods // Methods
public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager) public AgentAssetTransactions(LLUUID agentID, AssetTransactionManager manager, bool dumpAssetsToFile)
{ {
this.UserID = agentID; this.UserID = agentID;
Manager = manager; Manager = manager;
m_dumpAssetsToFile = dumpAssetsToFile;
} }
public AssetCapsUploader RequestCapsUploader() public AssetCapsUploader RequestCapsUploader()
@ -75,7 +77,7 @@ namespace OpenSim.Framework.Communications.Caches
{ {
if (!this.XferUploaders.ContainsKey(transactionID)) if (!this.XferUploaders.ContainsKey(transactionID))
{ {
AssetXferUploader uploader = new AssetXferUploader(this); AssetXferUploader uploader = new AssetXferUploader(this, m_dumpAssetsToFile);
this.XferUploaders.Add(transactionID, uploader); this.XferUploaders.Add(transactionID, uploader);
return uploader; return uploader;
@ -122,14 +124,14 @@ namespace OpenSim.Framework.Communications.Caches
private string m_assetName = ""; private string m_assetName = "";
private LLUUID m_folderID; private LLUUID m_folderID;
private LLUUID newAssetID; private LLUUID newAssetID;
private bool SaveImages = false; private bool m_dumpImageToFile;
private string uploaderPath = ""; private string uploaderPath = "";
// Events // Events
public event UpLoadedAsset OnUpLoad; public event UpLoadedAsset OnUpLoad;
// Methods // Methods
public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer) public void Initialise(string assetName, string assetDescription, LLUUID assetID, LLUUID inventoryItem, LLUUID folderID, string path, BaseHttpServer httpServer, bool dumpImageToFile)
{ {
this.m_assetName = assetName; this.m_assetName = assetName;
this.m_assetDescription = assetDescription; this.m_assetDescription = assetDescription;
@ -138,6 +140,7 @@ namespace OpenSim.Framework.Communications.Caches
this.inventoryItemID = inventoryItem; this.inventoryItemID = inventoryItem;
this.uploaderPath = path; this.uploaderPath = path;
this.httpListener = httpServer; this.httpListener = httpServer;
m_dumpImageToFile = dumpImageToFile;
} }
private void SaveImageToFile(string filename, byte[] data) private void SaveImageToFile(string filename, byte[] data)
@ -159,7 +162,7 @@ namespace OpenSim.Framework.Communications.Caches
complete.state = "complete"; complete.state = "complete";
text = LLSDHelpers.SerialiseLLSDReply(complete); text = LLSDHelpers.SerialiseLLSDReply(complete);
this.httpListener.RemoveStreamHandler("POST", this.uploaderPath); this.httpListener.RemoveStreamHandler("POST", this.uploaderPath);
if (this.SaveImages) if (this.m_dumpImageToFile)
{ {
this.SaveImageToFile(this.m_assetName + ".jp2", data); this.SaveImageToFile(this.m_assetName + ".jp2", data);
} }
@ -190,10 +193,12 @@ namespace OpenSim.Framework.Communications.Caches
private bool m_createItem = false; private bool m_createItem = false;
private AgentAssetTransactions m_userTransactions; private AgentAssetTransactions m_userTransactions;
private bool m_storeLocal; private bool m_storeLocal;
private bool m_dumpAssetToFile;
public AssetXferUploader(AgentAssetTransactions transactions) public AssetXferUploader(AgentAssetTransactions transactions, bool dumpAssetToFile)
{ {
this.m_userTransactions = transactions; this.m_userTransactions = transactions;
m_dumpAssetToFile = dumpAssetToFile;
} }
// Methods // Methods
@ -278,9 +283,14 @@ namespace OpenSim.Framework.Communications.Caches
this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset); this.m_userTransactions.Manager.CommsManager.AssetCache.AddAsset(this.Asset);
} }
// Console.WriteLine("upload complete "+ this.TransactionID); // Console.WriteLine("upload complete "+ this.TransactionID);
//SaveAssetToFile("testudpupload" + Util.RandomClass.Next(1, 1000) + ".dat", this.Asset.Data);
if (m_dumpAssetToFile)
{
SaveAssetToFile("testudpupload" + Util.RandomClass.Next(1, 1000) + ".dat", this.Asset.Data);
}
} }
private void SaveAssetToFile(string filename, byte[] data) private void SaveAssetToFile(string filename, byte[] data)
{ {
FileStream fs = File.Create(filename); FileStream fs = File.Create(filename);

View File

@ -27,7 +27,6 @@
*/ */
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications.Cache namespace OpenSim.Framework.Communications.Cache
{ {
@ -35,7 +34,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
private readonly CommunicationsManager m_parentCommsManager; private readonly CommunicationsManager m_parentCommsManager;
// Fields // Fields
public InventoryFolder RootFolder = null; public InventoryFolderImpl RootFolder = null;
public UserProfileData UserProfile = null; public UserProfileData UserProfile = null;
public CachedUserInfo(CommunicationsManager commsManager) public CachedUserInfo(CommunicationsManager commsManager)
@ -44,7 +43,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
// Methods // Methods
public void FolderReceive(LLUUID userID, InventoryFolder folderInfo) public void FolderReceive(LLUUID userID, InventoryFolderImpl folderInfo)
{ {
if (userID == this.UserProfile.UUID) if (userID == this.UserProfile.UUID)
{ {
@ -61,7 +60,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
else else
{ {
InventoryFolder folder = this.RootFolder.HasSubFolder(folderInfo.parentID); InventoryFolderImpl folder = this.RootFolder.HasSubFolder(folderInfo.parentID);
if (folder != null) if (folder != null)
{ {
folder.SubFolders.Add(folderInfo.folderID, folderInfo); folder.SubFolders.Add(folderInfo.folderID, folderInfo);
@ -80,7 +79,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
else else
{ {
InventoryFolder folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID); InventoryFolderImpl folder = this.RootFolder.HasSubFolder(itemInfo.parentFolderID);
if (folder != null) if (folder != null)
{ {
folder.Items.Add(itemInfo.inventoryID, itemInfo); folder.Items.Add(itemInfo.inventoryID, itemInfo);

View File

@ -35,15 +35,15 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Cache
{ {
public class InventoryFolder : InventoryFolderBase public class InventoryFolderImpl : InventoryFolderBase
{ {
// Fields // Fields
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
public Dictionary<LLUUID, InventoryFolder> SubFolders = new Dictionary<LLUUID, InventoryFolder>(); public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
public InventoryFolder(InventoryFolderBase folderbase) public InventoryFolderImpl(InventoryFolderBase folderbase)
{ {
this.agentID = folderbase.agentID; this.agentID = folderbase.agentID;
this.folderID = folderbase.folderID; this.folderID = folderbase.folderID;
@ -53,15 +53,15 @@ namespace OpenSim.Framework.Communications.Caches
this.version = folderbase.version; this.version = folderbase.version;
} }
public InventoryFolder() public InventoryFolderImpl()
{ {
} }
// Methods // Methods
public InventoryFolder CreateNewSubFolder(LLUUID folderID, string folderName, ushort type) public InventoryFolderImpl CreateNewSubFolder(LLUUID folderID, string folderName, ushort type)
{ {
InventoryFolder subFold = new InventoryFolder(); InventoryFolderImpl subFold = new InventoryFolderImpl();
subFold.name = folderName; subFold.name = folderName;
subFold.folderID = folderID; subFold.folderID = folderID;
subFold.type = (short) type; subFold.type = (short) type;
@ -78,7 +78,7 @@ namespace OpenSim.Framework.Communications.Caches
{ {
return this.Items[itemID]; return this.Items[itemID];
} }
foreach (InventoryFolder folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in this.SubFolders.Values)
{ {
base2 = folder.HasItem(itemID); base2 = folder.HasItem(itemID);
if (base2 != null) if (base2 != null)
@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Caches
Items.Remove(itemID); Items.Remove(itemID);
return true; return true;
} }
foreach (InventoryFolder folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in this.SubFolders.Values)
{ {
found = folder.DeleteItem(itemID); found = folder.DeleteItem(itemID);
if (found == true) if (found == true)
@ -109,16 +109,16 @@ namespace OpenSim.Framework.Communications.Caches
} }
public InventoryFolder HasSubFolder(LLUUID folderID) public InventoryFolderImpl HasSubFolder(LLUUID folderID)
{ {
InventoryFolder returnFolder = null; InventoryFolderImpl returnFolder = null;
if (this.SubFolders.ContainsKey(folderID)) if (this.SubFolders.ContainsKey(folderID))
{ {
returnFolder = this.SubFolders[folderID]; returnFolder = this.SubFolders[folderID];
} }
else else
{ {
foreach (InventoryFolder folder in this.SubFolders.Values) foreach (InventoryFolderImpl folder in this.SubFolders.Values)
{ {
returnFolder = folder.HasSubFolder(folderID); returnFolder = folder.HasSubFolder(folderID);
if (returnFolder != null) if (returnFolder != null)

View File

@ -35,16 +35,16 @@ using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using Nini.Config; using Nini.Config;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Cache
{ {
/// <summary> /// <summary>
/// Basically a hack to give us a Inventory library while we don't have a inventory server /// Basically a hack to give us a Inventory library while we don't have a inventory server
/// once the server is fully implemented then should read the data from that /// once the server is fully implemented then should read the data from that
/// </summary> /// </summary>
public class LibraryRootFolder : InventoryFolder public class LibraryRootFolder : Cache.InventoryFolderImpl
{ {
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000"); private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
private InventoryFolder m_textureFolder; private Cache.InventoryFolderImpl m_textureFolder;
public LibraryRootFolder() public LibraryRootFolder()
{ {
@ -55,7 +55,7 @@ namespace OpenSim.Framework.Communications.Caches
this.type = (short)-1; this.type = (short)-1;
this.version = (ushort)1; this.version = (ushort)1;
InventoryFolder folderInfo = new InventoryFolder(); Cache.InventoryFolderImpl folderInfo = new InventoryFolderImpl();
folderInfo.agentID = libOwner; folderInfo.agentID = libOwner;
folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001"); folderInfo.folderID = new LLUUID("00000112-000f-0000-0000-000100bba001");
folderInfo.name = "Texture Library"; folderInfo.name = "Texture Library";

View File

@ -36,7 +36,7 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
namespace OpenSim.Framework.Communications.Caches namespace OpenSim.Framework.Communications.Cache
{ {
public class UserProfileCache public class UserProfileCache
{ {
@ -107,15 +107,15 @@ namespace OpenSim.Framework.Communications.Caches
CachedUserInfo info = this.UserProfiles[remoteClient.AgentId]; CachedUserInfo info = this.UserProfiles[remoteClient.AgentId];
if (info.RootFolder.folderID == parentID) if (info.RootFolder.folderID == parentID)
{ {
InventoryFolder createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType); InventoryFolderImpl createdFolder = info.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
if (createdFolder != null) if (createdFolder != null)
{ {
this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder); this.m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdFolder);
} }
} }
else else
{ {
InventoryFolder folder = info.RootFolder.HasSubFolder(parentID); InventoryFolderImpl folder = info.RootFolder.HasSubFolder(parentID);
if (folder != null) if (folder != null)
{ {
folder.CreateNewSubFolder(folderID, folderName, folderType); folder.CreateNewSubFolder(folderID, folderName, folderType);
@ -127,7 +127,7 @@ namespace OpenSim.Framework.Communications.Caches
public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) public void HandleFecthInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder)
{ {
InventoryFolder fold = null; InventoryFolderImpl fold = null;
if (folderID == libraryRoot.folderID ) if (folderID == libraryRoot.folderID )
{ {
remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems());
@ -150,7 +150,7 @@ namespace OpenSim.Framework.Communications.Caches
} }
else else
{ {
InventoryFolder folder = info.RootFolder.HasSubFolder(folderID); InventoryFolderImpl folder = info.RootFolder.HasSubFolder(folderID);
if ((folder != null) && fetchItems) if ((folder != null) && fetchItems)
{ {
remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems()); remoteClient.SendInventoryFolderDetails(remoteClient.AgentId, folderID, folder.RequestListOfItems());
@ -185,7 +185,7 @@ namespace OpenSim.Framework.Communications.Caches
/// <param name="userID"></param> /// <param name="userID"></param>
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo) private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
{ {
this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive); this.m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
} }
/// <summary> /// <summary>
@ -224,4 +224,3 @@ namespace OpenSim.Framework.Communications.Caches
} }
} }
} }

View File

@ -61,8 +61,9 @@ namespace OpenSim.Region.Capabilities
private Queue<string> CapsEventQueue = new Queue<string>(); private Queue<string> CapsEventQueue = new Queue<string>();
public NewInventoryItem AddNewInventoryItem = null; public NewInventoryItem AddNewInventoryItem = null;
public ItemUpdatedCallback ItemUpdatedCall = null; public ItemUpdatedCallback ItemUpdatedCall = null;
private bool m_dumpAssetsToFile;
public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent) public Caps(AssetCache assetCach, BaseHttpServer httpServer, string httpListen, int httpPort, string capsPath, LLUUID agent, bool dumpAssetsToFile)
{ {
assetCache = assetCach; assetCache = assetCach;
m_capsObjectPath = capsPath; m_capsObjectPath = capsPath;
@ -70,6 +71,7 @@ namespace OpenSim.Region.Capabilities
m_httpListenerHostName = httpListen; m_httpListenerHostName = httpListen;
m_httpListenPort = httpPort; m_httpListenPort = httpPort;
agentID = agent; agentID = agent;
m_dumpAssetsToFile = dumpAssetsToFile;
} }
/// <summary> /// <summary>
@ -250,7 +252,7 @@ namespace OpenSim.Region.Capabilities
LLUUID newInvItem = llsdRequest.item_id; LLUUID newInvItem = llsdRequest.item_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener); ItemUpdater uploader = new ItemUpdater(newInvItem, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile );
uploader.OnUpLoad += this.ItemUpdated; uploader.OnUpLoad += this.ItemUpdated;
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
@ -280,7 +282,7 @@ namespace OpenSim.Region.Capabilities
LLUUID parentFolder = llsdRequest.folder_id; LLUUID parentFolder = llsdRequest.folder_id;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener); AssetUploader uploader = new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, llsdRequest.asset_type, capsBase + uploaderPath, this.httpListener, m_dumpAssetsToFile);
httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps)); httpListener.AddStreamHandler(new BinaryStreamHandler("POST", capsBase + uploaderPath, uploader.uploaderCaps));
string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath; string uploaderURL = "http://" + m_httpListenerHostName + ":" + m_httpListenPort.ToString() + capsBase + uploaderPath;
@ -360,21 +362,14 @@ namespace OpenSim.Region.Capabilities
private LLUUID inventoryItemID; private LLUUID inventoryItemID;
private LLUUID parentFolder; private LLUUID parentFolder;
private BaseHttpServer httpListener; private BaseHttpServer httpListener;
private bool SaveAssets = false; private bool m_dumpAssetsToFile;
private string m_assetName = ""; private string m_assetName = "";
private string m_assetDes = ""; private string m_assetDes = "";
private string m_invType = ""; private string m_invType = "";
private string m_assetType = ""; private string m_assetType = "";
/// <summary> public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer, bool dumpAssetsToFile)
///
/// </summary>
/// <param name="assetID"></param>
/// <param name="inventoryItem"></param>
/// <param name="path"></param>
/// <param name="httpServer"></param>
public AssetUploader(string assetName, string description, LLUUID assetID, LLUUID inventoryItem, LLUUID parentFolderID, string invType, string assetType, string path, BaseHttpServer httpServer)
{ {
m_assetName = assetName; m_assetName = assetName;
m_assetDes = description; m_assetDes = description;
@ -385,7 +380,7 @@ namespace OpenSim.Region.Capabilities
parentFolder = parentFolderID; parentFolder = parentFolderID;
m_assetType = assetType; m_assetType = assetType;
m_invType = invType; m_invType = invType;
m_dumpAssetsToFile = dumpAssetsToFile;
} }
/// <summary> /// <summary>
@ -408,8 +403,10 @@ namespace OpenSim.Region.Capabilities
httpListener.RemoveStreamHandler("POST", uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if(this.SaveAssets) if (this.m_dumpAssetsToFile)
{
this.SaveAssetToFile(m_assetName + ".jp2", data); this.SaveAssetToFile(m_assetName + ".jp2", data);
}
if (OnUpLoad != null) if (OnUpLoad != null)
{ {
@ -436,18 +433,11 @@ namespace OpenSim.Region.Capabilities
private string uploaderPath = ""; private string uploaderPath = "";
private LLUUID inventoryItemID; private LLUUID inventoryItemID;
private BaseHttpServer httpListener; private BaseHttpServer httpListener;
private bool SaveAssets = false; private bool m_dumpAssetToFile;
public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer, bool dumpAssetToFile)
/// <summary>
///
/// </summary>
/// <param name="assetID"></param>
/// <param name="inventoryItem"></param>
/// <param name="path"></param>
/// <param name="httpServer"></param>
public ItemUpdater( LLUUID inventoryItem, string path, BaseHttpServer httpServer)
{ {
m_dumpAssetToFile = dumpAssetToFile;
inventoryItemID = inventoryItem; inventoryItemID = inventoryItem;
uploaderPath = path; uploaderPath = path;
@ -481,8 +471,10 @@ namespace OpenSim.Region.Capabilities
httpListener.RemoveStreamHandler("POST", uploaderPath); httpListener.RemoveStreamHandler("POST", uploaderPath);
if (this.SaveAssets) if (this.m_dumpAssetToFile)
this.SaveAssetToFile("updateditem"+Util.RandomClass.Next(1,1000) + ".dat", data); {
this.SaveAssetToFile("updateditem" + Util.RandomClass.Next(1, 1000) + ".dat", data);
}
return res; return res;
} }

View File

@ -28,7 +28,6 @@
using System; using System;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
@ -87,12 +86,12 @@ namespace OpenSim.Framework.Communications
get { return m_networkServersInfo; } get { return m_networkServersInfo; }
} }
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache) public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, bool dumpAssetsToFile)
{ {
m_networkServersInfo = serversInfo; m_networkServersInfo = serversInfo;
m_assetCache = assetCache; m_assetCache = assetCache;
m_userProfileCache = new UserProfileCache(this); m_userProfileCache = new UserProfileCache(this);
m_transactionsManager = new AssetTransactionManager(this); m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile );
} }
public void doCreate(string[] cmmdParams) public void doCreate(string[] cmmdParams)

View File

@ -30,19 +30,18 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications.Caches; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolder folderInfo); public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo); public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
public interface IInventoryServices public interface IInventoryServices
{ {
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder);
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
void CreateNewUserInventory(LLUUID user); void CreateNewUserInventory(LLUUID user);

View File

@ -31,9 +31,9 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Framework.Communications namespace OpenSim.Framework.Communications
{ {
@ -232,7 +232,7 @@ namespace OpenSim.Framework.Communications
} }
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack); public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder); public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder);
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item); public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
} }

View File

@ -38,16 +38,10 @@ using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Configuration; using OpenSim.Framework.Configuration;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
/*
using System.Text;
using Db4objects.Db4o;
using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities;
using OpenSim.Framework.Communications.Caches;
*/
namespace OpenSim.Grid.AssetServer namespace OpenSim.Grid.AssetServer
{ {
/// <summary> /// <summary>

View File

@ -44,7 +44,7 @@ using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using System.Globalization; using System.Globalization;
using RegionInfo=OpenSim.Framework.Types.RegionInfo; using RegionInfo = OpenSim.Framework.Types.RegionInfo;
namespace OpenSim namespace OpenSim
{ {
@ -78,21 +78,25 @@ namespace OpenSim
private readonly string m_logFilename = ("region-console.log"); private readonly string m_logFilename = ("region-console.log");
private bool m_permissions = false; private bool m_permissions = false;
private bool standaloneAuthenticate = false; private bool m_standaloneAuthenticate = false;
private string standaloneWelcomeMessage = null; private string m_standaloneWelcomeMessage = null;
private string standaloneInventoryPlugin = "OpenSim.Framework.Data.SQLite.dll"; private string m_standaloneInventoryPlugin = "OpenSim.Framework.Data.SQLite.dll";
private string standaloneAssetPlugin = "OpenSim.Framework.Data.SQLite.dll"; private string m_standaloneAssetPlugin = "OpenSim.Framework.Data.SQLite.dll";
private string standaloneUserPlugin = "OpenSim.Framework.Data.DB4o.dll"; private string m_standaloneUserPlugin = "OpenSim.Framework.Data.DB4o.dll";
private string m_assetStorage = "db4o"; private string m_assetStorage = "db4o";
public ConsoleCommand CreateAccount = null; public ConsoleCommand CreateAccount = null;
private bool m_dumpAssetsToFile;
public OpenSimMain(IConfigSource configSource) public OpenSimMain(IConfigSource configSource)
: base() : base()
{ {
string iniFile = configSource.Configs["Startup"].GetString("inifile", "OpenSim.ini"); IConfig startupConfig = configSource.Configs["Startup"];
string useExecutePathString = configSource.Configs["Startup"].GetString("useexecutepath", "false").ToLower();
string iniFile = startupConfig.GetString("inifile", "OpenSim.ini");
string useExecutePathString = startupConfig.GetString("useexecutepath", "false").ToLower();
bool useExecutePath = false; bool useExecutePath = false;
if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes") if (useExecutePathString == "true" || useExecutePathString == "" || useExecutePathString == "1" || useExecutePathString == "yes")
{ {
@ -112,38 +116,57 @@ namespace OpenSim
//(as if someone has bothered to enter a command line arg, we should take notice of it) //(as if someone has bothered to enter a command line arg, we should take notice of it)
m_config.Merge(configSource); m_config.Merge(configSource);
} }
else
{
m_config = configSource;
}
ReadConfigSettings(); ReadConfigSettings();
} }
protected void ReadConfigSettings() protected void ReadConfigSettings()
{ {
m_networkServersInfo = new NetworkServersInfo(); m_networkServersInfo = new NetworkServersInfo();
m_sandbox = !m_config.Configs["Startup"].GetBoolean("gridmode", false);
m_physicsEngine = m_config.Configs["Startup"].GetString("physics", "basicphysics");
m_verbose = m_config.Configs["Startup"].GetBoolean("verbose", true);
m_permissions = m_config.Configs["Startup"].GetBoolean("serverside_object_permissions", false);
m_storageDLL = m_config.Configs["Startup"].GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll"); IConfig startupConfig = m_config.Configs["Startup"];
m_startupCommandsFile = m_config.Configs["Startup"].GetString("startup_console_commands_file", ""); if (startupConfig != null )
m_shutdownCommandsFile = m_config.Configs["Startup"].GetString("shutdown_console_commands_file", ""); {
m_sandbox = !startupConfig.GetBoolean("gridmode", false);
m_physicsEngine = startupConfig.GetString("physics", "basicphysics");
m_verbose = startupConfig.GetBoolean("verbose", true);
m_permissions = startupConfig.GetBoolean("serverside_object_permissions", false);
m_scriptEngine = m_config.Configs["Startup"].GetString("script_engine", "DotNetEngine"); m_storageDLL = startupConfig.GetString("storage_plugin", "OpenSim.DataStore.NullStorage.dll");
m_assetStorage = m_config.Configs["Startup"].GetString("asset_database", "db4o"); m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "");
m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "");
m_config.Configs["Startup"].GetBoolean("default_modules", true); m_scriptEngine = startupConfig.GetString("script_engine", "DotNetEngine");
m_config.Configs["Startup"].GetBoolean("default_shared_modules", true);
m_config.Configs["Startup"].GetString("except_modules", ""); m_assetStorage = startupConfig.GetString("asset_database", "db4o");
m_config.Configs["Startup"].GetString("except_shared_modules", "");
// wtf?
startupConfig.GetBoolean("default_modules", true);
startupConfig.GetBoolean("default_shared_modules", true);
startupConfig.GetString("except_modules", "");
startupConfig.GetString("except_shared_modules", "");
}
IConfig standaloneConfig = m_config.Configs["StandAlone"];
if (standaloneConfig != null)
{
m_standaloneAuthenticate = standaloneConfig.GetBoolean("accounts_authenticate", false);
m_standaloneWelcomeMessage = standaloneConfig.GetString("welcome_message", "Welcome to OpenSim");
m_standaloneInventoryPlugin =
standaloneConfig.GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
m_standaloneUserPlugin =
standaloneConfig.GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
m_standaloneAssetPlugin = standaloneConfig.GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
m_dumpAssetsToFile = standaloneConfig.GetBoolean("dump_assets_to_file", false);
}
standaloneAuthenticate = m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", false);
standaloneWelcomeMessage = m_config.Configs["StandAlone"].GetString("welcome_message", "Welcome to OpenSim");
standaloneInventoryPlugin = m_config.Configs["StandAlone"].GetString("inventory_plugin", "OpenSim.Framework.Data.SQLite.dll");
standaloneUserPlugin = m_config.Configs["StandAlone"].GetString("userDatabase_plugin", "OpenSim.Framework.Data.DB4o.dll");
standaloneAssetPlugin = m_config.Configs["StandAlone"].GetString("asset_plugin", "OpenSim.Framework.Data.SQLite.dll");
m_networkServersInfo.loadFromConfiguration(m_config); m_networkServersInfo.loadFromConfiguration(m_config);
} }
@ -168,22 +191,22 @@ namespace OpenSim
if (m_sandbox) if (m_sandbox)
{ {
LocalInventoryService inventoryService = new LocalInventoryService(); LocalInventoryService inventoryService = new LocalInventoryService();
inventoryService.AddPlugin(standaloneInventoryPlugin); inventoryService.AddPlugin(m_standaloneInventoryPlugin);
LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService ); LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService);
userService.AddPlugin( standaloneUserPlugin ); userService.AddPlugin(m_standaloneUserPlugin);
LocalBackEndServices backendService = new LocalBackEndServices(); LocalBackEndServices backendService = new LocalBackEndServices();
CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService); CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, m_dumpAssetsToFile);
m_commsManager = localComms; m_commsManager = localComms;
m_loginService = new LocalLoginService(userService, standaloneWelcomeMessage, localComms, m_networkServersInfo, standaloneAuthenticate); m_loginService = new LocalLoginService(userService, m_standaloneWelcomeMessage, localComms, m_networkServersInfo, m_standaloneAuthenticate);
m_loginService.OnLoginToRegion += backendService.AddNewSession; m_loginService.OnLoginToRegion += backendService.AddNewSession;
m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod); m_httpServer.AddXmlRPCHandler("login_to_simulator", m_loginService.XmlRpcLoginMethod);
if (standaloneAuthenticate) if (m_standaloneAuthenticate)
{ {
this.CreateAccount = localComms.doCreate; this.CreateAccount = localComms.doCreate;
} }
@ -209,7 +232,7 @@ namespace OpenSim
configFiles = Directory.GetFiles(regionConfigPath, "*.xml"); configFiles = Directory.GetFiles(regionConfigPath, "*.xml");
} }
m_moduleLoader = new ModuleLoader( m_log, m_config ); m_moduleLoader = new ModuleLoader(m_log, m_config);
MainLog.Instance.Verbose("Loading Shared Modules"); MainLog.Instance.Verbose("Loading Shared Modules");
m_moduleLoader.LoadDefaultSharedModules(); m_moduleLoader.LoadDefaultSharedModules();
@ -240,10 +263,10 @@ namespace OpenSim
} }
else else
{ {
MainLog.Instance.Verbose("STARTUP","No startup command script specified. Moving on..."); MainLog.Instance.Verbose("STARTUP", "No startup command script specified. Moving on...");
} }
MainLog.Instance.Status("STARTUP","Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)"); MainLog.Instance.Status("STARTUP", "Startup complete, serving " + m_udpServers.Count.ToString() + " region(s)");
} }
public UDPServer CreateRegion(RegionInfo regionInfo) public UDPServer CreateRegion(RegionInfo regionInfo)
@ -289,7 +312,7 @@ namespace OpenSim
protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager) protected override Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager, AgentCircuitManager circuitManager)
{ {
return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader); return new Scene(regionInfo, circuitManager, m_commsManager, m_assetCache, storageManager, m_httpServer, m_moduleLoader, m_dumpAssetsToFile);
} }
protected override void Initialize() protected override void Initialize()
@ -307,7 +330,7 @@ namespace OpenSim
} }
else else
{ {
SQLAssetServer sqlAssetServer = new SQLAssetServer(standaloneAssetPlugin); SQLAssetServer sqlAssetServer = new SQLAssetServer(m_standaloneAssetPlugin);
sqlAssetServer.LoadDefaultAssets(); sqlAssetServer.LoadDefaultAssets();
assetServer = sqlAssetServer; assetServer = sqlAssetServer;
} }
@ -408,7 +431,7 @@ namespace OpenSim
} }
else else
{ {
MainLog.Instance.Error("COMMANDFILE","Command script missing. Can not run commands"); MainLog.Instance.Error("COMMANDFILE", "Command script missing. Can not run commands");
} }
} }

View File

@ -35,8 +35,15 @@ namespace OpenSim.Region.Communications.Local
{ {
public class CommunicationsLocal : CommunicationsManager public class CommunicationsLocal : CommunicationsManager
{ {
public CommunicationsLocal(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache, IUserService userService, LocalInventoryService inventoryService, IInterRegionCommunications interRegionService, IGridServices gridService) public CommunicationsLocal(
: base(serversInfo, httpServer, assetCache) NetworkServersInfo serversInfo,
BaseHttpServer httpServer,
AssetCache assetCache,
IUserService userService,
LocalInventoryService inventoryService,
IInterRegionCommunications interRegionService,
IGridServices gridService, bool dumpAssetsToFile )
: base(serversInfo, httpServer, assetCache, dumpAssetsToFile)
{ {
m_inventoryService = inventoryService; m_inventoryService = inventoryService;
m_userService = userService; m_userService = userService;

View File

@ -29,8 +29,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder=OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.Local namespace OpenSim.Region.Communications.Local
{ {
@ -45,14 +45,14 @@ namespace OpenSim.Region.Communications.Local
public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack) public override void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack)
{ {
List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID); List<InventoryFolderBase> folders = this.RequestFirstLevelFolders(userID);
InventoryFolder rootFolder = null; InventoryFolderImpl rootFolder = null;
//need to make sure we send root folder first //need to make sure we send root folder first
foreach (InventoryFolderBase folder in folders) foreach (InventoryFolderBase folder in folders)
{ {
if (folder.parentID == libsecondlife.LLUUID.Zero) if (folder.parentID == libsecondlife.LLUUID.Zero)
{ {
InventoryFolder newfolder = new InventoryFolder(folder); InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
rootFolder = newfolder; rootFolder = newfolder;
folderCallBack(userID, newfolder); folderCallBack(userID, newfolder);
} }
@ -64,7 +64,7 @@ namespace OpenSim.Region.Communications.Local
{ {
if (folder.folderID != rootFolder.folderID) if (folder.folderID != rootFolder.folderID)
{ {
InventoryFolder newfolder = new InventoryFolder(folder); InventoryFolderImpl newfolder = new InventoryFolderImpl(folder);
folderCallBack(userID, newfolder); folderCallBack(userID, newfolder);
List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID); List<InventoryItemBase> items = this.RequestFolderItems(newfolder.folderID);
@ -77,7 +77,7 @@ namespace OpenSim.Region.Communications.Local
} }
} }
public override void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) public override void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
{ {
this.AddFolder(folder); this.AddFolder(folder);
} }

View File

@ -36,7 +36,7 @@ namespace OpenSim.Region.Communications.OGS1
{ {
public class CommunicationsOGS1 : CommunicationsManager public class CommunicationsOGS1 : CommunicationsManager
{ {
public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) :base(serversInfo, httpServer, assetCache) public CommunicationsOGS1(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache ) :base(serversInfo, httpServer, assetCache, false)
{ {
OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer); OGS1GridServices gridInterComms = new OGS1GridServices(serversInfo, httpServer);
m_gridService = gridInterComms; m_gridService = gridInterComms;

View File

@ -29,8 +29,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using libsecondlife; using libsecondlife;
using OpenSim.Framework.Communications; using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using InventoryFolder = OpenSim.Framework.Communications.Caches.InventoryFolder;
namespace OpenSim.Region.Communications.OGS1 namespace OpenSim.Region.Communications.OGS1
@ -50,7 +50,7 @@ namespace OpenSim.Region.Communications.OGS1
} }
public void AddNewInventoryFolder(LLUUID userID, InventoryFolder folder) public void AddNewInventoryFolder(LLUUID userID, InventoryFolderImpl folder)
{ {
} }

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Framework.Types;
namespace OpenSim.Region.Environment.Interfaces
{
public interface IAvatarFactory : IRegionModule
{
bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams);
}
}

View File

@ -67,12 +67,18 @@ namespace OpenSim.Region.Environment
{ {
DynamicTextureModule dynamicModule = new DynamicTextureModule(); DynamicTextureModule dynamicModule = new DynamicTextureModule();
LoadedSharedModules.Add(dynamicModule.Name, dynamicModule); LoadedSharedModules.Add(dynamicModule.Name, dynamicModule);
ChatModule chat = new ChatModule(); ChatModule chat = new ChatModule();
LoadedSharedModules.Add(chat.Name, chat); LoadedSharedModules.Add(chat.Name, chat);
InstantMessageModule imMod = new InstantMessageModule(); InstantMessageModule imMod = new InstantMessageModule();
LoadedSharedModules.Add(imMod.Name, imMod); LoadedSharedModules.Add(imMod.Name, imMod);
LoadImageURLModule loadMod = new LoadImageURLModule(); LoadImageURLModule loadMod = new LoadImageURLModule();
LoadedSharedModules.Add(loadMod.Name, loadMod); LoadedSharedModules.Add(loadMod.Name, loadMod);
AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
LoadedSharedModules.Add(avatarFactory.Name, avatarFactory);
} }
public void InitialiseSharedModules(Scene scene) public void InitialiseSharedModules(Scene scene)

View File

@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using Nini.Config;
using OpenSim.Framework.Types;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Environment.Modules
{
public class AvatarFactoryModule : IAvatarFactory
{
public bool TryGetIntialAvatarAppearance(LLUUID avatarId, out AvatarWearable[] wearables, out byte[] visualParams)
{
GetDefaultAvatarAppearance(out wearables, out visualParams);
return true;
}
public void Initialise(Scene scene, IConfigSource source)
{
scene.RegisterModuleInterface<IAvatarFactory>(this);
}
public void PostInitialise()
{
}
public void Close()
{
}
public string Name
{
get { return "Default Avatar Factory"; }
}
public bool IsSharedModule
{
get { return true; }
}
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
{
visualParams = new byte[218];
for (int i = 0; i < 218; i++)
{
visualParams[i] = 100;
}
wearables = AvatarWearable.DefaultWearables;
}
}
}

View File

@ -126,7 +126,9 @@ namespace OpenSim.Region.Environment.Modules
LLUUID fromAgentID = LLUUID.Zero; LLUUID fromAgentID = LLUUID.Zero;
if (e.Sender != null) if (e.Sender != null)
{
avatar = scene.GetScenePresence(e.Sender.AgentId); avatar = scene.GetScenePresence(e.Sender.AgentId);
}
if (avatar != null) if (avatar != null)
{ {

View File

@ -30,7 +30,6 @@ using Axiom.Math;
using libsecondlife; using libsecondlife;
using libsecondlife.Packets; using libsecondlife.Packets;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Communications.Caches;
using OpenSim.Framework.Interfaces; using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types; using OpenSim.Framework.Types;
using OpenSim.Framework.Utilities; using OpenSim.Framework.Utilities;

View File

@ -50,6 +50,7 @@ using OpenSim.Region.Environment.Types;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Terrain; using OpenSim.Region.Terrain;
using Timer = System.Timers.Timer; using Timer = System.Timers.Timer;
using OpenSim.Region.Environment.Modules;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -90,11 +91,11 @@ namespace OpenSim.Region.Environment.Scenes
public IXfer XferManager; public IXfer XferManager;
private IHttpRequests m_httpRequestModule = null; private IHttpRequests m_httpRequestModule;
private ISimChat m_simChatModule = null; private ISimChat m_simChatModule;
private IXMLRPC m_xmlrpcModule = null; private IXMLRPC m_xmlrpcModule;
private IWorldComm m_worldCommModule = null; private IWorldComm m_worldCommModule;
private IAvatarFactory m_AvatarFactory;
// Central Update Loop // Central Update Loop
@ -165,7 +166,7 @@ namespace OpenSim.Region.Environment.Scenes
public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan, public Scene(RegionInfo regInfo, AgentCircuitManager authen, CommunicationsManager commsMan,
AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer,
ModuleLoader moduleLoader) ModuleLoader moduleLoader, bool dumpAssetsToFile)
{ {
updateLock = new Mutex(false); updateLock = new Mutex(false);
@ -205,6 +206,7 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence.LoadAnims(); ScenePresence.LoadAnims();
httpListener = httpServer; httpListener = httpServer;
m_dumpAssetsToFile = dumpAssetsToFile;
} }
#endregion #endregion
@ -215,7 +217,6 @@ namespace OpenSim.Region.Environment.Scenes
m_httpRequestModule = RequestModuleInterface<IHttpRequests>(); m_httpRequestModule = RequestModuleInterface<IHttpRequests>();
m_xmlrpcModule = RequestModuleInterface<IXMLRPC>(); m_xmlrpcModule = RequestModuleInterface<IXMLRPC>();
m_worldCommModule = RequestModuleInterface<IWorldComm>(); m_worldCommModule = RequestModuleInterface<IWorldComm>();
XferManager = RequestModuleInterface<IXfer>(); XferManager = RequestModuleInterface<IXfer>();
} }
@ -855,7 +856,15 @@ namespace OpenSim.Region.Environment.Scenes
{ {
ScenePresence newAvatar = null; ScenePresence newAvatar = null;
newAvatar = new ScenePresence(client, this, m_regInfo); byte[] visualParams;
AvatarWearable[] wearables;
if( m_AvatarFactory == null || !m_AvatarFactory.TryGetIntialAvatarAppearance( client.AgentId, out wearables, out visualParams))
{
AvatarFactoryModule.GetDefaultAvatarAppearance(out wearables, out visualParams);
}
newAvatar = new ScenePresence(client, this, m_regInfo, visualParams, wearables);
newAvatar.IsChildAgent = child; newAvatar.IsChildAgent = child;
if (child) if (child)
@ -1096,7 +1105,8 @@ namespace OpenSim.Region.Environment.Scenes
//Console.WriteLine("new user, so creating caps handler for it"); //Console.WriteLine("new user, so creating caps handler for it");
Caps cap = Caps cap =
new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port, new Caps(commsManager.AssetCache, httpListener, m_regInfo.ExternalHostName, httpListener.Port,
agent.CapsPath, agent.AgentID); agent.CapsPath, agent.AgentID, m_dumpAssetsToFile);
Util.SetCapsURL(agent.AgentID, Util.SetCapsURL(agent.AgentID,
"http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() + "http://" + m_regInfo.ExternalHostName + ":" + httpListener.Port.ToString() +
"/CAPS/" + agent.CapsPath + "0000/"); "/CAPS/" + agent.CapsPath + "0000/");
@ -1456,6 +1466,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Script Engine #region Script Engine
private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>(); private List<ScriptEngineInterface> ScriptEngines = new List<ScriptEngineInterface>();
private bool m_dumpAssetsToFile;
public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger) public void AddScriptEngine(ScriptEngineInterface ScriptEngine, LogBase m_logger)
{ {

View File

@ -53,8 +53,8 @@ namespace OpenSim.Region.Environment.Scenes
private short m_updateCount = 0; private short m_updateCount = 0;
private Quaternion bodyRot; private Quaternion bodyRot;
private byte[] visualParams; private byte[] m_visualParams;
private AvatarWearable[] Wearables; private AvatarWearable[] m_wearables;
private LLObject.TextureEntry m_textureEntry; private LLObject.TextureEntry m_textureEntry;
public bool IsRestrictedToRegion = false; public bool IsRestrictedToRegion = false;
@ -90,10 +90,10 @@ namespace OpenSim.Region.Environment.Scenes
//public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>(); //public List<SceneObjectGroup> InterestList = new List<SceneObjectGroup>();
// private string m_currentQuadNode = " "; // private string m_currentQuadNode = " ";
// private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>(); // private Queue<SceneObjectPart> m_fullPartUpdates = new Queue<SceneObjectPart>();
//private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>(); //private Queue<SceneObjectPart> m_tersePartUpdates = new Queue<SceneObjectPart>();
private UpdateQueue m_partsUpdateQueue = new UpdateQueue(); private UpdateQueue m_partsUpdateQueue = new UpdateQueue();
private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>(); private Dictionary<LLUUID, ScenePartUpdate> m_updateTimes = new Dictionary<LLUUID, ScenePartUpdate>();
@ -220,14 +220,7 @@ namespace OpenSim.Region.Environment.Scenes
#region Constructor(s) #region Constructor(s)
/// <summary> public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, AvatarWearable[] wearables)
///
/// </summary>
/// <param name="client"></param>
/// <param name="world"></param>
/// <param name="clientThreads"></param>
/// <param name="regionDat"></param>
public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo)
{ {
m_scene = world; m_scene = world;
m_uuid = client.AgentId; m_uuid = client.AgentId;
@ -240,13 +233,9 @@ namespace OpenSim.Region.Environment.Scenes
m_localId = m_scene.NextLocalId; m_localId = m_scene.NextLocalId;
AbsolutePosition = m_controllingClient.StartPos; AbsolutePosition = m_controllingClient.StartPos;
visualParams = new byte[218]; m_visualParams = visualParams;
for (int i = 0; i < 218; i++) m_wearables = wearables;
{
visualParams[i] = 100;
}
Wearables = AvatarWearable.DefaultWearables;
Animations = new AvatarAnimations(); Animations = new AvatarAnimations();
Animations.LoadAnims(); Animations.LoadAnims();
@ -351,7 +340,7 @@ namespace OpenSim.Region.Environment.Scenes
AbsolutePosition = pos; AbsolutePosition = pos;
AddToPhysicalScene( ); AddToPhysicalScene();
m_physicsActor.Flying = isFlying; m_physicsActor.Flying = isFlying;
@ -410,7 +399,7 @@ namespace OpenSim.Region.Environment.Scenes
for (int i = 0; i < visualParam.Length; i++) for (int i = 0; i < visualParam.Length; i++)
{ {
visualParams[i] = visualParam[i].ParamValue; m_visualParams[i] = visualParam[i].ParamValue;
} }
SendAppearanceToAllOtherAgents(); SendAppearanceToAllOtherAgents();
@ -459,7 +448,7 @@ namespace OpenSim.Region.Environment.Scenes
Vector3 agent_control_v3 = new Vector3(0, 0, 0); Vector3 agent_control_v3 = new Vector3(0, 0, 0);
Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
bool oldflying = PhysicsActor.Flying; bool oldflying = PhysicsActor.Flying;
PhysicsActor.Flying = ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
if (PhysicsActor.Flying != oldflying) if (PhysicsActor.Flying != oldflying)
{ {
update_movementflag = true; update_movementflag = true;
@ -470,23 +459,23 @@ namespace OpenSim.Region.Environment.Scenes
bodyRot = q; bodyRot = q;
update_rotation = true; update_rotation = true;
} }
foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof (Dir_ControlFlags))) foreach (Dir_ControlFlags DCF in Enum.GetValues(typeof(Dir_ControlFlags)))
{ {
if ((flags & (uint) DCF) != 0) if ((flags & (uint)DCF) != 0)
{ {
DCFlagKeyPressed = true; DCFlagKeyPressed = true;
agent_control_v3 += Dir_Vectors[i]; agent_control_v3 += Dir_Vectors[i];
if ((m_movementflag & (uint) DCF) == 0) if ((m_movementflag & (uint)DCF) == 0)
{ {
m_movementflag += (byte) (uint) DCF; m_movementflag += (byte)(uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
else else
{ {
if ((m_movementflag & (uint) DCF) != 0) if ((m_movementflag & (uint)DCF) != 0)
{ {
m_movementflag -= (byte) (uint) DCF; m_movementflag -= (byte)(uint)DCF;
update_movementflag = true; update_movementflag = true;
} }
} }
@ -531,10 +520,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
NewForce newVelocity = new NewForce(); NewForce newVelocity = new NewForce();
Vector3 direc = rotation*vec; Vector3 direc = rotation * vec;
direc.Normalize(); direc.Normalize();
direc = direc*((0.03f)*128f); direc = direc * ((0.03f) * 128f);
if (m_physicsActor.Flying) if (m_physicsActor.Flying)
direc *= 4; direc *= 4;
@ -619,7 +608,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
public void SendTerseUpdateToAllClients() public void SendTerseUpdateToAllClients()
{ {
m_scene.Broadcast( SendTerseUpdateToClient ); m_scene.Broadcast(SendTerseUpdateToClient);
} }
public void SendCoarseLocations() public void SendCoarseLocations()
@ -628,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes
List<ScenePresence> avatars = m_scene.GetAvatars(); List<ScenePresence> avatars = m_scene.GetAvatars();
for (int i = 0; i < avatars.Count; i++) for (int i = 0; i < avatars.Count; i++)
{ {
if (avatars[i] != this ) if (avatars[i] != this)
{ {
CoarseLocations.Add(avatars[i].AbsolutePosition); CoarseLocations.Add(avatars[i].AbsolutePosition);
} }
@ -695,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="OurClient"></param> /// <param name="OurClient"></param>
public void SendOurAppearance(IClientAPI OurClient) public void SendOurAppearance(IClientAPI OurClient)
{ {
m_controllingClient.SendWearables(Wearables); m_controllingClient.SendWearables(m_wearables);
//this.SendFullUpdateToAllClients(); //this.SendFullUpdateToAllClients();
//this.SendAppearanceToAllOtherAgents(); //this.SendAppearanceToAllOtherAgents();
@ -734,7 +723,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="avatarInfo"></param> /// <param name="avatarInfo"></param>
public void SendAppearanceToOtherAgent(ScenePresence avatarInfo) public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
{ {
avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, visualParams, avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
m_textureEntry.ToBytes()); m_textureEntry.ToBytes());
} }
@ -793,9 +782,9 @@ namespace OpenSim.Region.Environment.Scenes
LLVector3 vel = Velocity; LLVector3 vel = Velocity;
float timeStep = 0.1f; float timeStep = 0.1f;
pos2.X = pos2.X + (vel.X*timeStep); pos2.X = pos2.X + (vel.X * timeStep);
pos2.Y = pos2.Y + (vel.Y*timeStep); pos2.Y = pos2.Y + (vel.Y * timeStep);
pos2.Z = pos2.Z + (vel.Z*timeStep); pos2.Z = pos2.Z + (vel.Z * timeStep);
if ((pos2.X < 0) || (pos2.X > 256)) if ((pos2.X < 0) || (pos2.X > 256))
{ {
@ -840,7 +829,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
LLVector3 vel = m_velocity; LLVector3 vel = m_velocity;
ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * 256), (uint)(neighboury * 256));
RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); RegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
if (neighbourRegion != null) if (neighbourRegion != null)
{ {
@ -940,7 +929,7 @@ namespace OpenSim.Region.Environment.Scenes
throw new Exception("Can't set Text on avatar."); throw new Exception("Can't set Text on avatar.");
} }
public void AddToPhysicalScene( ) public void AddToPhysicalScene()
{ {
PhysicsScene scene = m_scene.PhysScene; PhysicsScene scene = m_scene.PhysScene;
@ -948,7 +937,7 @@ namespace OpenSim.Region.Environment.Scenes
new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
AbsolutePosition.Z); AbsolutePosition.Z);
m_physicsActor = scene.AddAvatar(this.Firstname+"."+this.Lastname, pVec); m_physicsActor = scene.AddAvatar(this.Firstname + "." + this.Lastname, pVec);
} }
internal void Close() internal void Close()

View File

@ -47,7 +47,7 @@ namespace SimpleApp
private List<ScenePresence> m_avatars; private List<ScenePresence> m_avatars;
public MyWorld( RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, ModuleLoader moduleLoader) public MyWorld( RegionInfo regionInfo, AgentCircuitManager authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer, ModuleLoader moduleLoader)
: base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader) : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer, moduleLoader, false)
{ {
m_avatars = new List<Avatar>(); m_avatars = new List<Avatar>();
} }

View File

@ -72,7 +72,7 @@ namespace SimpleApp
LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService); LocalUserServices userService = new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, m_networkServersInfo.DefaultHomeLocY, inventoryService);
LocalBackEndServices backendService = new LocalBackEndServices(); LocalBackEndServices backendService = new LocalBackEndServices();
CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService); CommunicationsLocal localComms = new CommunicationsLocal(m_networkServersInfo, m_httpServer, m_assetCache, userService, inventoryService, backendService, backendService, false);
m_commsManager = localComms; m_commsManager = localComms;
LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false); LocalLoginService loginService = new LocalLoginService(userService, "", localComms, m_networkServersInfo, false);

View File

@ -23,7 +23,7 @@ inventory_plugin = "OpenSim.Framework.Data.SQLite.dll"
userDatabase_plugin = "OpenSim.Framework.Data.SQLite.dll" userDatabase_plugin = "OpenSim.Framework.Data.SQLite.dll"
default_location_x = 1000 default_location_x = 1000
default_location_y = 1000 default_location_y = 1000
dump_assets_to_file = false
[Network] [Network]
http_listener_port = 9000 http_listener_port = 9000