Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
commit
acfe2d9f4e
|
@ -69,7 +69,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
|||
|
||||
protected CommunicationsManager m_commsManager;
|
||||
protected GridInfoService m_gridInfoService;
|
||||
protected IHyperlink HGServices = null;
|
||||
|
||||
protected IRegionCreator m_regionCreator;
|
||||
|
||||
|
@ -144,7 +143,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
|||
// We are in grid mode
|
||||
InitialiseHGGridServices(libraryRootFolder);
|
||||
}
|
||||
HGCommands.HGServices = HGServices;
|
||||
}
|
||||
|
||||
protected void InitialiseStandardServices(LibraryRootFolder libraryRootFolder)
|
||||
|
@ -187,19 +185,12 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
|||
}
|
||||
|
||||
protected virtual void InitialiseHGStandaloneServices(LibraryRootFolder libraryRootFolder)
|
||||
{
|
||||
HGGridServicesStandalone gridService
|
||||
= new HGGridServicesStandalone(
|
||||
m_openSim.NetServersInfo, m_httpServer, m_openSim.SceneManager);
|
||||
|
||||
{
|
||||
m_commsManager
|
||||
= new HGCommunicationsStandalone(
|
||||
m_openSim.ConfigurationSettings, m_openSim.NetServersInfo, m_httpServer,
|
||||
gridService,
|
||||
libraryRootFolder, false);
|
||||
libraryRootFolder, false);
|
||||
|
||||
HGServices = gridService;
|
||||
|
||||
CreateGridInfoService();
|
||||
}
|
||||
|
||||
|
@ -210,8 +201,6 @@ namespace OpenSim.ApplicationPlugins.CreateCommsManager
|
|||
m_openSim.NetServersInfo,
|
||||
m_openSim.SceneManager, libraryRootFolder);
|
||||
|
||||
HGServices = ((HGCommunicationsGridMode) m_commsManager).HGServices;
|
||||
|
||||
m_httpServer.AddStreamHandler(new OpenSim.SimStatusHandler());
|
||||
m_httpServer.AddStreamHandler(new OpenSim.XSimStatusHandler(m_openSim));
|
||||
if (m_openSim.userStatsURI != String.Empty)
|
||||
|
|
|
@ -69,7 +69,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
private string m_name = "RemoteAdminPlugin";
|
||||
private string m_version = "0.0";
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
//guard for XmlRpc-related methods
|
||||
private void FailIfRemoteAdminDisabled(string requestName)
|
||||
{
|
||||
|
@ -142,7 +141,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
availableMethods["admin_acl_remove"] = XmlRpcAccessListRemove;
|
||||
availableMethods["admin_acl_list"] = XmlRpcAccessListList;
|
||||
|
||||
// Either enable full remote functionality or just selected features
|
||||
// Either enable full remote functionality or just selected features
|
||||
string enabledMethods = m_config.GetString("enabled_methods", "all");
|
||||
|
||||
// To get this, you must explicitly specify "all" or
|
||||
|
@ -469,7 +468,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: CreateRegion: new request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("CreateRegion");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -477,7 +475,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
lock (rslock)
|
||||
{
|
||||
|
||||
int m_regionLimit = m_config.GetInt("region_limit", 0);
|
||||
bool m_enableVoiceForNewRegions = m_config.GetBoolean("create_region_enable_voice", false);
|
||||
bool m_publicAccess = m_config.GetBoolean("create_region_public", true);
|
||||
|
@ -502,7 +499,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
// check whether we still have space left (iff we are using limits)
|
||||
if (m_regionLimit != 0 && m_app.SceneManager.Scenes.Count >= m_regionLimit)
|
||||
throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first",
|
||||
throw new Exception(String.Format("cannot instantiate new region, server capacity {0} already reached; delete regions first",
|
||||
m_regionLimit));
|
||||
// extract or generate region ID now
|
||||
Scene scene = null;
|
||||
|
@ -561,7 +558,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
scene.RegionInfo.RegionName, scene.RegionInfo.RegionID,
|
||||
scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY));
|
||||
|
||||
|
||||
region.ExternalHostName = (string) requestData["external_address"];
|
||||
|
||||
string masterFirst = (string) requestData["region_master_first"];
|
||||
|
@ -580,10 +576,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (masterFirst != String.Empty && masterLast != String.Empty) // User requests a master avatar
|
||||
{
|
||||
// no client supplied UUID: look it up...
|
||||
CachedUserInfo userInfo
|
||||
CachedUserInfo userInfo
|
||||
= m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(
|
||||
masterFirst, masterLast);
|
||||
|
||||
|
||||
if (null == userInfo)
|
||||
{
|
||||
m_log.InfoFormat("master avatar does not exist, creating it");
|
||||
|
@ -636,7 +632,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
m_log.DebugFormat("[RADMIN] CreateRegion: persisting region {0} to {1}",
|
||||
region.RegionID, regionXmlPath);
|
||||
region.SaveRegionToFile("dynamic region", regionXmlPath);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
region.Persistent = false;
|
||||
|
@ -664,7 +660,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
parcel.landData.Flags |= (uint) ParcelFlags.AllowVoiceChat;
|
||||
parcel.landData.Flags |= (uint) ParcelFlags.UseEstateVoiceChan;
|
||||
((Scene)newscene).LandChannel.UpdateLandObject(parcel.landData.LocalID, parcel.landData);
|
||||
((Scene)newscene).LandChannel.UpdateLandObject(parcel.landData.LocalID, parcel.landData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -684,7 +680,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
response.Value = responseData;
|
||||
}
|
||||
|
||||
|
||||
m_log.Info("[RADMIN]: CreateRegion: request complete");
|
||||
return response;
|
||||
}
|
||||
|
@ -756,7 +752,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Close a region.
|
||||
/// <summary>
|
||||
|
@ -798,7 +794,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
Hashtable requestData = (Hashtable) request.Params[0];
|
||||
checkStringParameters(request, new string[] {"password"});
|
||||
|
||||
|
||||
if (requestData.ContainsKey("region_id") &&
|
||||
!String.IsNullOrEmpty((string) requestData["region_id"]))
|
||||
{
|
||||
|
@ -899,8 +895,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (!m_app.SceneManager.TryGetScene(regionName, out scene))
|
||||
throw new Exception(String.Format("region \"{0}\" does not exist", regionName));
|
||||
|
||||
// Modify access
|
||||
scene.RegionInfo.EstateSettings.PublicAccess =
|
||||
// Modify access
|
||||
scene.RegionInfo.EstateSettings.PublicAccess =
|
||||
getBoolean(requestData,"public", scene.RegionInfo.EstateSettings.PublicAccess);
|
||||
if (scene.RegionInfo.Persistent)
|
||||
scene.RegionInfo.EstateSettings.Save();
|
||||
|
@ -988,8 +984,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
public XmlRpcResponse XmlRpcCreateUserMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[RADMIN]: CreateUser: new request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
|
||||
FailIfRemoteAdminDisabled("CreateUser");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -1024,13 +1019,13 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (requestData.Contains("user_email"))
|
||||
email = (string)requestData["user_email"];
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CachedUserInfo userInfo =
|
||||
m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
|
||||
|
||||
|
||||
if (null != userInfo)
|
||||
throw new Exception(String.Format("Avatar {0} {1} already exists", firstname, lastname));
|
||||
|
||||
UUID userID =
|
||||
UUID userID =
|
||||
m_app.CommunicationsManager.UserAdminService.AddUser(firstname, lastname,
|
||||
passwd, email, regX, regY);
|
||||
|
||||
|
@ -1101,7 +1096,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: UserExists: new request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("UserExists");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -1117,8 +1111,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
string firstname = (string) requestData["user_firstname"];
|
||||
string lastname = (string) requestData["user_lastname"];
|
||||
|
||||
CachedUserInfo userInfo
|
||||
= m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
|
||||
CachedUserInfo userInfo
|
||||
= m_app.CommunicationsManager.UserProfileCacheService.GetUserDetails(firstname, lastname);
|
||||
|
||||
responseData["user_firstname"] = firstname;
|
||||
responseData["user_lastname"] = lastname;
|
||||
|
@ -1131,10 +1125,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
else
|
||||
{
|
||||
responseData["success"] = true;
|
||||
responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
|
||||
responseData["lastlogin"] = userInfo.UserProfile.LastLogin;
|
||||
}
|
||||
|
||||
|
||||
response.Value = responseData;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -1252,7 +1245,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (requestData.ContainsKey("about_virtual_world"))
|
||||
aboutAvatar = (string)requestData["about_virtual_world"];
|
||||
|
||||
UserProfileData userProfile
|
||||
UserProfileData userProfile
|
||||
= m_app.CommunicationsManager.UserService.GetUserProfile(firstname, lastname);
|
||||
|
||||
if (null == userProfile)
|
||||
|
@ -1308,20 +1301,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
m_log.Info("[RADMIN]: UpdateUserAccount: request complete");
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is called by the user-create and user-modify methods to establish
|
||||
/// or change, the user's appearance. Default avatar names can be specified via
|
||||
/// the config file, but must correspond to avatars in the default appearance
|
||||
/// the config file, but must correspond to avatars in the default appearance
|
||||
/// file, or pre-existing in the user database.
|
||||
/// This should probably get moved into somewhere more core eventually.
|
||||
/// </summary>
|
||||
|
||||
private void updateUserAppearance(Hashtable responseData, Hashtable requestData, UUID userid)
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[RADMIN] updateUserAppearance");
|
||||
|
||||
string dmale = m_config.GetString("default_male", "Default Male");
|
||||
|
@ -1347,7 +1338,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Has an explicit model been specified?
|
||||
|
||||
if (requestData.Contains("model"))
|
||||
|
@ -1384,7 +1375,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
return;
|
||||
}
|
||||
|
||||
// Set current user's appearance. This bit is easy. The appearance structure is populated with
|
||||
// Set current user's appearance. This bit is easy. The appearance structure is populated with
|
||||
// actual asset ids, however to complete the magic we need to populate the inventory with the
|
||||
// assets in question.
|
||||
|
||||
|
@ -1393,7 +1384,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
m_log.DebugFormat("[RADMIN] Finished setting appearance for avatar {0}, using model {1}",
|
||||
userid, model);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This method is called by updateAvatarAppearance once any specified model has been
|
||||
/// ratified, or an appropriate default value has been adopted. The intended prototype
|
||||
|
@ -1402,19 +1393,18 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
private void establishAppearance(UUID dest, UUID srca)
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Initializing inventory for {0} from {1}", dest, srca);
|
||||
|
||||
AvatarAppearance ava = m_app.CommunicationsManager.AvatarService.GetUserAppearance(srca);
|
||||
|
||||
// If the model has no associated appearance we're done.
|
||||
|
||||
// if (ava == null)
|
||||
// if (ava == null)
|
||||
// {
|
||||
// return new AvatarAppearance();
|
||||
// }
|
||||
|
||||
if (ava == null)
|
||||
if (ava == null)
|
||||
return;
|
||||
|
||||
UICallback sic = new UICallback();
|
||||
|
@ -1423,7 +1413,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
Dictionary<UUID,UUID> imap = new Dictionary<UUID,UUID>();
|
||||
|
||||
iserv.GetUserInventory(dest, dic.callback);
|
||||
|
@ -1434,7 +1423,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
if (sic.OK && dic.OK)
|
||||
{
|
||||
|
||||
InventoryFolderImpl efolder;
|
||||
InventoryFolderImpl srcf = sic.root.FindFolderForType(5);
|
||||
InventoryFolderImpl dstf = dic.root.FindFolderForType(5);
|
||||
|
@ -1460,7 +1448,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (item.Folder == folder.ID)
|
||||
{
|
||||
InventoryItemBase dsti = new InventoryItemBase();
|
||||
dsti.ID = UUID.Random();
|
||||
dsti.ID = UUID.Random();
|
||||
dsti.Name = item.Name;
|
||||
dsti.Description = item.Description;
|
||||
dsti.InvType = item.InvType;
|
||||
|
@ -1494,7 +1482,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
ava.SetWearable(i, dw);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1502,7 +1489,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
|
||||
m_app.CommunicationsManager.AvatarService.UpdateUserAppearance(dest, ava);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -1510,16 +1496,15 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
dest, e.Message);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// This method is called if a given model avatar name can not be found. If the external
|
||||
/// file has already been loaded once, then control returns immediately. If not, then it
|
||||
/// file has already been loaded once, then control returns immediately. If not, then it
|
||||
/// looks for a default appearance file. This file contains XML definitions of zero or more named
|
||||
/// avatars, each avatar can specify zero or more "outfits". Each outfit is a collection
|
||||
/// avatars, each avatar can specify zero or more "outfits". Each outfit is a collection
|
||||
/// of items that together, define a particular ensemble for the avatar. Each avatar should
|
||||
/// indicate which outfit is the default, and this outfit will be automatically worn. The
|
||||
/// other outfits are provided to allow "real" avatars a way to easily change their outfits.
|
||||
|
@ -1527,7 +1512,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
private bool createDefaultAvatars()
|
||||
{
|
||||
|
||||
// Only load once
|
||||
|
||||
if (daload)
|
||||
|
@ -1543,10 +1527,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
try
|
||||
{
|
||||
|
||||
string dafn = null;
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
|
||||
//m_config may be null if RemoteAdmin configuration secition is missing or disabled in OpenSim.ini
|
||||
if (m_config != null)
|
||||
{
|
||||
|
@ -1555,7 +1537,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
if (File.Exists(dafn))
|
||||
{
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
string name = "*unknown*";
|
||||
string email = "anon@anon";
|
||||
|
@ -1630,12 +1611,12 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
|
||||
m_log.DebugFormat("[RADMIN] User {0}[{1}] created or retrieved", name, ID);
|
||||
include = true;
|
||||
include = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.DebugFormat("[RADMIN] Error creating user {0} : {1}", name, e.Message);
|
||||
include = false;
|
||||
include = false;
|
||||
}
|
||||
|
||||
// OK, User has been created OK, now we can install the inventory.
|
||||
|
@ -1654,7 +1635,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
mava = new AvatarAppearance();
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
AvatarWearable[] wearables = mava.Wearables;
|
||||
for (int i=0; i<wearables.Length; i++)
|
||||
|
@ -1670,8 +1651,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
if (uic.OK)
|
||||
try
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory",
|
||||
m_log.DebugFormat("[RADMIN] {0} folders, {1} items in inventory",
|
||||
uic.folders.Count, uic.items.Count);
|
||||
|
||||
InventoryFolderImpl cfolder = uic.root.FindFolderForType(5);
|
||||
|
@ -1699,7 +1679,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
foreach (XmlElement outfit in outfits)
|
||||
{
|
||||
|
||||
m_log.DebugFormat("[RADMIN] Loading outfit {0} for {1}",
|
||||
GetStringAttribute(outfit,"name","?"), GetStringAttribute(avatar,"name","?"));
|
||||
|
||||
|
@ -1707,7 +1686,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
select = (GetStringAttribute(outfit,"default","no") == "yes");
|
||||
efolder = null;
|
||||
|
||||
// If the folder already exists, re-use it. The defaults may
|
||||
// If the folder already exists, re-use it. The defaults may
|
||||
// change over time. Augment only.
|
||||
foreach (InventoryFolderImpl folder in uic.folders)
|
||||
{
|
||||
|
@ -1756,10 +1735,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
InventoryItemBase iitem = null;
|
||||
|
||||
if ((iitem = efolder.FindAsset(assetid)) == null)
|
||||
if ((iitem = efolder.FindAsset(assetid)) == null)
|
||||
{
|
||||
iitem = new InventoryItemBase();
|
||||
iitem.ID = UUID.Random();
|
||||
iitem.ID = UUID.Random();
|
||||
iitem.Name = GetStringAttribute(item,"name","");
|
||||
iitem.Description = GetStringAttribute(item,"desc","");
|
||||
iitem.InvType = GetIntegerAttribute(item,"invtype",-1);
|
||||
|
@ -1820,9 +1799,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load an OAR file into a region..
|
||||
/// <summary>
|
||||
|
@ -1859,9 +1837,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: Received Load OAR Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Load OAR");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -1962,9 +1939,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: Received Save OAR Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Save OAR");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -2003,7 +1979,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
IRegionArchiverModule archiver = scene.RequestModuleInterface<IRegionArchiverModule>();
|
||||
|
||||
|
||||
if (archiver != null)
|
||||
{
|
||||
scene.EventManager.OnOarFileSaved += RemoteAdminOarSaveCompleted;
|
||||
|
@ -2014,11 +1989,9 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
else
|
||||
throw new Exception("Archiver module not present for scene");
|
||||
|
||||
|
||||
responseData["saved"] = true;
|
||||
|
||||
response.Value = responseData;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2045,7 +2018,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: Received Load XML Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Load XML");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -2129,12 +2101,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public XmlRpcResponse XmlRpcSaveXMLMethod(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
m_log.Info("[RADMIN]: Received Save XML Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Save XML");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -2220,7 +2190,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: Received Query XML Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Query XML");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -2255,9 +2224,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
else throw new Exception("neither region_name nor region_uuid given");
|
||||
|
||||
Scene s = m_app.SceneManager.CurrentScene;
|
||||
|
||||
int health = s.GetHealth();
|
||||
|
||||
responseData["health"] = health;
|
||||
|
||||
response.Value = responseData;
|
||||
|
@ -2280,7 +2247,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
m_log.Info("[RADMIN]: Received Command XML Administrator Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Command XML");
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
|
@ -2320,12 +2286,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public XmlRpcResponse XmlRpcAccessListClear(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
|
||||
m_log.Info("[RADMIN]: Received Access List Clear Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Access List Clear");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -2360,7 +2324,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
s.RegionInfo.EstateSettings.EstateAccess = new UUID[]{};
|
||||
if (s.RegionInfo.Persistent)
|
||||
s.RegionInfo.EstateSettings.Save();
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2368,7 +2331,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2381,12 +2343,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public XmlRpcResponse XmlRpcAccessListAdd(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
|
||||
m_log.Info("[RADMIN]: Received Access List Add Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Access List Add");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -2419,7 +2379,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
int addk = 0;
|
||||
|
||||
if (requestData.Contains("users"))
|
||||
if (requestData.Contains("users"))
|
||||
{
|
||||
UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
|
||||
Scene s = m_app.SceneManager.CurrentScene;
|
||||
|
@ -2450,7 +2410,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
|
||||
responseData["added"] = addk;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2458,7 +2417,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2471,12 +2429,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public XmlRpcResponse XmlRpcAccessListRemove(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
|
||||
m_log.Info("[RADMIN]: Received Access List Remove Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Access List Remove");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -2509,7 +2465,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
int remk = 0;
|
||||
|
||||
if (requestData.Contains("users"))
|
||||
if (requestData.Contains("users"))
|
||||
{
|
||||
UserProfileCacheService ups = m_app.CommunicationsManager.UserProfileCacheService;
|
||||
Scene s = m_app.SceneManager.CurrentScene;
|
||||
|
@ -2539,7 +2495,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
|
||||
responseData["removed"] = remk;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2547,7 +2502,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2560,12 +2514,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public XmlRpcResponse XmlRpcAccessListList(XmlRpcRequest request, IPEndPoint remoteClient)
|
||||
{
|
||||
|
||||
m_log.Info("[RADMIN]: Received Access List List Request");
|
||||
|
||||
//AnakinLohner 0.6.5-post-fixes
|
||||
FailIfRemoteAdminDisabled("Access List List");
|
||||
|
||||
|
||||
XmlRpcResponse response = new XmlRpcResponse();
|
||||
Hashtable responseData = new Hashtable();
|
||||
|
||||
|
@ -2608,9 +2560,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
users[user.ToString()] = udata.UserProfile.Name;
|
||||
}
|
||||
}
|
||||
|
||||
responseData["users"] = users;
|
||||
|
||||
responseData["users"] = users;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -2618,7 +2569,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
responseData["success"] = false;
|
||||
responseData["error"] = e.Message;
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -2695,12 +2645,10 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class UICallback
|
||||
{
|
||||
|
||||
private Object uilock = new Object();
|
||||
internal InventoryFolderImpl root = null;
|
||||
internal List<InventoryFolderImpl> folders;
|
||||
|
@ -2720,7 +2668,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
|
||||
public void GetInventory()
|
||||
{
|
||||
|
||||
Dictionary<UUID, InventoryFolderImpl> fmap = new Dictionary<UUID, InventoryFolderImpl>();
|
||||
|
||||
if (OK == false)
|
||||
|
@ -2729,7 +2676,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
if (OK == false)
|
||||
System.Threading.Monitor.Wait(uilock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Got the inventory OK. So now merge the content of the default appearance
|
||||
|
@ -2774,8 +2721,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
{
|
||||
fmap[item.Folder].Items.Add(item.ID, item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
// This plugin will only be enabled if the broader
|
||||
// REST plugin mechanism is enabled.
|
||||
|
||||
Rest.Log.InfoFormat("{0} Plugin is initializing", MsgId);
|
||||
//Rest.Log.InfoFormat("{0} Plugin is initializing", MsgId);
|
||||
|
||||
base.Initialise(openSim);
|
||||
|
||||
|
@ -216,7 +216,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
|||
|
||||
if (!IsEnabled)
|
||||
{
|
||||
Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
|
||||
//Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -218,7 +218,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
httpResponse.ContentType = "text/xml";
|
||||
|
||||
IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>();
|
||||
if (serialiser != null)
|
||||
if (serialiser != null)
|
||||
serialiser.SavePrimsToXml2(scene, new StreamWriter(httpResponse.OutputStream), min, max);
|
||||
|
||||
return "";
|
||||
|
|
|
@ -68,9 +68,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
|||
base.Initialise(openSim);
|
||||
if (!IsEnabled)
|
||||
{
|
||||
m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
|
||||
//m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
|
||||
return;
|
||||
}
|
||||
|
||||
m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
|
||||
|
||||
// add REST method handlers
|
||||
|
|
|
@ -216,7 +216,7 @@ namespace OpenSim.ApplicationPlugins.Rest
|
|||
|
||||
if (!_config.GetBoolean("enabled", false))
|
||||
{
|
||||
m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
|
||||
//m_log.WarnFormat("{0} Rest Plugins are disabled", MsgID);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace OpenSim.Client.Linden
|
|||
{
|
||||
if (m_firstScene != null)
|
||||
{
|
||||
return m_firstScene.CommsManager.GridService.RegionLoginsEnabled;
|
||||
return m_firstScene.SceneGridService.RegionLoginsEnabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace OpenSim.Client.Linden
|
|||
{
|
||||
if (m_firstScene != null)
|
||||
{
|
||||
return m_firstScene.CommsManager.GridService.RegionLoginsEnabled;
|
||||
return m_firstScene.SceneGridService.RegionLoginsEnabled;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace OpenSim.Client.MXP.ClientStack
|
|||
String typeName = ToOmType(primShape.PCode);
|
||||
m_log.Info("[MXP ClientStack] Transmitting Primitive" + typeName);
|
||||
|
||||
PerceptionEventMessage pe = new PerceptionEventMessage();
|
||||
PerceptionEventMessage pe = new PerceptionEventMessage();
|
||||
pe.ObjectFragment.ObjectId = objectID.Guid;
|
||||
|
||||
pe.ObjectFragment.ParentObjectId = Guid.Empty;
|
||||
|
|
|
@ -39,13 +39,15 @@ namespace OpenSim.Data
|
|||
public string RegionName;
|
||||
public int posX;
|
||||
public int posY;
|
||||
public int sizeX;
|
||||
public int sizeY;
|
||||
public Dictionary<string, object> Data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface for connecting to the authentication datastore
|
||||
/// </summary>
|
||||
public interface IRegionData
|
||||
public interface IRegionData
|
||||
{
|
||||
RegionData Get(UUID regionID, UUID ScopeID);
|
||||
List<RegionData> Get(string regionName, UUID ScopeID);
|
||||
|
@ -57,5 +59,6 @@ namespace OpenSim.Data
|
|||
bool SetDataItem(UUID principalID, string item, string value);
|
||||
|
||||
bool Delete(UUID regionID);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace OpenSim.Data.MSSQL
|
|||
(@id, @name, @description, @assetType, @local,
|
||||
@temporary, @create_time, @access_time, @data)";
|
||||
|
||||
string assetName = asset.Name;
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
|
@ -223,7 +223,7 @@ namespace OpenSim.Data.MSSQL
|
|||
local = @local, temporary = @temporary, data = @data
|
||||
WHERE id = @keyId;";
|
||||
|
||||
string assetName = asset.Name;
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace OpenSim.Data.MSSQL
|
|||
|
||||
insertBuilder.AppendFormat("insert into '{0}' ('UUID', '", m_Realm);
|
||||
insertBuilder.Append(String.Join("', '", fields));
|
||||
insertBuilder.Append("') values ( @principalID, @");
|
||||
insertBuilder.Append("') values (@principalID, @");
|
||||
insertBuilder.Append(String.Join(", @", fields));
|
||||
insertBuilder.Append(")");
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ namespace OpenSim.Data.MSSQL
|
|||
@inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType,
|
||||
@creationDate, @groupID, @groupOwned, @flags)";
|
||||
|
||||
string itemName = item.Name;
|
||||
string itemName = item.Name;
|
||||
if (item.Name.Length > 64)
|
||||
{
|
||||
itemName = item.Name.Substring(0, 64);
|
||||
|
@ -529,7 +529,7 @@ namespace OpenSim.Data.MSSQL
|
|||
{
|
||||
itemDesc = item.Description.Substring(0, 128);
|
||||
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters on update");
|
||||
}
|
||||
}
|
||||
|
||||
using (AutoClosingSqlCommand command = database.Query(sql))
|
||||
{
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace OpenSim.Data.MSSQL
|
|||
sceneObjectPart.Name, sceneObjectPart.UUID, sceneObjectPart.GroupPosition, groupID);
|
||||
|
||||
sceneObjectPart.UUID = groupID;
|
||||
}
|
||||
}
|
||||
|
||||
grp = new SceneObjectGroup(sceneObjectPart);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace OpenSim.Data.MSSQL
|
|||
conn.Open();
|
||||
Migration m = new Migration(conn, GetType().Assembly, "UserStore");
|
||||
m.Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<UserAccountData> Query(UUID principalID, UUID scopeID, string query)
|
||||
|
@ -152,7 +152,7 @@ namespace OpenSim.Data.MSSQL
|
|||
StringBuilder insertBuilder = new StringBuilder();
|
||||
insertBuilder.AppendFormat("insert into '{0}' ('UUID', 'ScopeID', '", m_Realm);
|
||||
insertBuilder.Append(String.Join("', '", fields));
|
||||
insertBuilder.Append("') values ( @principalID, @scopeID, @");
|
||||
insertBuilder.Append("') values (@principalID, @scopeID, @");
|
||||
insertBuilder.Append(String.Join(", @", fields));
|
||||
insertBuilder.Append(")");
|
||||
|
||||
|
|
|
@ -1146,7 +1146,7 @@ ELSE
|
|||
if (reader.IsDBNull(reader.GetOrdinal("homeRegionID")))
|
||||
retval.HomeRegionID = UUID.Zero;
|
||||
else
|
||||
retval.HomeRegionID = new UUID((Guid)reader["homeRegionID"]);
|
||||
retval.HomeRegionID = new UUID((Guid)reader["homeRegionID"]);
|
||||
|
||||
retval.Created = Convert.ToInt32(reader["created"].ToString());
|
||||
retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
|
||||
|
@ -1200,7 +1200,7 @@ ELSE
|
|||
if (reader.IsDBNull(reader.GetOrdinal("partner")))
|
||||
retval.Partner = UUID.Zero;
|
||||
else
|
||||
retval.Partner = new UUID((Guid)reader["partner"]);
|
||||
retval.Partner = new UUID((Guid)reader["partner"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -204,7 +204,7 @@ namespace OpenSim.Data.MySQL
|
|||
"VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)",
|
||||
_dbConnection.Connection);
|
||||
|
||||
string assetName = asset.Name;
|
||||
string assetName = asset.Name;
|
||||
if (asset.Name.Length > 64)
|
||||
{
|
||||
assetName = asset.Name.Substring(0, 64);
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values ( ?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
"`) values (?principalID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
|
|
|
@ -325,10 +325,10 @@ namespace OpenSim.Data.MySQL
|
|||
UUID GroupID = UUID.Zero;
|
||||
UUID.TryParse((string)reader["avatarID"], out Owner);
|
||||
UUID.TryParse((string)reader["groupID"], out GroupID);
|
||||
item.Owner = Owner;
|
||||
item.Owner = Owner;
|
||||
item.GroupID = GroupID;
|
||||
|
||||
// Rest of the parsing. If these UUID's fail, we're dead anyway
|
||||
// Rest of the parsing. If these UUID's fail, we're dead anyway
|
||||
item.ID = new UUID((string) reader["inventoryID"]);
|
||||
item.AssetID = new UUID((string) reader["assetID"]);
|
||||
item.AssetType = (int) reader["assetType"];
|
||||
|
@ -472,7 +472,7 @@ namespace OpenSim.Data.MySQL
|
|||
+ ", ?inventoryBasePermissions, ?inventoryEveryOnePermissions, ?inventoryGroupPermissions, ?salePrice, ?saleType, ?creationDate"
|
||||
+ ", ?groupID, ?groupOwned, ?flags)";
|
||||
|
||||
string itemName = item.Name;
|
||||
string itemName = item.Name;
|
||||
if (item.Name.Length > 64)
|
||||
{
|
||||
itemName = item.Name.Substring(0, 64);
|
||||
|
@ -484,7 +484,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
itemDesc = item.Description.Substring(0, 128);
|
||||
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length + " to " + itemDesc.Length + " characters on add item");
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -590,12 +590,12 @@ namespace OpenSim.Data.MySQL
|
|||
"REPLACE INTO inventoryfolders (folderID, agentID, parentFolderID, folderName, type, version) VALUES ";
|
||||
sql += "(?folderID, ?agentID, ?parentFolderID, ?folderName, ?type, ?version)";
|
||||
|
||||
string folderName = folder.Name;
|
||||
string folderName = folder.Name;
|
||||
if (folderName.Length > 64)
|
||||
{
|
||||
folderName = folderName.Substring(0, 64);
|
||||
m_log.Warn("[INVENTORY DB]: Name field truncated from " + folder.Name.Length + " to " + folderName.Length + " characters on add folder");
|
||||
}
|
||||
}
|
||||
|
||||
database.CheckConnection();
|
||||
|
||||
|
|
|
@ -464,7 +464,7 @@ namespace OpenSim.Data.MySQL
|
|||
prim.Name, prim.UUID, prim.GroupPosition, groupID);
|
||||
|
||||
prim.UUID = groupID;
|
||||
}
|
||||
}
|
||||
|
||||
grp = new SceneObjectGroup(prim);
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ namespace OpenSim.Data.MySQL
|
|||
/// <summary>
|
||||
/// Load in a prim's persisted inventory.
|
||||
/// </summary>
|
||||
/// <param name="prim">The prim</param>
|
||||
/// <param name="prim">The prim</param>
|
||||
private void LoadItems(SceneObjectPart prim)
|
||||
{
|
||||
lock (m_Connection)
|
||||
|
@ -773,7 +773,7 @@ namespace OpenSim.Data.MySQL
|
|||
"use_estate_sun, fixed_sun, sun_position, " +
|
||||
"covenant, Sandbox, sunvectorx, sunvectory, " +
|
||||
"sunvectorz, loaded_creation_datetime, " +
|
||||
"loaded_creation_id) values ( ?RegionUUID, ?BlockTerraform, " +
|
||||
"loaded_creation_id) values (?RegionUUID, ?BlockTerraform, " +
|
||||
"?BlockFly, ?AllowDamage, ?RestrictPushing, " +
|
||||
"?AllowLandResell, ?AllowLandJoinDivide, " +
|
||||
"?BlockShowInSearch, ?AgentLimit, ?ObjectBonus, " +
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
private string m_Realm;
|
||||
private List<string> m_ColumnNames = null;
|
||||
private int m_LastExpire = 0;
|
||||
// private int m_LastExpire = 0;
|
||||
|
||||
public MySqlRegionData(string connectionString, string realm)
|
||||
: base(connectionString)
|
||||
|
@ -77,7 +77,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
List<RegionData> ret = RunCommand(cmd);
|
||||
if (ret == null)
|
||||
if (ret.Count == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
|
@ -95,7 +95,7 @@ namespace OpenSim.Data.MySQL
|
|||
cmd.Parameters.AddWithValue("?scopeID", scopeID.ToString());
|
||||
|
||||
List<RegionData> ret = RunCommand(cmd);
|
||||
if (ret == null)
|
||||
if (ret.Count == 0)
|
||||
return null;
|
||||
|
||||
return ret[0];
|
||||
|
@ -138,6 +138,8 @@ namespace OpenSim.Data.MySQL
|
|||
ret.RegionName = result["regionName"].ToString();
|
||||
ret.posX = Convert.ToInt32(result["locX"]);
|
||||
ret.posY = Convert.ToInt32(result["locY"]);
|
||||
ret.sizeX = Convert.ToInt32(result["sizeX"]);
|
||||
ret.sizeY = Convert.ToInt32(result["sizeY"]);
|
||||
|
||||
if (m_ColumnNames == null)
|
||||
{
|
||||
|
@ -170,10 +172,7 @@ namespace OpenSim.Data.MySQL
|
|||
result.Close();
|
||||
CloseReaderCommand(cmd);
|
||||
|
||||
if (retList.Count > 0)
|
||||
return retList;
|
||||
|
||||
return null;
|
||||
return retList;
|
||||
}
|
||||
|
||||
public bool Store(RegionData data)
|
||||
|
@ -188,21 +187,25 @@ namespace OpenSim.Data.MySQL
|
|||
data.Data.Remove("posX");
|
||||
if (data.Data.ContainsKey("posY"))
|
||||
data.Data.Remove("posY");
|
||||
if (data.Data.ContainsKey("sizeX"))
|
||||
data.Data.Remove("sizeX");
|
||||
if (data.Data.ContainsKey("sizeY"))
|
||||
data.Data.Remove("sizeY");
|
||||
if (data.Data.ContainsKey("locX"))
|
||||
data.Data.Remove("locX");
|
||||
if (data.Data.ContainsKey("locY"))
|
||||
data.Data.Remove("locY");
|
||||
|
||||
string[] fields = new List<string>(data.Data.Keys).ToArray();
|
||||
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
|
||||
string update = "update `"+m_Realm+"` set ";
|
||||
bool first = true;
|
||||
string update = "update `"+m_Realm+"` set locX=?posX, locY=?posY, sizeX=?sizeX, sizeY=?sizeY";
|
||||
foreach (string field in fields)
|
||||
{
|
||||
if (!first)
|
||||
update += ", ";
|
||||
update += ", ";
|
||||
update += "`" + field + "` = ?"+field;
|
||||
|
||||
first = false;
|
||||
|
||||
cmd.Parameters.AddWithValue("?"+field, data.Data[field]);
|
||||
}
|
||||
|
||||
|
@ -213,13 +216,18 @@ namespace OpenSim.Data.MySQL
|
|||
|
||||
cmd.CommandText = update;
|
||||
cmd.Parameters.AddWithValue("?regionID", data.RegionID.ToString());
|
||||
cmd.Parameters.AddWithValue("?regionName", data.RegionName);
|
||||
cmd.Parameters.AddWithValue("?scopeID", data.ScopeID.ToString());
|
||||
cmd.Parameters.AddWithValue("?posX", data.posX.ToString());
|
||||
cmd.Parameters.AddWithValue("?posY", data.posY.ToString());
|
||||
cmd.Parameters.AddWithValue("?sizeX", data.sizeX.ToString());
|
||||
cmd.Parameters.AddWithValue("?sizeY", data.sizeY.ToString());
|
||||
|
||||
if (ExecuteNonQuery(cmd) < 1)
|
||||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `" +
|
||||
string insert = "insert into `" + m_Realm + "` (`uuid`, `ScopeID`, `locX`, `locY`, `sizeX`, `sizeY`, `regionName`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values ( ?regionID, ?scopeID, ?" + String.Join(", ?", fields) + ")";
|
||||
"`) values ( ?regionID, ?scopeID, ?posX, ?posY, ?sizeX, ?sizeY, ?regionName, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
private string m_Realm;
|
||||
private List<string> m_ColumnNames = null;
|
||||
private int m_LastExpire = 0;
|
||||
// private int m_LastExpire = 0;
|
||||
|
||||
public MySqlUserAccountData(string connectionString, string realm)
|
||||
: base(connectionString)
|
||||
|
@ -146,7 +146,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
string insert = "insert into `" + m_Realm + "` (`UUID`, `ScopeID`, `" +
|
||||
String.Join("`, `", fields) +
|
||||
"`) values ( ?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")";
|
||||
"`) values (?principalID, ?scopeID, ?" + String.Join(", ?", fields) + ")";
|
||||
|
||||
cmd.CommandText = insert;
|
||||
|
||||
|
|
|
@ -632,7 +632,7 @@ namespace OpenSim.Data.MySQL
|
|||
UUID zero = UUID.Zero;
|
||||
if (user.ID == zero)
|
||||
{
|
||||
return;
|
||||
return;
|
||||
}
|
||||
MySQLSuperManager dbm = GetLockedConnection("AddNewUserProfile");
|
||||
|
||||
|
@ -666,7 +666,7 @@ namespace OpenSim.Data.MySQL
|
|||
{
|
||||
UUID zero = UUID.Zero;
|
||||
if (agent.ProfileID == zero || agent.SessionID == zero)
|
||||
return;
|
||||
return;
|
||||
|
||||
MySQLSuperManager dbm = GetLockedConnection("AddNewUserAgent");
|
||||
try
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
BEGIN;
|
||||
|
||||
ALTER TABLE regions add column sizeX integer not null default 0;
|
||||
ALTER TABLE regions add column sizeY integer not null default 0;
|
||||
|
||||
COMMIT;
|
|
@ -155,7 +155,7 @@ namespace OpenSim.Data.NHibernate
|
|||
m_log.ErrorFormat("[NHIBERNATE] {0} of id {1} loading threw exception: " + e.ToString(), type.Name, id);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace OpenSim.Data.NHibernate
|
|||
m_log.InfoFormat("[NHIBERNATE] GetUserByUUID: {0} ", uuid);
|
||||
|
||||
user = (UserProfileData)manager.Get(typeof(UserProfileData), uuid);
|
||||
if (user != null)
|
||||
if (user != null)
|
||||
{
|
||||
UserAgentData agent = GetAgentByUUID(uuid);
|
||||
if (agent != null)
|
||||
|
@ -245,7 +245,7 @@ namespace OpenSim.Data.NHibernate
|
|||
UserProfileData user=GetUserByUUID(agentID);
|
||||
user.WebLoginKey = webLoginKey;
|
||||
UpdateUserProfile(user);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
public override void AddNewUserFriend(UUID ownerId, UUID friendId, uint perms)
|
||||
|
@ -258,7 +258,7 @@ namespace OpenSim.Data.NHibernate
|
|||
{
|
||||
manager.Insert(new UserFriend(UUID.Random(), friendId, ownerId, perms));
|
||||
}
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
private bool FriendRelationExists(UUID ownerId, UUID friendId)
|
||||
|
|
|
@ -40,13 +40,14 @@ namespace OpenSim.Data.Null
|
|||
|
||||
public NullRegionData(string connectionString, string realm)
|
||||
{
|
||||
//Console.WriteLine("[XXX] NullRegionData constructor");
|
||||
}
|
||||
|
||||
public List<RegionData> Get(string regionName, UUID scopeID)
|
||||
{
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach(RegionData r in m_regionData.Values)
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if (regionName.Contains("%"))
|
||||
{
|
||||
|
@ -70,7 +71,7 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach(RegionData r in m_regionData.Values)
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if (r.posX == posX && r.posY == posY)
|
||||
ret.Add(r);
|
||||
|
@ -94,16 +95,13 @@ namespace OpenSim.Data.Null
|
|||
{
|
||||
List<RegionData> ret = new List<RegionData>();
|
||||
|
||||
foreach(RegionData r in m_regionData.Values)
|
||||
foreach (RegionData r in m_regionData.Values)
|
||||
{
|
||||
if (r.posX >= startX && r.posX <= endX && r.posY >= startY && r.posY <= endY)
|
||||
ret.Add(r);
|
||||
}
|
||||
|
||||
if (ret.Count > 0)
|
||||
return ret;
|
||||
|
||||
return null;
|
||||
return ret;
|
||||
}
|
||||
|
||||
public bool Store(RegionData data)
|
||||
|
|
|
@ -137,7 +137,7 @@ namespace OpenSim.Data
|
|||
public uint maturity;
|
||||
|
||||
|
||||
//Data Wrappers
|
||||
//Data Wrappers
|
||||
public string RegionName
|
||||
{
|
||||
get { return regionName; }
|
||||
|
|
|
@ -496,7 +496,7 @@ namespace OpenSim.Data.SQLite
|
|||
{
|
||||
//m_log.DebugFormat("[DATASTORE]: Loading inventory for {0}, {1}", prim.Name, prim.UUID);
|
||||
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
DataTable dbItems = ds.Tables["primitems"];
|
||||
String sql = String.Format("primID = '{0}'", prim.UUID.ToString());
|
||||
DataRow[] dbItemRows = dbItems.Select(sql);
|
||||
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Data.Tests
|
|||
public UUID item2;
|
||||
public UUID item3;
|
||||
|
||||
public static Random random;
|
||||
public static Random random;
|
||||
|
||||
public string itemname1 = "item1";
|
||||
|
||||
|
@ -173,7 +173,7 @@ namespace OpenSim.Data.Tests
|
|||
UUID tmp0 = UUID.Random();
|
||||
UUID tmp1 = UUID.Random();
|
||||
UUID tmp2 = UUID.Random();
|
||||
UUID tmp3 = UUID.Random();
|
||||
UUID tmp3 = UUID.Random();
|
||||
UUID newregion = UUID.Random();
|
||||
SceneObjectPart p1 = NewSOP("SoP 1",tmp1);
|
||||
SceneObjectPart p2 = NewSOP("SoP 2",tmp2);
|
||||
|
@ -224,7 +224,7 @@ namespace OpenSim.Data.Tests
|
|||
random.NextBytes(partsys);
|
||||
DateTime expires = new DateTime(2008, 12, 20);
|
||||
DateTime rezzed = new DateTime(2009, 07, 15);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
|
@ -261,7 +261,7 @@ namespace OpenSim.Data.Tests
|
|||
sop.Shape = pbshap;
|
||||
sop.GroupPosition = groupos;
|
||||
sop.RotationOffset = rotoff;
|
||||
sop.CreatorID = creator;
|
||||
sop.CreatorID = creator;
|
||||
sop.InventorySerial = iserial;
|
||||
sop.TaskInventory = dic;
|
||||
sop.ObjectFlags = objf;
|
||||
|
@ -306,7 +306,7 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(expires,Is.EqualTo(sop.Expires), "Assert.That(expires,Is.EqualTo(sop.Expires))");
|
||||
Assert.That(rezzed,Is.EqualTo(sop.Rezzed), "Assert.That(rezzed,Is.EqualTo(sop.Rezzed))");
|
||||
Assert.That(offset,Is.EqualTo(sop.OffsetPosition), "Assert.That(offset,Is.EqualTo(sop.OffsetPosition))");
|
||||
Assert.That(velocity,Is.EqualTo(sop.Velocity), "Assert.That(velocity,Is.EqualTo(sop.Velocity))");
|
||||
Assert.That(velocity,Is.EqualTo(sop.Velocity), "Assert.That(velocity,Is.EqualTo(sop.Velocity))");
|
||||
Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity), "Assert.That(angvelo,Is.EqualTo(sop.AngularVelocity))");
|
||||
Assert.That(accel,Is.EqualTo(sop.Acceleration), "Assert.That(accel,Is.EqualTo(sop.Acceleration))");
|
||||
Assert.That(description,Is.EqualTo(sop.Description), "Assert.That(description,Is.EqualTo(sop.Description))");
|
||||
|
@ -319,7 +319,7 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(scale,Is.EqualTo(sop.Scale), "Assert.That(scale,Is.EqualTo(sop.Scale))");
|
||||
Assert.That(updatef,Is.EqualTo(sop.UpdateFlag), "Assert.That(updatef,Is.EqualTo(sop.UpdateFlag))");
|
||||
|
||||
// This is necessary or object will not be inserted in DB
|
||||
// This is necessary or object will not be inserted in DB
|
||||
sop.ObjectFlags = 0;
|
||||
|
||||
SceneObjectGroup sog = new SceneObjectGroup(sop);
|
||||
|
@ -332,11 +332,11 @@ namespace OpenSim.Data.Tests
|
|||
// Makes sure there are no double insertions:
|
||||
db.StoreObject(sog,region3);
|
||||
sogs = db.LoadObjects(region3);
|
||||
Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))");
|
||||
Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count, Is.EqualTo(1))");
|
||||
|
||||
|
||||
// Tests if the parameters were inserted correctly
|
||||
SceneObjectPart p = sogs[0].RootPart;
|
||||
SceneObjectPart p = sogs[0].RootPart;
|
||||
Assert.That(regionh,Is.EqualTo(p.RegionHandle), "Assert.That(regionh,Is.EqualTo(p.RegionHandle))");
|
||||
//Assert.That(localid,Is.EqualTo(p.LocalId), "Assert.That(localid,Is.EqualTo(p.LocalId))");
|
||||
Assert.That(groupos,Is.EqualTo(p.GroupPosition), "Assert.That(groupos,Is.EqualTo(p.GroupPosition))");
|
||||
|
@ -402,7 +402,7 @@ namespace OpenSim.Data.Tests
|
|||
random.NextBytes(partsys);
|
||||
DateTime expires = new DateTime(2010, 12, 20);
|
||||
DateTime rezzed = new DateTime(2005, 07, 15);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
|
@ -418,7 +418,7 @@ namespace OpenSim.Data.Tests
|
|||
PrimitiveBaseShape pbshap = new PrimitiveBaseShape();
|
||||
pbshap = PrimitiveBaseShape.Default;
|
||||
Vector3 scale = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
byte updatef = (byte) random.Next(127);
|
||||
byte updatef = (byte) random.Next(127);
|
||||
|
||||
// Updates the region with new values
|
||||
SceneObjectGroup sog2 = FindSOG("Adam West", region3);
|
||||
|
@ -427,7 +427,7 @@ namespace OpenSim.Data.Tests
|
|||
sog2.RootPart.Shape = pbshap;
|
||||
sog2.RootPart.GroupPosition = groupos;
|
||||
sog2.RootPart.RotationOffset = rotoff;
|
||||
sog2.RootPart.CreatorID = creator;
|
||||
sog2.RootPart.CreatorID = creator;
|
||||
sog2.RootPart.TaskInventory = dic;
|
||||
sog2.RootPart.Name = name;
|
||||
sog2.RootPart.Material = material;
|
||||
|
@ -492,7 +492,7 @@ namespace OpenSim.Data.Tests
|
|||
{
|
||||
UUID tmp = UUID.Random();
|
||||
SceneObjectPart sop = NewSOP(("Test SOP " + i.ToString()),tmp);
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 groupos = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Vector3 offset = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
Quaternion rotoff = new Quaternion(random.Next(),random.Next(),random.Next(),random.Next());
|
||||
Vector3 velocity = new Vector3(random.Next(),random.Next(),random.Next());
|
||||
|
@ -648,7 +648,7 @@ namespace OpenSim.Data.Tests
|
|||
{
|
||||
InventoryItemBase i = new InventoryItemBase();
|
||||
UUID id = UUID.Random();
|
||||
i.ID = id;
|
||||
i.ID = id;
|
||||
UUID folder = UUID.Random();
|
||||
i.Folder = folder;
|
||||
UUID owner = UUID.Random();
|
||||
|
@ -666,13 +666,13 @@ namespace OpenSim.Data.Tests
|
|||
i.NextPermissions = nextperm;
|
||||
uint curperm = (uint) random.Next();
|
||||
i.CurrentPermissions = curperm;
|
||||
uint baseperm = (uint) random.Next();
|
||||
uint baseperm = (uint) random.Next();
|
||||
i.BasePermissions = baseperm;
|
||||
uint eoperm = (uint) random.Next();
|
||||
i.EveryOnePermissions = eoperm;
|
||||
int assettype = random.Next();
|
||||
i.AssetType = assettype;
|
||||
UUID groupid = UUID.Random();
|
||||
UUID groupid = UUID.Random();
|
||||
i.GroupID = groupid;
|
||||
bool groupown = true;
|
||||
i.GroupOwned = groupown;
|
||||
|
@ -1010,7 +1010,7 @@ namespace OpenSim.Data.Tests
|
|||
|
||||
private SceneObjectPart NewSOP(string name, UUID uuid)
|
||||
{
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
SceneObjectPart sop = new SceneObjectPart();
|
||||
sop.Name = name;
|
||||
sop.Description = name;
|
||||
sop.Text = RandomName();
|
||||
|
@ -1042,12 +1042,12 @@ namespace OpenSim.Data.Tests
|
|||
int size = random.Next(5,12);
|
||||
char ch ;
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
{
|
||||
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
|
||||
name.Append(ch);
|
||||
}
|
||||
return name.ToString();
|
||||
}
|
||||
}
|
||||
// private InventoryFolderBase NewFolder(UUID id, UUID parent, UUID owner, string name)
|
||||
// {
|
||||
// InventoryFolderBase f = new InventoryFolderBase();
|
||||
|
|
|
@ -152,7 +152,7 @@ namespace OpenSim.Data.Tests
|
|||
u1.FirstName = "Ugly";
|
||||
|
||||
db.UpdateUserProfile(u1);
|
||||
Assert.That("Ugly",Is.EqualTo(u1.FirstName), "Assert.That(\"Ugly\",Is.EqualTo(u1.FirstName))");
|
||||
Assert.That("Ugly",Is.EqualTo(u1.FirstName), "Assert.That(\"Ugly\",Is.EqualTo(u1.FirstName))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -174,7 +174,7 @@ namespace OpenSim.Data.Tests
|
|||
db.AddNewUserProfile(u4);
|
||||
Assert.That(db.GetUserByUUID(zero),Is.Null);
|
||||
Assert.That(db.GetUserByUUID(user4),Is.Null);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void T015_UserPersistency()
|
||||
|
@ -218,7 +218,7 @@ namespace OpenSim.Data.Tests
|
|||
|
||||
//HomeRegionX and HomeRegionY must only use 24 bits
|
||||
homeregx = ((homeregx << 8) >> 8);
|
||||
homeregy = ((homeregy << 8) >> 8);
|
||||
homeregy = ((homeregy << 8) >> 8);
|
||||
|
||||
u.ID = id;
|
||||
u.WebLoginKey = webloginkey;
|
||||
|
@ -299,7 +299,7 @@ namespace OpenSim.Data.Tests
|
|||
uint homeregx = (uint) random.Next();
|
||||
uint homeregy = (uint) random.Next();
|
||||
Vector3 homeloc = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
|
||||
Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
|
||||
Vector3 homelookat = new Vector3((float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5),(float)Math.Round(random.NextDouble(),5));
|
||||
int created = random.Next();
|
||||
int lastlogin = random.Next();
|
||||
string userinvuri = RandomName();
|
||||
|
@ -359,7 +359,7 @@ namespace OpenSim.Data.Tests
|
|||
Assert.That(email,Is.EqualTo(u1a.Email), "Assert.That(email,Is.EqualTo(u1a.Email))");
|
||||
Assert.That(passhash,Is.EqualTo(u1a.PasswordHash), "Assert.That(passhash,Is.EqualTo(u1a.PasswordHash))");
|
||||
Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt), "Assert.That(passsalt,Is.EqualTo(u1a.PasswordSalt))");
|
||||
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
|
||||
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
|
||||
Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX), "Assert.That(homeregx,Is.EqualTo(u1a.HomeRegionX))");
|
||||
Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY), "Assert.That(homeregy,Is.EqualTo(u1a.HomeRegionY))");
|
||||
Assert.That(homereg,Is.EqualTo(u1a.HomeRegion), "Assert.That(homereg,Is.EqualTo(u1a.HomeRegion))");
|
||||
|
@ -426,7 +426,7 @@ namespace OpenSim.Data.Tests
|
|||
UserAgentData a2 = db.GetAgentByName(fname2,lname2);
|
||||
UserAgentData a3 = db.GetAgentByName(name3);
|
||||
Assert.That(user2,Is.EqualTo(a2.ProfileID), "Assert.That(user2,Is.EqualTo(a2.ProfileID))");
|
||||
Assert.That(user3,Is.EqualTo(a3.ProfileID), "Assert.That(user3,Is.EqualTo(a3.ProfileID))");
|
||||
Assert.That(user3,Is.EqualTo(a3.ProfileID), "Assert.That(user3,Is.EqualTo(a3.ProfileID))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -501,11 +501,11 @@ namespace OpenSim.Data.Tests
|
|||
db.AddNewUserFriend(user1,user3, 2);
|
||||
db.AddNewUserFriend(user1,user2, 4);
|
||||
List<FriendListItem> fl1 = db.GetUserFriendList(user1);
|
||||
Assert.That(fl1.Count,Is.EqualTo(2), "Assert.That(fl1.Count,Is.EqualTo(2))");
|
||||
Assert.That(fl1.Count,Is.EqualTo(2), "Assert.That(fl1.Count,Is.EqualTo(2))");
|
||||
perms.Add(user2,1);
|
||||
perms.Add(user3,2);
|
||||
for (int i = 0; i < fl1.Count; i++)
|
||||
{
|
||||
{
|
||||
Assert.That(user1,Is.EqualTo(fl1[i].FriendListOwner), "Assert.That(user1,Is.EqualTo(fl1[i].FriendListOwner))");
|
||||
friends.Add(fl1[i].Friend,1);
|
||||
temp = perms[fl1[i].Friend];
|
||||
|
@ -544,7 +544,7 @@ namespace OpenSim.Data.Tests
|
|||
db.UpdateUserFriendPerms(user1, user3, 4);
|
||||
|
||||
fl1 = db.GetUserFriendList(user1);
|
||||
Assert.That(fl1[0].FriendPerms,Is.EqualTo(4), "Assert.That(fl1[0].FriendPerms,Is.EqualTo(4))");
|
||||
Assert.That(fl1[0].FriendPerms,Is.EqualTo(4), "Assert.That(fl1[0].FriendPerms,Is.EqualTo(4))");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -560,7 +560,7 @@ namespace OpenSim.Data.Tests
|
|||
[Test]
|
||||
public void T041_UserAppearancePersistency()
|
||||
{
|
||||
AvatarAppearance appear = new AvatarAppearance();
|
||||
AvatarAppearance appear = new AvatarAppearance();
|
||||
UUID owner = UUID.Random();
|
||||
int serial = random.Next();
|
||||
byte[] visualp = new byte[218];
|
||||
|
@ -698,7 +698,7 @@ namespace OpenSim.Data.Tests
|
|||
int size = random.Next(5,12);
|
||||
char ch ;
|
||||
for (int i=0; i<size; i++)
|
||||
{
|
||||
{
|
||||
ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))) ;
|
||||
name.Append(ch);
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenSim.Data
|
|||
public abstract UserAgentData GetAgentByUUID(UUID user);
|
||||
public abstract UserAgentData GetAgentByName(string name);
|
||||
public abstract UserAgentData GetAgentByName(string fname, string lname);
|
||||
public UserProfileData GetUserByUri(Uri uri) { return null; }
|
||||
public UserProfileData GetUserByUri(Uri uri) { return null; }
|
||||
public abstract void StoreWebLoginKey(UUID agentID, UUID webLoginKey);
|
||||
public abstract void AddNewUserProfile(UserProfileData user);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace OpenSim.Framework
|
|||
|
||||
// Body
|
||||
defaultWearables[0].ItemID = new UUID("66c41e39-38f9-f75a-024e-585989bfaba9");
|
||||
defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
defaultWearables[0].AssetID = new UUID("66c41e39-38f9-f75a-024e-585989bfab73");
|
||||
|
||||
// Skin
|
||||
defaultWearables[1].ItemID = new UUID("77c41e39-38f9-f75a-024e-585989bfabc9");
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Capabilities
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Capabilities utility methods
|
||||
/// </summary>
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework.Client
|
|||
// Porting Guide from old IM
|
||||
// SendIM(...)
|
||||
// Loses FromAgentSession - this should be added by implementers manually.
|
||||
//
|
||||
//
|
||||
|
||||
public interface IClientIM
|
||||
{
|
||||
|
|
|
@ -177,9 +177,9 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
public void ViewerEffectHandler(IClientAPI sender, List<ViewerEffectEventHandlerArg> args)
|
||||
{
|
||||
{
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
|
||||
List<ViewerEffectPacket.EffectBlock> effectBlock = new List<ViewerEffectPacket.EffectBlock>();
|
||||
for (int i = 0; i < args.Count; i++)
|
||||
{
|
||||
ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock();
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <summary>
|
||||
/// How many operations between time checks.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
private const int DefaultOperationsBetweenTimeChecks = 40;
|
||||
|
||||
/// <summary>
|
||||
|
@ -168,7 +168,7 @@ namespace OpenSim.Framework
|
|||
private int m_version;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CnmMemoryCache{TKey,TValue}"/> class.
|
||||
/// Initializes a new instance of the <see cref="CnmMemoryCache{TKey,TValue}"/> class.
|
||||
/// </summary>
|
||||
public CnmMemoryCache()
|
||||
: this(DefaultMaxSize)
|
||||
|
@ -277,7 +277,7 @@ namespace OpenSim.Framework
|
|||
/// </param>
|
||||
protected virtual void AddToNewGeneration(int bucketIndex, TKey key, TValue value, long size)
|
||||
{
|
||||
// Add to newest generation
|
||||
// Add to newest generation
|
||||
if (!m_newGeneration.Set(bucketIndex, key, value, size))
|
||||
{
|
||||
// Failed to add new generation
|
||||
|
@ -311,7 +311,7 @@ namespace OpenSim.Framework
|
|||
/// Bucket index is remainder when element key's hash value is divided by bucket count.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// For example: key's hash is 72, bucket count is 5, element's bucket index is 72 % 5 = 2.
|
||||
/// For example: key's hash is 72, bucket count is 5, element's bucket index is 72 % 5 = 2.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
protected virtual int GetBucketIndex(TKey key)
|
||||
|
@ -367,7 +367,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
private void RecycleGenerations()
|
||||
{
|
||||
// Rotate old generation to new generation, new generation to old generation
|
||||
// Rotate old generation to new generation, new generation to old generation
|
||||
IGeneration temp = m_newGeneration;
|
||||
m_newGeneration = m_oldGeneration;
|
||||
m_newGeneration.Clear();
|
||||
|
@ -522,7 +522,7 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Index of first element's in element chain.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <value>
|
||||
/// -1 if there is no element in bucket; otherwise first element's index in the element chain.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
|
@ -692,7 +692,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <value>
|
||||
/// 0 if element is free; otherwise larger than 0.
|
||||
/// </value>
|
||||
/// </value>
|
||||
public long Size;
|
||||
|
||||
/// <summary>
|
||||
|
@ -771,7 +771,7 @@ namespace OpenSim.Framework
|
|||
/// </returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// The enumerator has reach end of collection or <see cref="MoveNext"/> is not called.
|
||||
/// </exception>
|
||||
/// </exception>
|
||||
public KeyValuePair<TKey, TValue> Current
|
||||
{
|
||||
get
|
||||
|
@ -1405,10 +1405,10 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxElementSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.Size"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsTimeLimited"/>
|
||||
public bool IsSizeLimited
|
||||
|
@ -1438,7 +1438,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see langword="true"/> if the <see cref="ICnmCache{TKey,TValue}"/> has a fixed total size of elements;
|
||||
|
@ -1449,7 +1449,7 @@ namespace OpenSim.Framework
|
|||
/// or <see cref="ICnmCache{TKey,TValue}.TryGetValue"/> methods in <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> , then element is automatically removed from
|
||||
/// the cache. Depending on implementation of the <see cref="ICnmCache{TKey,TValue}"/>, some of the elements may
|
||||
/// stay longer in cache.
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.ExpirationTime"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.PurgeExpired"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
|
@ -1503,7 +1503,7 @@ namespace OpenSim.Framework
|
|||
/// <seealso cref="ICnmCache{TKey,TValue}.Set"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsSizeLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.Size"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
public long MaxElementSize
|
||||
{
|
||||
get { return m_maxElementSize; }
|
||||
|
@ -1517,7 +1517,7 @@ namespace OpenSim.Framework
|
|||
/// <value>
|
||||
/// Maximal allowed total size for elements stored to <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Normally size is total bytes used by elements in the cache. But it can be any other suitable unit of measure.
|
||||
/// </para>
|
||||
|
@ -1562,10 +1562,10 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxElementSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsSizeLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.ExpirationTime"/>
|
||||
public long Size
|
||||
|
@ -1576,9 +1576,9 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Gets an object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <value>
|
||||
/// An object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// To get synchronized (thread safe) access to <see cref="ICnmCache{TKey,TValue}"/>, use <see cref="CnmSynchronizedCache{TKey,TValue}"/>
|
||||
|
@ -1630,7 +1630,7 @@ namespace OpenSim.Framework
|
|||
/// </para>
|
||||
/// <para>
|
||||
/// Depending on <see cref="ICnmCache{TKey,TValue}"/> implementation, some of expired elements
|
||||
/// may stay longer than <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> in the cache.
|
||||
/// may stay longer than <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> in the cache.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsTimeLimited"/>
|
||||
|
@ -1810,7 +1810,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <returns>
|
||||
/// <see langword="true"/>if the <see cref="ICnmCache{TKey,TValue}"/> contains an element with
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
/// <param name="key">
|
||||
/// The key whose <paramref name="value"/> to get.
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace OpenSim.Framework
|
|||
/// </returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// The enumerator has reach end of collection or <see cref="MoveNext"/> is not called.
|
||||
/// </exception>
|
||||
/// </exception>
|
||||
public KeyValuePair<TKey, TValue> Current
|
||||
{
|
||||
get { return m_enumerator.Current; }
|
||||
|
@ -327,10 +327,10 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxElementSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.Size"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsTimeLimited"/>
|
||||
public bool IsSizeLimited
|
||||
|
@ -366,7 +366,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see langword="true"/> if the <see cref="ICnmCache{TKey,TValue}"/> has a fixed total size of elements;
|
||||
|
@ -377,7 +377,7 @@ namespace OpenSim.Framework
|
|||
/// or <see cref="ICnmCache{TKey,TValue}.TryGetValue"/> methods in <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> , then element is automatically removed from
|
||||
/// the cache. Depending on implementation of the <see cref="ICnmCache{TKey,TValue}"/>, some of the elements may
|
||||
/// stay longer in cache.
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.ExpirationTime"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.PurgeExpired"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
|
@ -440,7 +440,7 @@ namespace OpenSim.Framework
|
|||
/// <seealso cref="ICnmCache{TKey,TValue}.Set"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsSizeLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.Size"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
public long MaxElementSize
|
||||
{
|
||||
get
|
||||
|
@ -458,7 +458,7 @@ namespace OpenSim.Framework
|
|||
/// <value>
|
||||
/// Maximal allowed total size for elements stored to <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Normally size is total bytes used by elements in the cache. But it can be any other suitable unit of measure.
|
||||
/// </para>
|
||||
|
@ -507,10 +507,10 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxElementSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsSizeLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.MaxSize"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsCountLimited"/>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.ExpirationTime"/>
|
||||
public long Size
|
||||
|
@ -527,9 +527,9 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Gets an object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <value>
|
||||
/// An object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// To get synchronized (thread safe) access to <see cref="ICnmCache{TKey,TValue}"/>, use <see cref="CnmSynchronizedCache{TKey,TValue}"/>
|
||||
|
@ -584,7 +584,7 @@ namespace OpenSim.Framework
|
|||
/// </para>
|
||||
/// <para>
|
||||
/// Depending on <see cref="ICnmCache{TKey,TValue}"/> implementation, some of expired elements
|
||||
/// may stay longer than <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> in the cache.
|
||||
/// may stay longer than <see cref="ICnmCache{TKey,TValue}.ExpirationTime"/> in the cache.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ICnmCache{TKey,TValue}.IsTimeLimited"/>
|
||||
|
@ -704,7 +704,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <returns>
|
||||
/// <see langword="true"/>if the <see cref="ICnmCache{TKey,TValue}"/> contains an element with
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
/// <param name="key">
|
||||
/// The key whose <paramref name="value"/> to get.
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// Stores user profile and inventory data received from backend services for a particular user.
|
||||
/// </summary>
|
||||
public class CachedUserInfo
|
||||
{
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
//// <value>
|
||||
|
@ -190,7 +190,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
resolvedFolders.Add(folder);
|
||||
resolvedFolderDictionary[folder.ID] = folder;
|
||||
parentFolder.AddChildFolder(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // foreach (folder in pendingCategorizationFolders[parentFolder.ID])
|
||||
|
||||
|
@ -422,7 +422,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
///
|
||||
/// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE
|
||||
/// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing,
|
||||
/// and needs to be changed.
|
||||
/// and needs to be changed.
|
||||
///
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="type"></param>
|
||||
|
@ -500,7 +500,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
InventoryFolderImpl oldParentFolder = RootFolder.FindFolder(folder.ParentID);
|
||||
|
||||
if (oldParentFolder != null)
|
||||
{
|
||||
{
|
||||
oldParentFolder.RemoveChildFolder(folderID);
|
||||
parentFolder.AddChildFolder(folder);
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// User profiles indexed by name
|
||||
/// </summary>
|
||||
private readonly Dictionary<string, CachedUserInfo> m_userProfilesByName
|
||||
= new Dictionary<string, CachedUserInfo>();
|
||||
= new Dictionary<string, CachedUserInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// The root library folder.
|
||||
|
@ -125,26 +125,26 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
/// </summary>
|
||||
/// If the user isn't in cache then the user is requested from the profile service.
|
||||
/// <param name="userID"></param>
|
||||
/// <returns>null if no user details are found</returns>
|
||||
/// <returns>null if no user details are found</returns>
|
||||
public CachedUserInfo GetUserDetails(string fname, string lname)
|
||||
{
|
||||
lock (m_userProfilesByName)
|
||||
{
|
||||
{
|
||||
CachedUserInfo userInfo;
|
||||
|
||||
if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo))
|
||||
if (m_userProfilesByName.TryGetValue(string.Format(NAME_FORMAT, fname, lname), out userInfo))
|
||||
{
|
||||
return userInfo;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(fname, lname);
|
||||
|
||||
if (userProfile != null)
|
||||
return AddToCaches(userProfile);
|
||||
return AddToCaches(userProfile);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,20 +185,20 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
// probably by making sure that the update doesn't use the UserCacheInfo.UserProfile directly (possibly via
|
||||
// returning a read only class from the cache).
|
||||
// public bool StoreProfile(UserProfileData userProfile)
|
||||
// {
|
||||
// {
|
||||
// lock (m_userProfilesById)
|
||||
// {
|
||||
// {
|
||||
// CachedUserInfo userInfo = GetUserDetails(userProfile.ID);
|
||||
//
|
||||
//
|
||||
// if (userInfo != null)
|
||||
// {
|
||||
// userInfo.m_userProfile = userProfile;
|
||||
// userInfo.m_userProfile = userProfile;
|
||||
// m_commsManager.UserService.UpdateUserProfile(userProfile);
|
||||
//
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return false;
|
||||
// }
|
||||
|
||||
|
@ -220,7 +220,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
}
|
||||
}
|
||||
|
||||
return createdUserInfo;
|
||||
return createdUserInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -234,7 +234,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
{
|
||||
if (m_userProfilesById.ContainsKey(userId))
|
||||
{
|
||||
CachedUserInfo userInfo = m_userProfilesById[userId];
|
||||
CachedUserInfo userInfo = m_userProfilesById[userId];
|
||||
m_userProfilesById.Remove(userId);
|
||||
|
||||
lock (m_userProfilesByName)
|
||||
|
@ -244,7 +244,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ using System.Text;
|
|||
using OpenMetaverse;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
using log4net;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Clients
|
||||
|
@ -43,7 +45,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public bool DoCreateChildAgentCall(RegionInfo region, AgentCircuitData aCircuit, string authKey, out string reason)
|
||||
public bool DoCreateChildAgentCall(GridRegion region, AgentCircuitData aCircuit, string authKey, out string reason)
|
||||
{
|
||||
reason = String.Empty;
|
||||
|
||||
|
@ -166,7 +168,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
|
||||
}
|
||||
|
||||
public bool DoChildAgentUpdateCall(RegionInfo region, IAgentData cAgentData)
|
||||
public bool DoChildAgentUpdateCall(GridRegion region, IAgentData cAgentData)
|
||||
{
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
string uri = string.Empty;
|
||||
|
@ -260,7 +262,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool DoRetrieveRootAgentCall(RegionInfo region, UUID id, out IAgentData agent)
|
||||
public bool DoRetrieveRootAgentCall(GridRegion region, UUID id, out IAgentData agent)
|
||||
{
|
||||
agent = null;
|
||||
// Eventually, we want to use a caps url instead of the agentID
|
||||
|
@ -348,7 +350,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
}
|
||||
|
||||
|
||||
public bool DoCloseAgentCall(RegionInfo region, UUID id)
|
||||
public bool DoCloseAgentCall(GridRegion region, UUID id)
|
||||
{
|
||||
string uri = string.Empty;
|
||||
try
|
||||
|
@ -391,7 +393,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
return true;
|
||||
}
|
||||
|
||||
public bool DoCreateObjectCall(RegionInfo region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
|
||||
public bool DoCreateObjectCall(GridRegion region, ISceneObject sog, string sogXml2, bool allowScriptCrossing)
|
||||
{
|
||||
ulong regionHandle = GetRegionHandle(region.RegionHandle);
|
||||
string uri
|
||||
|
@ -474,7 +476,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
|
||||
}
|
||||
|
||||
public bool DoCreateObjectCall(RegionInfo region, UUID userID, UUID itemID)
|
||||
public bool DoCreateObjectCall(GridRegion region, UUID userID, UUID itemID)
|
||||
{
|
||||
ulong regionHandle = GetRegionHandle(region.RegionHandle);
|
||||
string uri = "http://" + region.ExternalEndPoint.Address + ":" + region.HttpPort + "/object/" + UUID.Zero + "/" + regionHandle.ToString() + "/";
|
||||
|
@ -646,7 +648,7 @@ namespace OpenSim.Framework.Communications.Clients
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual void SendUserInformation(RegionInfo regInfo, AgentCircuitData aCircuit)
|
||||
public virtual void SendUserInformation(GridRegion regInfo, AgentCircuitData aCircuit)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -59,11 +59,6 @@ namespace OpenSim.Framework.Communications
|
|||
}
|
||||
protected IMessagingService m_messageService;
|
||||
|
||||
public IGridServices GridService
|
||||
{
|
||||
get { return m_gridService; }
|
||||
}
|
||||
protected IGridServices m_gridService;
|
||||
|
||||
public UserProfileCacheService UserProfileCacheService
|
||||
{
|
||||
|
@ -95,8 +90,8 @@ namespace OpenSim.Framework.Communications
|
|||
public IUserAdminService UserAdminService
|
||||
{
|
||||
get { return m_userAdminService; }
|
||||
}
|
||||
protected IUserAdminService m_userAdminService;
|
||||
}
|
||||
protected IUserAdminService m_userAdminService;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace OpenSim.Framework.Communications
|
|||
/// Update avatar appearance information
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="appearance"></param>
|
||||
/// <param name="appearance"></param>
|
||||
void UpdateUserAppearance(UUID user, AvatarAppearance appearance);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
public interface IGridServices
|
||||
{
|
||||
string gdebugRegionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, then regions will accept logins from the user service. If false, then they will not.
|
||||
/// </summary>
|
||||
bool RegionLoginsEnabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Register a region with the grid service.
|
||||
/// </summary>
|
||||
/// <param name="regionInfos"> </param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception">Thrown if region registration failed</exception>
|
||||
RegionCommsListener RegisterRegion(RegionInfo regionInfos);
|
||||
|
||||
/// <summary>
|
||||
/// Deregister a region with the grid service.
|
||||
/// </summary>
|
||||
/// <param name="regionInfo"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Exception">Thrown if region deregistration failed</exception>
|
||||
bool DeregisterRegion(RegionInfo regionInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Get information about the regions neighbouring the given co-ordinates.
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <returns></returns>
|
||||
List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
|
||||
|
||||
RegionInfo RequestNeighbourInfo(ulong regionHandle);
|
||||
RegionInfo RequestNeighbourInfo(UUID regionID);
|
||||
RegionInfo RequestNeighbourInfo(string name);
|
||||
RegionInfo RequestNeighbourInfo(string host, uint port);
|
||||
|
||||
RegionInfo RequestClosestRegion(string regionName);
|
||||
Dictionary<string, string> GetGridSettings();
|
||||
List<MapBlockData> RequestNeighbourMapBlocks(int minX, int minY, int maxX, int maxY);
|
||||
// not complete yet, only contains the fields needed for ParcelInfoReqeust
|
||||
LandData RequestLandData(ulong regionHandle, uint x, uint y);
|
||||
|
||||
/// <summary>
|
||||
/// Get information about regions starting with the provided name.
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// The name to match against.
|
||||
/// </param>
|
||||
/// <param name="maxNumber">
|
||||
/// The maximum number of results to return.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// A list of <see cref="RegionInfo"/>s of regions with matching name. If the
|
||||
/// grid-server couldn't be contacted or returned an error, return null.
|
||||
/// </returns>
|
||||
List<RegionInfo> RequestNamedRegions(string name, int maxNumber);
|
||||
}
|
||||
}
|
|
@ -66,6 +66,6 @@ namespace OpenSim.Framework.Communications
|
|||
/// <param name="lastName"></param>
|
||||
/// <param name="newPassword"></param>
|
||||
/// <returns>true if the update was successful, false otherwise</returns>
|
||||
bool ResetUserPassword(string firstName, string lastName, string newPassword);
|
||||
bool ResetUserPassword(string firstName, string lastName, string newPassword);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,16 +130,28 @@ namespace OpenSim.Framework.Communications
|
|||
/// <returns>
|
||||
/// A List of FriendListItems that contains info about the user's friends.
|
||||
/// Always returns a list even if the user has no friends
|
||||
/// </returns>
|
||||
/// </returns>
|
||||
List<FriendListItem> GetUserFriendList(UUID friendlistowner);
|
||||
|
||||
// This probably shouldn't be here, it belongs to IAuthentication
|
||||
// But since Scenes only have IUserService references, I'm placing it here for now.
|
||||
bool VerifySession(UUID userID, UUID sessionID);
|
||||
|
||||
/// <summary>
|
||||
/// Authenticate a user by their password.
|
||||
/// </summary>
|
||||
///
|
||||
/// This is used by callers outside the login process that want to
|
||||
/// verify a user who has given their password.
|
||||
///
|
||||
/// This should probably also be in IAuthentication but is here for the same reasons as VerifySession() is
|
||||
///
|
||||
/// <param name="userID"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
bool AuthenticateUserByPassword(UUID userID, string password);
|
||||
|
||||
// Temporary Hack until we move everything to the new service model
|
||||
void SetInventoryService(IInventoryService invService);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Osp
|
|||
|
||||
public string Name { get { return "OspInventoryWrapperPlugin"; } }
|
||||
public string Version { get { return "0.1"; } }
|
||||
public void Initialise() {}
|
||||
public void Initialise() {}
|
||||
public void Initialise(string connect) {}
|
||||
public void Dispose() {}
|
||||
|
||||
|
@ -80,9 +80,9 @@ namespace OpenSim.Framework.Communications.Osp
|
|||
}
|
||||
|
||||
protected InventoryItemBase PostProcessItem(InventoryItemBase item)
|
||||
{
|
||||
{
|
||||
item.CreatorIdAsUuid = OspResolver.ResolveOspa(item.CreatorId, m_commsManager);
|
||||
return item;
|
||||
return item;
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> getFolderHierarchy(UUID parentID) { return m_wrappedPlugin.getFolderHierarchy(parentID); }
|
||||
|
|
|
@ -33,13 +33,13 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
|
||||
namespace OpenSim.Framework.Communications.Osp
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves OpenSim Profile Anchors (OSPA). An OSPA is a string used to provide information for
|
||||
/// identifying user profiles or supplying a simple name if no profile is available.
|
||||
/// </summary>
|
||||
public class OspResolver
|
||||
{
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public const string OSPA_PREFIX = "ospa:";
|
||||
|
@ -73,7 +73,7 @@ namespace OpenSim.Framework.Communications.Osp
|
|||
{
|
||||
return
|
||||
OSPA_PREFIX + OSPA_NAME_KEY + OSPA_PAIR_SEPARATOR + firstName + OSPA_NAME_VALUE_SEPARATOR + lastName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolve an osp string into the most suitable internal OpenSim identifier.
|
||||
|
@ -89,13 +89,13 @@ namespace OpenSim.Framework.Communications.Osp
|
|||
/// is returned.
|
||||
/// </returns>
|
||||
public static UUID ResolveOspa(string ospa, CommunicationsManager commsManager)
|
||||
{
|
||||
{
|
||||
if (!ospa.StartsWith(OSPA_PREFIX))
|
||||
return UUID.Zero;
|
||||
|
||||
m_log.DebugFormat("[OSP RESOLVER]: Resolving {0}", ospa);
|
||||
|
||||
string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
|
||||
string ospaMeat = ospa.Substring(OSPA_PREFIX.Length);
|
||||
string[] ospaTuples = ospaMeat.Split(OSPA_TUPLE_SEPARATOR_ARRAY);
|
||||
|
||||
foreach (string tuple in ospaTuples)
|
||||
|
@ -162,7 +162,7 @@ namespace OpenSim.Framework.Communications.Osp
|
|||
tempUserProfile.ID = HashName(tempUserProfile.Name);
|
||||
|
||||
m_log.DebugFormat(
|
||||
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
|
||||
"[OSP RESOLVER]: Adding temporary user profile for {0} {1}", tempUserProfile.Name, tempUserProfile.ID);
|
||||
commsManager.UserService.AddTemporaryUserProfile(tempUserProfile);
|
||||
|
||||
return tempUserProfile.ID;
|
||||
|
|
|
@ -1072,7 +1072,7 @@ namespace OpenSim.Framework.Communications.Services
|
|||
/// <param name="user"></param>
|
||||
/// <param name="response"></param>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <returns>true if the region was successfully contacted, false otherwise</returns>
|
||||
/// <returns>true if the region was successfully contacted, false otherwise</returns>
|
||||
protected abstract bool PrepareLoginToRegion(
|
||||
RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client);
|
||||
|
||||
|
@ -1221,11 +1221,13 @@ namespace OpenSim.Framework.Communications.Services
|
|||
{
|
||||
return Util.CreateUnknownUserErrorResponse();
|
||||
}
|
||||
|
||||
UUID.TryParse((string)requestData["session_id"], out guess_sid);
|
||||
if (guess_sid == UUID.Zero)
|
||||
{
|
||||
return Util.CreateUnknownUserErrorResponse();
|
||||
}
|
||||
|
||||
if (m_userManager.VerifySession(guess_aid, guess_sid))
|
||||
{
|
||||
authed = "TRUE";
|
||||
|
@ -1243,6 +1245,5 @@ namespace OpenSim.Framework.Communications.Services
|
|||
response.Value = responseData;
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ using OpenMetaverse;
|
|||
using OpenSim.Data;
|
||||
|
||||
namespace OpenSim.Framework.Communications
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Plugin for managing temporary user profiles.
|
||||
/// </summary>
|
||||
|
@ -45,7 +45,7 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
public string Name { get { return "TemporaryUserProfilePlugin"; } }
|
||||
public string Version { get { return "0.1"; } }
|
||||
public void Initialise() {}
|
||||
public void Initialise() {}
|
||||
public void Initialise(string connect) {}
|
||||
public void Dispose() {}
|
||||
|
||||
|
|
|
@ -149,6 +149,11 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public virtual bool AuthenticateUserByPassword(UUID userID, string password)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
|
||||
timedOut = true;
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
CachedUserInfo userInfo;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
CachedUserInfo userInfo;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
CachedUserInfo userInfo;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
CachedUserInfo userInfo;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
@ -311,7 +311,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
CachedUserInfo userInfo;
|
||||
|
||||
lock (this)
|
||||
{
|
||||
{
|
||||
userInfo = UserProfileTestUtils.CreateUserWithInventory(myScene.CommsManager, InventoryReceived);
|
||||
Monitor.Wait(this, 60000);
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
//Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
|
||||
//Console.WriteLine("Starting T023_TestAuthenticatedLoginAlreadyLoggedIn()");
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
|
||||
string error_already_logged = "You appear to be already logged in. " +
|
||||
|
|
|
@ -44,7 +44,8 @@ namespace OpenSim.Framework.Communications
|
|||
/// <summary>
|
||||
/// Base class for user management (create, read, etc)
|
||||
/// </summary>
|
||||
public abstract class UserManagerBase : IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication
|
||||
public abstract class UserManagerBase
|
||||
: IUserService, IUserAdminService, IAvatarService, IMessagingService, IAuthentication
|
||||
{
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -649,15 +650,17 @@ namespace OpenSim.Framework.Communications
|
|||
public virtual UUID AddUser(
|
||||
string firstName, string lastName, string password, string email, uint regX, uint regY, UUID SetUUID)
|
||||
{
|
||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||
|
||||
UserProfileData user = new UserProfileData();
|
||||
|
||||
user.PasswordSalt = Util.Md5Hash(UUID.Random().ToString());
|
||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + user.PasswordSalt);
|
||||
|
||||
user.HomeLocation = new Vector3(128, 128, 100);
|
||||
user.ID = SetUUID;
|
||||
user.FirstName = firstName;
|
||||
user.SurName = lastName;
|
||||
user.PasswordHash = md5PasswdHash;
|
||||
user.PasswordSalt = String.Empty;
|
||||
user.Created = Util.UnixTimeSinceEpoch();
|
||||
user.HomeLookAt = new Vector3(100, 100, 100);
|
||||
user.HomeRegionX = regX;
|
||||
|
@ -891,7 +894,10 @@ namespace OpenSim.Framework.Communications
|
|||
|
||||
if (userProfile != null && userProfile.CurrentAgent != null)
|
||||
{
|
||||
m_log.DebugFormat("[USER AUTH]: Verifying session {0} for {1}; current session {2}", sessionID, userID, userProfile.CurrentAgent.SessionID);
|
||||
m_log.DebugFormat(
|
||||
"[USER AUTH]: Verifying session {0} for {1}; current session {2}",
|
||||
sessionID, userID, userProfile.CurrentAgent.SessionID);
|
||||
|
||||
if (userProfile.CurrentAgent.SessionID == sessionID)
|
||||
{
|
||||
return true;
|
||||
|
@ -901,6 +907,26 @@ namespace OpenSim.Framework.Communications
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual bool AuthenticateUserByPassword(UUID userID, string password)
|
||||
{
|
||||
// m_log.DebugFormat("[USER AUTH]: Authenticating user {0} given password {1}", userID, password);
|
||||
|
||||
UserProfileData userProfile = GetUserProfile(userID);
|
||||
|
||||
if (null == userProfile)
|
||||
return false;
|
||||
|
||||
string md5PasswordHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + userProfile.PasswordSalt);
|
||||
|
||||
// m_log.DebugFormat(
|
||||
// "[USER AUTH]: Submitted hash {0}, stored hash {1}", md5PasswordHash, userProfile.PasswordHash);
|
||||
|
||||
if (md5PasswordHash == userProfile.PasswordHash)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace OpenSim.Framework.Console
|
|||
/// <param name="helpParts">Parsed parts of the help string. If empty then general help is returned.</param>
|
||||
/// <returns></returns>
|
||||
public List<string> GetHelp(string[] cmd)
|
||||
{
|
||||
{
|
||||
List<string> help = new List<string>();
|
||||
List<string> helpParts = new List<string>(cmd);
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace OpenSim.Framework.Console
|
|||
/// <param name="helpParts"></param>
|
||||
/// <returns></returns>
|
||||
private List<string> CollectHelp(List<string> helpParts)
|
||||
{
|
||||
{
|
||||
string originalHelpRequest = string.Join(" ", helpParts.ToArray());
|
||||
List<string> help = new List<string>();
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace OpenSim.Framework.Console
|
|||
if (dict[helpPart] is Dictionary<string, Object>)
|
||||
dict = (Dictionary<string, object>)dict[helpPart];
|
||||
|
||||
helpParts.RemoveAt(0);
|
||||
helpParts.RemoveAt(0);
|
||||
}
|
||||
|
||||
// There was a command for the given help string
|
||||
|
@ -149,7 +149,7 @@ namespace OpenSim.Framework.Console
|
|||
}
|
||||
|
||||
return help;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string> CollectHelp(Dictionary<string, object> dict)
|
||||
{
|
||||
|
@ -180,7 +180,7 @@ namespace OpenSim.Framework.Console
|
|||
/// <param name="longhelp"></param>
|
||||
/// <param name="fn"></param>
|
||||
public void AddCommand(string module, bool shared, string command,
|
||||
string help, string longhelp, CommandDelegate fn)
|
||||
string help, string longhelp, CommandDelegate fn)
|
||||
{
|
||||
AddCommand(module, shared, command, help, longhelp,
|
||||
String.Empty, fn);
|
||||
|
|
|
@ -197,8 +197,8 @@ namespace OpenSim.Framework.Console
|
|||
|
||||
string uri = "/ReadResponses/" + sessionID.ToString() + "/";
|
||||
|
||||
m_Server.AddPollServiceHTTPHandler(uri, HandleHttpCloseSession,
|
||||
new PollServiceEventArgs(HasEvents, GetEvents, NoEvents,
|
||||
m_Server.AddPollServiceHTTPHandler(uri, HandleHttpPoll,
|
||||
new PollServiceEventArgs(null, HasEvents, GetEvents, NoEvents,
|
||||
sessionID));
|
||||
|
||||
XmlDocument xmldoc = new XmlDocument();
|
||||
|
@ -230,6 +230,11 @@ namespace OpenSim.Framework.Console
|
|||
return reply;
|
||||
}
|
||||
|
||||
private Hashtable HandleHttpPoll(Hashtable request)
|
||||
{
|
||||
return new Hashtable();
|
||||
}
|
||||
|
||||
private Hashtable HandleHttpCloseSession(Hashtable request)
|
||||
{
|
||||
DoExpire();
|
||||
|
@ -365,7 +370,7 @@ namespace OpenSim.Framework.Console
|
|||
}
|
||||
}
|
||||
|
||||
private bool HasEvents(UUID sessionID)
|
||||
private bool HasEvents(UUID RequestID, UUID sessionID)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
|
@ -381,19 +386,19 @@ namespace OpenSim.Framework.Console
|
|||
return false;
|
||||
}
|
||||
|
||||
private Hashtable GetEvents(UUID sessionID, string request)
|
||||
private Hashtable GetEvents(UUID RequestID, UUID sessionID, string request)
|
||||
{
|
||||
ConsoleConnection c = null;
|
||||
|
||||
lock (m_Connections)
|
||||
{
|
||||
if (!m_Connections.ContainsKey(sessionID))
|
||||
return NoEvents();
|
||||
return NoEvents(RequestID, UUID.Zero);
|
||||
c = m_Connections[sessionID];
|
||||
}
|
||||
c.last = System.Environment.TickCount;
|
||||
if (c.lastLineSeen >= m_LineNumber)
|
||||
return NoEvents();
|
||||
return NoEvents(RequestID, UUID.Zero);
|
||||
|
||||
Hashtable result = new Hashtable();
|
||||
|
||||
|
@ -435,7 +440,7 @@ namespace OpenSim.Framework.Console
|
|||
return result;
|
||||
}
|
||||
|
||||
private Hashtable NoEvents()
|
||||
private Hashtable NoEvents(UUID RequestID, UUID id)
|
||||
{
|
||||
Hashtable result = new Hashtable();
|
||||
|
||||
|
|
|
@ -90,13 +90,13 @@ namespace OpenSim.Framework
|
|||
|
||||
m_configMember.addConfigurationOption("allow_forceful_banlines",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Allow Forceful Banlines", "TRUE", true);
|
||||
"Allow Forceful Banlines", "TRUE", true);
|
||||
|
||||
m_configMember.addConfigurationOption("allow_region_registration",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN,
|
||||
"Allow regions to register immediately upon grid server startup? true/false",
|
||||
"True",
|
||||
false);
|
||||
false);
|
||||
m_configMember.addConfigurationOption("console_user", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"Remote console access user name [Default: disabled]", "", false);
|
||||
|
||||
|
@ -147,7 +147,7 @@ namespace OpenSim.Framework
|
|||
break;
|
||||
case "allow_region_registration":
|
||||
AllowRegionRegistration = (bool)configuration_result;
|
||||
break;
|
||||
break;
|
||||
case "console_user":
|
||||
ConsoleUser = (string)configuration_result;
|
||||
break;
|
||||
|
|
|
@ -34,23 +34,23 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <summary>
|
||||
/// Interface to the local asset cache. This is the mechanism through which assets can be added and requested.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public interface IAssetCache : IPlugin
|
||||
{
|
||||
/// <value>
|
||||
/// The 'server' from which assets can be requested and to which assets are persisted.
|
||||
/// </value>
|
||||
/// </value>
|
||||
|
||||
void Initialise(ConfigSettings cs);
|
||||
void Initialise(ConfigSettings cs);
|
||||
|
||||
/// <summary>
|
||||
/// Report statistical data to the log.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
void ShowState();
|
||||
|
||||
/// <summary>
|
||||
/// Clear the asset cache.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
void Clear();
|
||||
|
||||
/// <summary>
|
||||
|
@ -58,7 +58,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <param name="assetId"></param>
|
||||
/// <param name="asset"></param>
|
||||
/// <returns>true if the asset was in the cache, false if it was not</returns>
|
||||
/// <returns>true if the asset was in the cache, false if it was not</returns>
|
||||
bool TryGetCachedAsset(UUID assetID, out AssetBase asset);
|
||||
|
||||
/// <summary>
|
||||
|
@ -69,7 +69,7 @@ namespace OpenSim.Framework
|
|||
/// <param name="isTexture"></param>
|
||||
/// A callback invoked when the asset has either been found or not found.
|
||||
/// If the asset was found this is called with the asset UUID and the asset data
|
||||
/// If the asset was not found this is still called with the asset UUID but with a null asset data reference</param>
|
||||
/// If the asset was not found this is still called with the asset UUID but with a null asset data reference</param>
|
||||
void GetAsset(UUID assetID, AssetRequestCallback callback, bool isTexture);
|
||||
|
||||
/// <summary>
|
||||
|
@ -84,13 +84,13 @@ namespace OpenSim.Framework
|
|||
///
|
||||
/// <param name="assetID"></param>
|
||||
/// <param name="isTexture"></param>
|
||||
/// <returns>null if the asset could not be retrieved</returns>
|
||||
/// <returns>null if the asset could not be retrieved</returns>
|
||||
AssetBase GetAsset(UUID assetID, bool isTexture);
|
||||
|
||||
/// <summary>
|
||||
/// Add an asset to both the persistent store and the cache.
|
||||
/// </summary>
|
||||
/// <param name="asset"></param>
|
||||
/// <param name="asset"></param>
|
||||
void AddAsset(AssetBase asset);
|
||||
|
||||
/// <summary>
|
||||
|
@ -100,14 +100,14 @@ namespace OpenSim.Framework
|
|||
/// of the asset cache. This is needed because the osdynamic
|
||||
/// texture code grows the asset cache without bounds. The
|
||||
/// real solution here is a much better cache archicture, but
|
||||
/// this is a stop gap measure until we have such a thing.
|
||||
/// this is a stop gap measure until we have such a thing.
|
||||
void ExpireAsset(UUID assetID);
|
||||
|
||||
/// <summary>
|
||||
/// Handle an asset request from the client. The result will be sent back asynchronously.
|
||||
/// </summary>
|
||||
/// <param name="userInfo"></param>
|
||||
/// <param name="transferRequest"></param>
|
||||
/// <param name="transferRequest"></param>
|
||||
void AddAssetRequest(IClientAPI userInfo, TransferRequestPacket transferRequest);
|
||||
}
|
||||
|
||||
|
|
|
@ -810,7 +810,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
void Start();
|
||||
|
||||
void Stop();
|
||||
void Stop();
|
||||
|
||||
// void ActivateGesture(UUID assetId, UUID gestureId);
|
||||
|
||||
|
@ -824,7 +824,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <param name="agentID">The id of the agent associated with the appearance</param>
|
||||
/// <param name="visualParams"></param>
|
||||
/// <param name="textureEntry"></param>
|
||||
/// <param name="textureEntry"></param>
|
||||
void SendAppearance(UUID agentID, byte[] visualParams, byte[] textureEntry);
|
||||
|
||||
void SendStartPingCheck(byte seq);
|
||||
|
@ -833,7 +833,7 @@ namespace OpenSim.Framework
|
|||
/// Tell the client that an object has been deleted
|
||||
/// </summary>
|
||||
/// <param name="regionHandle"></param>
|
||||
/// <param name="localID"></param>
|
||||
/// <param name="localID"></param>
|
||||
void SendKillObject(ulong regionHandle, uint localID);
|
||||
|
||||
void SendAnimations(UUID[] animID, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||
|
|
|
@ -180,16 +180,16 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="MaxElementSize"/>
|
||||
/// <seealso cref="Size"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
/// <seealso cref="IsCountLimited"/>
|
||||
/// <seealso cref="IsTimeLimited"/>
|
||||
bool IsSizeLimited { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// Gets a value indicating whether elements stored to <see cref="ICnmCache{TKey,TValue}"/> have limited inactivity time.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <see langword="true"/> if the <see cref="ICnmCache{TKey,TValue}"/> has a fixed total size of elements;
|
||||
|
@ -200,7 +200,7 @@ namespace OpenSim.Framework
|
|||
/// or <see cref="TryGetValue"/> methods in <see cref="ExpirationTime"/> , then element is automatically removed from
|
||||
/// the cache. Depending on implementation of the <see cref="ICnmCache{TKey,TValue}"/>, some of the elements may
|
||||
/// stay longer in cache.
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="ExpirationTime"/>
|
||||
/// <seealso cref="PurgeExpired"/>
|
||||
/// <seealso cref="IsCountLimited"/>
|
||||
|
@ -237,7 +237,7 @@ namespace OpenSim.Framework
|
|||
/// <seealso cref="Set"/>
|
||||
/// <seealso cref="IsSizeLimited"/>
|
||||
/// <seealso cref="Size"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
long MaxElementSize { get; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -246,7 +246,7 @@ namespace OpenSim.Framework
|
|||
/// <value>
|
||||
/// Maximal allowed total size for elements stored to <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Normally size is total bytes used by elements in the cache. But it can be any other suitable unit of measure.
|
||||
/// </para>
|
||||
|
@ -278,10 +278,10 @@ namespace OpenSim.Framework
|
|||
/// When adding an new element to <see cref="ICnmCache{TKey,TValue}"/> that is limiting total size of elements,
|
||||
/// <see cref="ICnmCache{TKey,TValue}"/> will remove less recently used elements until it can fit an new element.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// </remarks>
|
||||
/// <seealso cref="MaxElementSize"/>
|
||||
/// <seealso cref="IsSizeLimited"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
/// <seealso cref="MaxSize"/>
|
||||
/// <seealso cref="IsCountLimited"/>
|
||||
/// <seealso cref="ExpirationTime"/>
|
||||
long Size { get; }
|
||||
|
@ -289,9 +289,9 @@ namespace OpenSim.Framework
|
|||
/// <summary>
|
||||
/// Gets an object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <value>
|
||||
/// An object that can be used to synchronize access to the <see cref="ICnmCache{TKey,TValue}"/>.
|
||||
/// </value>
|
||||
/// </value>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// To get synchronized (thread safe) access to <see cref="ICnmCache{TKey,TValue}"/>, use <see cref="CnmSynchronizedCache{TKey,TValue}"/>
|
||||
|
@ -322,7 +322,7 @@ namespace OpenSim.Framework
|
|||
/// </para>
|
||||
/// <para>
|
||||
/// Depending on <see cref="ICnmCache{TKey,TValue}"/> implementation, some of expired elements
|
||||
/// may stay longer than <see cref="ExpirationTime"/> in the cache.
|
||||
/// may stay longer than <see cref="ExpirationTime"/> in the cache.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <seealso cref="IsTimeLimited"/>
|
||||
|
@ -418,7 +418,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
/// <returns>
|
||||
/// <see langword="true"/>if the <see cref="ICnmCache{TKey,TValue}"/> contains an element with
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// the specified key; otherwise, <see langword="false"/>.
|
||||
/// </returns>
|
||||
/// <param name="key">
|
||||
/// The key whose <paramref name="value"/> to get.
|
||||
|
|
|
@ -46,8 +46,6 @@ namespace OpenSim.Framework
|
|||
|
||||
public delegate bool CloseAgentConnection(UUID agentID);
|
||||
|
||||
public delegate bool RegionUp(RegionInfo region);
|
||||
|
||||
public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData);
|
||||
|
||||
public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message);
|
||||
|
@ -65,7 +63,6 @@ namespace OpenSim.Framework
|
|||
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
||||
event UpdateNeighbours OnNeighboursUpdate;
|
||||
event CloseAgentConnection OnCloseAgentConnection;
|
||||
event RegionUp OnRegionUp;
|
||||
event ChildAgentUpdate OnChildAgentUpdate;
|
||||
event LogOffUser OnLogOffUser;
|
||||
event GetLandData OnGetLandData;
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace OpenSim.Framework
|
|||
GodTakeCopy = 5,
|
||||
Delete = 6,
|
||||
Return = 9
|
||||
};
|
||||
};
|
||||
|
||||
public interface IScene
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ namespace OpenSim.Framework
|
|||
void CloseAllAgents(uint circuitcode);
|
||||
|
||||
void Restart(int seconds);
|
||||
bool OtherRegionUp(RegionInfo thisRegion);
|
||||
//RegionInfo OtherRegionUp(RegionInfo thisRegion);
|
||||
|
||||
string GetSimulatorVersion();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public interface ISceneObject
|
||||
{
|
||||
UUID UUID { get; }
|
||||
UUID UUID { get; }
|
||||
ISceneObject CloneForNewScene();
|
||||
string ToXml2();
|
||||
string ExtraToXmlString();
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace OpenSim.Framework
|
|||
ID = id;
|
||||
Name = name;
|
||||
Owner = owner;
|
||||
ParentID = parent;
|
||||
ParentID = parent;
|
||||
}
|
||||
|
||||
public InventoryFolderBase(UUID id, string name, UUID owner, short type, UUID parent, ushort version)
|
||||
|
|
|
@ -304,7 +304,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <summary>
|
||||
/// Find a folder given a PATH_DELIMITER delimited path starting from this folder
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
///
|
||||
/// This method does not handle paths that contain multiple delimitors
|
||||
///
|
||||
|
|
|
@ -34,10 +34,10 @@ namespace OpenSim.Framework
|
|||
/// Inventory Item - contains all the properties associated with an individual inventory piece.
|
||||
/// </summary>
|
||||
public class InventoryItemBase : InventoryNodeBase, ICloneable
|
||||
{
|
||||
{
|
||||
/// <value>
|
||||
/// The inventory type of the item. This is slightly different from the asset type in some situations.
|
||||
/// </value>
|
||||
/// </value>
|
||||
public int InvType
|
||||
{
|
||||
get
|
||||
|
@ -54,7 +54,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
/// The folder this item is contained in
|
||||
/// </value>
|
||||
/// </value>
|
||||
public UUID Folder
|
||||
{
|
||||
get
|
||||
|
@ -71,7 +71,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
/// The creator of this item
|
||||
/// </value>
|
||||
/// </value>
|
||||
public string CreatorId
|
||||
{
|
||||
get
|
||||
|
@ -114,7 +114,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
m_creatorIdAsUuid = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected UUID m_creatorIdAsUuid = UUID.Zero;
|
||||
|
||||
/// <value>
|
||||
|
@ -130,13 +130,13 @@ namespace OpenSim.Framework
|
|||
set
|
||||
{
|
||||
m_description = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
protected string m_description = String.Empty;
|
||||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint NextPermissions
|
||||
{
|
||||
get
|
||||
|
@ -153,7 +153,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
/// A mask containing permissions for the current owner (cannot be enforced)
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint CurrentPermissions
|
||||
{
|
||||
get
|
||||
|
@ -170,7 +170,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint BasePermissions
|
||||
{
|
||||
get
|
||||
|
@ -187,7 +187,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint EveryOnePermissions
|
||||
{
|
||||
get
|
||||
|
@ -204,7 +204,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint GroupPermissions
|
||||
{
|
||||
get
|
||||
|
@ -221,7 +221,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
/// This is an enumerated value determining the type of asset (eg Notecard, Sound, Object, etc)
|
||||
/// </value>
|
||||
/// </value>
|
||||
public int AssetType
|
||||
{
|
||||
get
|
||||
|
@ -238,7 +238,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
/// The UUID of the associated asset on the asset server
|
||||
/// </value>
|
||||
/// </value>
|
||||
public UUID AssetID
|
||||
{
|
||||
get
|
||||
|
@ -255,7 +255,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public UUID GroupID
|
||||
{
|
||||
get
|
||||
|
@ -272,13 +272,13 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public bool GroupOwned
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_groupOwned;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public int SalePrice
|
||||
{
|
||||
get
|
||||
|
@ -306,7 +306,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public byte SaleType
|
||||
{
|
||||
get
|
||||
|
@ -323,7 +323,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public uint Flags
|
||||
{
|
||||
get
|
||||
|
@ -340,7 +340,7 @@ namespace OpenSim.Framework
|
|||
|
||||
/// <value>
|
||||
///
|
||||
/// </value>
|
||||
/// </value>
|
||||
public int CreationDate
|
||||
{
|
||||
get
|
||||
|
|
|
@ -31,12 +31,12 @@ namespace OpenSim.Framework
|
|||
{
|
||||
/// <summary>
|
||||
/// Common base class for inventory nodes of different types (files, folders, etc.)
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public class InventoryNodeBase
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the node (64 characters or less)
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public virtual string Name
|
||||
{
|
||||
get { return m_name; }
|
||||
|
@ -51,17 +51,17 @@ namespace OpenSim.Framework
|
|||
{
|
||||
get { return m_id; }
|
||||
set { m_id = value; }
|
||||
}
|
||||
}
|
||||
private UUID m_id;
|
||||
|
||||
/// <summary>
|
||||
/// The agent who's inventory this is contained by
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public virtual UUID Owner
|
||||
{
|
||||
get { return m_owner; }
|
||||
set { m_owner = value; }
|
||||
}
|
||||
private UUID m_owner;
|
||||
private UUID m_owner;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace OpenSim.Framework
|
|||
{
|
||||
public class NetworkServersInfo
|
||||
{
|
||||
public string AssetSendKey = String.Empty;
|
||||
public string AssetSendKey = String.Empty;
|
||||
public string AssetURL = "http://127.0.0.1:" + ConfigSettings.DefaultAssetServerHttpPort.ToString() + "/";
|
||||
|
||||
public string GridRecvKey = String.Empty;
|
||||
|
@ -102,8 +102,7 @@ namespace OpenSim.Framework
|
|||
ConfigSettings.DefaultInventoryServerHttpPort.ToString());
|
||||
secureInventoryServer = config.Configs["Network"].GetBoolean("secure_inventory_server", true);
|
||||
|
||||
MessagingURL = config.Configs["Network"].GetString("messaging_server_url",
|
||||
"http://127.0.0.1:" + ConfigSettings.DefaultMessageServerHttpPort);
|
||||
MessagingURL = config.Configs["Network"].GetString("messaging_server_url", string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace OpenSim.Framework
|
|||
private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser
|
||||
private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate;
|
||||
private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion;
|
||||
private RegionUp handlerRegionUp = null; // OnRegionUp;
|
||||
private LogOffUser handlerLogOffUser = null;
|
||||
private GetLandData handlerGetLandData = null;
|
||||
|
||||
|
@ -62,7 +61,6 @@ namespace OpenSim.Framework
|
|||
public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||
public event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
||||
public event CloseAgentConnection OnCloseAgentConnection;
|
||||
public event RegionUp OnRegionUp;
|
||||
public event ChildAgentUpdate OnChildAgentUpdate;
|
||||
public event LogOffUser OnLogOffUser;
|
||||
public event GetLandData OnGetLandData;
|
||||
|
@ -108,17 +106,6 @@ namespace OpenSim.Framework
|
|||
return false;
|
||||
}
|
||||
|
||||
public virtual bool TriggerRegionUp(RegionInfo region)
|
||||
{
|
||||
handlerRegionUp = OnRegionUp;
|
||||
if (handlerRegionUp != null)
|
||||
{
|
||||
handlerRegionUp(region);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData)
|
||||
{
|
||||
handlerChildAgentUpdate = OnChildAgentUpdate;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Xml;
|
||||
|
@ -63,6 +64,13 @@ namespace OpenSim.Framework
|
|||
}
|
||||
protected string m_serverURI;
|
||||
|
||||
public string RegionName
|
||||
{
|
||||
get { return m_regionName; }
|
||||
set { m_regionName = value; }
|
||||
}
|
||||
protected string m_regionName = String.Empty;
|
||||
|
||||
protected bool Allow_Alternate_Ports;
|
||||
public bool m_allow_alternate_ports;
|
||||
protected string m_externalHostName;
|
||||
|
@ -100,6 +108,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public SimpleRegionInfo(RegionInfo ConvertFrom)
|
||||
{
|
||||
m_regionName = ConvertFrom.RegionName;
|
||||
m_regionLocX = ConvertFrom.RegionLocX;
|
||||
m_regionLocY = ConvertFrom.RegionLocY;
|
||||
m_internalEndPoint = ConvertFrom.InternalEndPoint;
|
||||
|
@ -197,6 +206,67 @@ namespace OpenSim.Framework
|
|||
{
|
||||
return m_internalEndPoint.Port;
|
||||
}
|
||||
|
||||
public Dictionary<string, object> ToKeyValuePairs()
|
||||
{
|
||||
Dictionary<string, object> kvp = new Dictionary<string, object>();
|
||||
kvp["uuid"] = RegionID.ToString();
|
||||
kvp["locX"] = RegionLocX.ToString();
|
||||
kvp["locY"] = RegionLocY.ToString();
|
||||
kvp["external_ip_address"] = ExternalEndPoint.Address.ToString();
|
||||
kvp["external_port"] = ExternalEndPoint.Port.ToString();
|
||||
kvp["external_host_name"] = ExternalHostName;
|
||||
kvp["http_port"] = HttpPort.ToString();
|
||||
kvp["internal_ip_address"] = InternalEndPoint.Address.ToString();
|
||||
kvp["internal_port"] = InternalEndPoint.Port.ToString();
|
||||
kvp["alternate_ports"] = m_allow_alternate_ports.ToString();
|
||||
kvp["server_uri"] = ServerURI;
|
||||
|
||||
return kvp;
|
||||
}
|
||||
|
||||
public SimpleRegionInfo(Dictionary<string, object> kvp)
|
||||
{
|
||||
if ((kvp["external_ip_address"] != null) && (kvp["external_port"] != null))
|
||||
{
|
||||
int port = 0;
|
||||
Int32.TryParse((string)kvp["external_port"], out port);
|
||||
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["external_ip_address"]), port);
|
||||
ExternalEndPoint = ep;
|
||||
}
|
||||
else
|
||||
ExternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
|
||||
if (kvp["external_host_name"] != null)
|
||||
ExternalHostName = (string)kvp["external_host_name"];
|
||||
|
||||
if (kvp["http_port"] != null)
|
||||
{
|
||||
UInt32 port = 0;
|
||||
UInt32.TryParse((string)kvp["http_port"], out port);
|
||||
HttpPort = port;
|
||||
}
|
||||
|
||||
if ((kvp["internal_ip_address"] != null) && (kvp["internal_port"] != null))
|
||||
{
|
||||
int port = 0;
|
||||
Int32.TryParse((string)kvp["internal_port"], out port);
|
||||
IPEndPoint ep = new IPEndPoint(IPAddress.Parse((string)kvp["internal_ip_address"]), port);
|
||||
InternalEndPoint = ep;
|
||||
}
|
||||
else
|
||||
InternalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 0);
|
||||
|
||||
if (kvp["alternate_ports"] != null)
|
||||
{
|
||||
bool alts = false;
|
||||
Boolean.TryParse((string)kvp["alternate_ports"], out alts);
|
||||
m_allow_alternate_ports = alts;
|
||||
}
|
||||
|
||||
if (kvp["server_uri"] != null)
|
||||
ServerURI = (string)kvp["server_uri"];
|
||||
}
|
||||
}
|
||||
|
||||
public class RegionInfo : SimpleRegionInfo
|
||||
|
@ -222,7 +292,6 @@ namespace OpenSim.Framework
|
|||
public UUID originRegionID = UUID.Zero;
|
||||
public string proxyUrl = "";
|
||||
public int ProxyOffset = 0;
|
||||
public string RegionName = String.Empty;
|
||||
public string regionSecret = UUID.Random().ToString();
|
||||
|
||||
public string osSecret;
|
||||
|
@ -971,7 +1040,7 @@ namespace OpenSim.Framework
|
|||
public static RegionInfo Create(UUID regionID, string regionName, uint regX, uint regY, string externalHostName, uint httpPort, uint simPort, uint remotingPort, string serverURI)
|
||||
{
|
||||
RegionInfo regionInfo;
|
||||
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort);
|
||||
IPEndPoint neighbourInternalEndPoint = new IPEndPoint(Util.GetHostFromDNS(externalHostName), (int)simPort);
|
||||
regionInfo = new RegionInfo(regX, regY, neighbourInternalEndPoint, externalHostName);
|
||||
regionInfo.RemotingPort = remotingPort;
|
||||
regionInfo.RemotingAddress = externalHostName;
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
|
||||
namespace OpenSim.Framework.Serialization.External
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize and deserialize LandData as an external format.
|
||||
/// </summary>
|
||||
public class LandDataSerializer
|
||||
{
|
||||
protected static UTF8Encoding m_utf8Encoding = new UTF8Encoding();
|
||||
|
||||
/// <summary>
|
||||
/// Reify/deserialize landData
|
||||
/// </summary>
|
||||
/// <param name="serializedLandData"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static LandData Deserialize(byte[] serializedLandData)
|
||||
{
|
||||
return Deserialize(m_utf8Encoding.GetString(serializedLandData, 0, serializedLandData.Length));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reify/deserialize landData
|
||||
/// </summary>
|
||||
/// <param name="serializedLandData"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="System.Xml.XmlException"></exception>
|
||||
public static LandData Deserialize(string serializedLandData)
|
||||
{
|
||||
LandData landData = new LandData();
|
||||
|
||||
StringReader sr = new StringReader(serializedLandData);
|
||||
XmlTextReader xtr = new XmlTextReader(sr);
|
||||
|
||||
xtr.ReadStartElement("LandData");
|
||||
|
||||
landData.Area = Convert.ToInt32( xtr.ReadElementString("Area"));
|
||||
landData.AuctionID = Convert.ToUInt32( xtr.ReadElementString("AuctionID"));
|
||||
landData.AuthBuyerID = UUID.Parse( xtr.ReadElementString("AuthBuyerID"));
|
||||
landData.Category = (ParcelCategory)Convert.ToSByte( xtr.ReadElementString("Category"));
|
||||
landData.ClaimDate = Convert.ToInt32( xtr.ReadElementString("ClaimDate"));
|
||||
landData.ClaimPrice = Convert.ToInt32( xtr.ReadElementString("ClaimPrice"));
|
||||
landData.GlobalID = UUID.Parse( xtr.ReadElementString("GlobalID"));
|
||||
landData.GroupID = UUID.Parse( xtr.ReadElementString("GroupID"));
|
||||
landData.IsGroupOwned = Convert.ToBoolean( xtr.ReadElementString("IsGroupOwned"));
|
||||
landData.Bitmap = Convert.FromBase64String( xtr.ReadElementString("Bitmap"));
|
||||
landData.Description = xtr.ReadElementString("Description");
|
||||
landData.Flags = Convert.ToUInt32( xtr.ReadElementString("Flags"));
|
||||
landData.LandingType = Convert.ToByte( xtr.ReadElementString("LandingType"));
|
||||
landData.Name = xtr.ReadElementString("Name");
|
||||
landData.Status = (ParcelStatus)Convert.ToSByte( xtr.ReadElementString("Status"));
|
||||
landData.LocalID = Convert.ToInt32( xtr.ReadElementString("LocalID"));
|
||||
landData.MediaAutoScale = Convert.ToByte( xtr.ReadElementString("MediaAutoScale"));
|
||||
landData.MediaID = UUID.Parse( xtr.ReadElementString("MediaID"));
|
||||
landData.MediaURL = xtr.ReadElementString("MediaURL");
|
||||
landData.MusicURL = xtr.ReadElementString("MusicURL");
|
||||
landData.OwnerID = UUID.Parse( xtr.ReadElementString("OwnerID"));
|
||||
|
||||
landData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
|
||||
xtr.ReadStartElement("ParcelAccessList");
|
||||
while (xtr.Read() && xtr.NodeType != XmlNodeType.EndElement)
|
||||
{
|
||||
ParcelManager.ParcelAccessEntry pae;
|
||||
|
||||
xtr.ReadStartElement("ParcelAccessEntry");
|
||||
pae.AgentID = UUID.Parse( xtr.ReadElementString("AgentID"));
|
||||
pae.Time = Convert.ToDateTime( xtr.ReadElementString("Time"));
|
||||
pae.Flags = (AccessList)Convert.ToUInt32( xtr.ReadElementString("AccessList"));
|
||||
xtr.ReadEndElement();
|
||||
|
||||
landData.ParcelAccessList.Add(pae);
|
||||
}
|
||||
xtr.ReadEndElement();
|
||||
|
||||
landData.PassHours = Convert.ToSingle( xtr.ReadElementString("PassHours"));
|
||||
landData.PassPrice = Convert.ToInt32( xtr.ReadElementString("PassPrice"));
|
||||
landData.SalePrice = Convert.ToInt32( xtr.ReadElementString("SalePrice"));
|
||||
landData.SnapshotID = UUID.Parse( xtr.ReadElementString("SnapshotID"));
|
||||
landData.UserLocation = Vector3.Parse( xtr.ReadElementString("UserLocation"));
|
||||
landData.UserLookAt = Vector3.Parse( xtr.ReadElementString("UserLookAt"));
|
||||
landData.Dwell = Convert.ToInt32( xtr.ReadElementString("Dwell"));
|
||||
landData.OtherCleanTime = Convert.ToInt32( xtr.ReadElementString("OtherCleanTime"));
|
||||
|
||||
xtr.ReadEndElement();
|
||||
|
||||
xtr.Close();
|
||||
sr.Close();
|
||||
|
||||
return landData;
|
||||
}
|
||||
|
||||
public static string Serialize(LandData landData)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
XmlTextWriter xtw = new XmlTextWriter(sw);
|
||||
xtw.Formatting = Formatting.Indented;
|
||||
|
||||
xtw.WriteStartDocument();
|
||||
xtw.WriteStartElement("LandData");
|
||||
|
||||
xtw.WriteElementString("Area", landData.Area.ToString());
|
||||
xtw.WriteElementString("AuctionID", landData.AuctionID.ToString());
|
||||
xtw.WriteElementString("AuthBuyerID", landData.AuthBuyerID.ToString());
|
||||
xtw.WriteElementString("Category", landData.Category.ToString());
|
||||
xtw.WriteElementString("ClaimDate", landData.ClaimDate.ToString());
|
||||
xtw.WriteElementString("ClaimPrice", landData.ClaimPrice.ToString());
|
||||
xtw.WriteElementString("GlobalID", landData.GlobalID.ToString());
|
||||
xtw.WriteElementString("GroupID", landData.GroupID.ToString());
|
||||
xtw.WriteElementString("IsGroupOwned", landData.IsGroupOwned.ToString());
|
||||
xtw.WriteElementString("Bitmap", landData.Bitmap.ToString());
|
||||
xtw.WriteElementString("Description", landData.Description);
|
||||
xtw.WriteElementString("Flags", landData.Flags.ToString());
|
||||
xtw.WriteElementString("LandingType", landData.LandingType.ToString());
|
||||
xtw.WriteElementString("Name", landData.Name);
|
||||
xtw.WriteElementString("Status", landData.Status.ToString());
|
||||
xtw.WriteElementString("LocalID", landData.LocalID.ToString());
|
||||
xtw.WriteElementString("MediaAutoScale", landData.MediaAutoScale.ToString());
|
||||
xtw.WriteElementString("MediaID", landData.MediaID.ToString());
|
||||
xtw.WriteElementString("MediaURL", landData.MediaURL.ToString());
|
||||
xtw.WriteElementString("MusicURL", landData.MusicURL.ToString());
|
||||
xtw.WriteElementString("OwnerID", landData.OwnerID.ToString());
|
||||
|
||||
xtw.WriteStartElement("ParcelAccessList");
|
||||
foreach(ParcelManager.ParcelAccessEntry pal in landData.ParcelAccessList)
|
||||
{
|
||||
xtw.WriteStartElement("ParcelAccessEntry");
|
||||
xtw.WriteElementString("AgentID", pal.AgentID.ToString());
|
||||
xtw.WriteElementString("Time", pal.Time.ToString());
|
||||
xtw.WriteElementString("AccessList", pal.Flags.ToString());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.WriteElementString("PassHours", landData.PassHours.ToString());
|
||||
xtw.WriteElementString("PassPrice", landData.PassPrice.ToString());
|
||||
xtw.WriteElementString("SalePrice", landData.SalePrice.ToString());
|
||||
xtw.WriteElementString("SnapshotID", landData.SnapshotID.ToString());
|
||||
xtw.WriteElementString("UserLocation", landData.UserLocation.ToString());
|
||||
xtw.WriteElementString("UserLookAt", landData.UserLookAt.ToString());
|
||||
xtw.WriteElementString("Dwell", landData.Dwell.ToString());
|
||||
xtw.WriteElementString("OtherCleanTime", landData.OtherCleanTime.ToString());
|
||||
|
||||
xtw.WriteEndElement();
|
||||
|
||||
xtw.Close();
|
||||
sw.Close();
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -158,7 +158,7 @@ namespace OpenSim.Framework.Serialization.External
|
|||
settings.Elevation2NE = double.Parse(xtr.ReadElementContentAsString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xtr.ReadEndElement();
|
||||
xtr.ReadStartElement("Terrain");
|
||||
|
@ -200,8 +200,8 @@ namespace OpenSim.Framework.Serialization.External
|
|||
|
||||
xtw.WriteStartElement("RegionSettings");
|
||||
|
||||
xtw.WriteStartElement("General");
|
||||
xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
|
||||
xtw.WriteStartElement("General");
|
||||
xtw.WriteElementString("AllowDamage", settings.AllowDamage.ToString());
|
||||
xtw.WriteElementString("AllowLandResell", settings.AllowLandResell.ToString());
|
||||
xtw.WriteElementString("AllowLandJoinDivide", settings.AllowLandJoinDivide.ToString());
|
||||
xtw.WriteElementString("BlockFly", settings.BlockFly.ToString());
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.Framework.Serialization.External
|
|||
/// Serialize and deserialize region settings as an external format.
|
||||
/// </summary>
|
||||
public class UserProfileSerializer
|
||||
{
|
||||
{
|
||||
public const int MAJOR_VERSION = 0;
|
||||
public const int MINOR_VERSION = 1;
|
||||
|
||||
|
@ -65,6 +65,6 @@ namespace OpenSim.Framework.Serialization.External
|
|||
sw.Close();
|
||||
|
||||
return sw.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
public abstract class BaseGetAssetStreamHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected BaseGetAssetStreamHandler(string httpMethod, string path) : base(httpMethod, path)
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract AssetBase GetAsset(UUID assetID);
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
byte[] result = new byte[] { };
|
||||
|
||||
string[] p = SplitParams(path);
|
||||
|
||||
if (p.Length > 0)
|
||||
{
|
||||
UUID assetID;
|
||||
|
||||
if (!UUID.TryParse(p[0], out assetID))
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (StatsManager.AssetStats != null)
|
||||
{
|
||||
StatsManager.AssetStats.AddRequest();
|
||||
}
|
||||
|
||||
AssetBase asset = GetAsset(assetID);
|
||||
|
||||
if (asset != null)
|
||||
{
|
||||
if (p.Length > 1 && p[1] == "data")
|
||||
{
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.OK;
|
||||
httpResponse.ContentType = SLAssetTypeToContentType(asset.Type);
|
||||
result = asset.Data;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = GetXml(asset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[REST]: GET:/asset failed to find {0}", assetID);
|
||||
|
||||
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
|
||||
if (StatsManager.AssetStats != null)
|
||||
{
|
||||
StatsManager.AssetStats.AddNotFoundRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static byte[] GetXml(AssetBase asset)
|
||||
{
|
||||
byte[] result;
|
||||
XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||
MemoryStream ms = new MemoryStream();
|
||||
XmlTextWriter xw = new XmlTextWriter(ms, Encoding.UTF8);
|
||||
xw.Formatting = Formatting.Indented;
|
||||
xs.Serialize(xw, asset);
|
||||
xw.Flush();
|
||||
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
//StreamReader sr = new StreamReader(ms);
|
||||
|
||||
result = ms.GetBuffer();
|
||||
|
||||
Array.Resize<byte>(ref result, (int)ms.Length);
|
||||
return result;
|
||||
}
|
||||
|
||||
public string ProcessAssetDataString(string data)
|
||||
{
|
||||
Regex regex = new Regex("(creator_id|owner_id)\\s+(\\S+)");
|
||||
|
||||
// IUserService userService = null;
|
||||
|
||||
data = regex.Replace(data, delegate(Match m)
|
||||
{
|
||||
string result = String.Empty;
|
||||
|
||||
// string key = m.Groups[1].Captures[0].Value;
|
||||
//
|
||||
// string value = m.Groups[2].Captures[0].Value;
|
||||
//
|
||||
// Guid userUri;
|
||||
//
|
||||
// switch (key)
|
||||
// {
|
||||
// case "creator_id":
|
||||
// userUri = new Guid(value);
|
||||
// // result = "creator_url " + userService(userService, userUri);
|
||||
// break;
|
||||
//
|
||||
// case "owner_id":
|
||||
// userUri = new Guid(value);
|
||||
// // result = "owner_url " + ResolveUserUri(userService, userUri);
|
||||
// break;
|
||||
// }
|
||||
|
||||
return result;
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private string SLAssetTypeToContentType(int assetType)
|
||||
{
|
||||
switch (assetType)
|
||||
{
|
||||
case 0:
|
||||
return "image/jp2";
|
||||
case 1:
|
||||
return "application/ogg";
|
||||
case 2:
|
||||
return "application/x-metaverse-callingcard";
|
||||
case 3:
|
||||
return "application/x-metaverse-landmark";
|
||||
case 5:
|
||||
return "application/x-metaverse-clothing";
|
||||
case 6:
|
||||
return "application/x-metaverse-primitive";
|
||||
case 7:
|
||||
return "application/x-metaverse-notecard";
|
||||
case 8:
|
||||
return "application/x-metaverse-folder";
|
||||
case 10:
|
||||
return "application/x-metaverse-lsl";
|
||||
case 11:
|
||||
return "application/x-metaverse-lso";
|
||||
case 12:
|
||||
return "image/tga";
|
||||
case 13:
|
||||
return "application/x-metaverse-bodypart";
|
||||
case 17:
|
||||
return "audio/x-wav";
|
||||
case 19:
|
||||
return "image/jpeg";
|
||||
case 20:
|
||||
return "application/x-metaverse-animation";
|
||||
case 21:
|
||||
return "application/x-metaverse-gesture";
|
||||
case 22:
|
||||
return "application/x-metaverse-simstate";
|
||||
default:
|
||||
return "application/octet-stream";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -158,7 +158,7 @@ namespace OpenSim.Framework.Servers
|
|||
m_consoleAppender.Threshold = Level.All;
|
||||
|
||||
Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold));
|
||||
}
|
||||
}
|
||||
|
||||
m_console.Commands.AddCommand("base", false, "quit",
|
||||
"quit",
|
||||
|
@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
/// <summary>
|
||||
/// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public virtual void ShutdownSpecific() {}
|
||||
|
||||
/// <summary>
|
||||
|
@ -286,7 +286,7 @@ namespace OpenSim.Framework.Servers
|
|||
/// </summary>
|
||||
public virtual void Startup()
|
||||
{
|
||||
m_log.Info("[STARTUP]: Beginning startup processing");
|
||||
m_log.Info("[STARTUP]: Beginning startup processing");
|
||||
|
||||
EnhanceVersionInformation();
|
||||
|
||||
|
@ -301,7 +301,7 @@ namespace OpenSim.Framework.Servers
|
|||
|
||||
/// <summary>
|
||||
/// Should be overriden and referenced by descendents if they need to perform extra shutdown processing
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public virtual void Shutdown()
|
||||
{
|
||||
ShutdownSpecific();
|
||||
|
@ -367,7 +367,7 @@ namespace OpenSim.Framework.Servers
|
|||
}
|
||||
|
||||
public virtual void HandleShow(string module, string[] cmd)
|
||||
{
|
||||
{
|
||||
List<string> args = new List<string>(cmd);
|
||||
|
||||
args.RemoveAt(0);
|
||||
|
@ -375,7 +375,7 @@ namespace OpenSim.Framework.Servers
|
|||
string[] showParams = args.ToArray();
|
||||
|
||||
switch (showParams[0])
|
||||
{
|
||||
{
|
||||
case "info":
|
||||
Notice("Version: " + m_version);
|
||||
Notice("Startup directory: " + m_startupDirectory);
|
||||
|
|
|
@ -168,7 +168,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
"[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e);
|
||||
}
|
||||
|
||||
}, null);
|
||||
}, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
public BaseHttpServer(uint port, bool ssl) : this (port)
|
||||
{
|
||||
m_ssl = ssl;
|
||||
m_ssl = ssl;
|
||||
}
|
||||
|
||||
public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl)
|
||||
|
@ -156,7 +156,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
lock (m_rpcHandlers)
|
||||
{
|
||||
m_rpcHandlers[method] = handler;
|
||||
m_rpcHandlersKeepAlive[method] = keepAlive; // default
|
||||
m_rpcHandlersKeepAlive[method] = keepAlive; // default
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -256,13 +256,51 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
IHttpClientContext context = (IHttpClientContext)source;
|
||||
IHttpRequest request = args.Request;
|
||||
|
||||
|
||||
PollServiceEventArgs psEvArgs;
|
||||
|
||||
if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs))
|
||||
{
|
||||
|
||||
m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request));
|
||||
//DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request)));
|
||||
PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request);
|
||||
|
||||
if (psEvArgs.Request != null)
|
||||
{
|
||||
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||
|
||||
Stream requestStream = req.InputStream;
|
||||
|
||||
Encoding encoding = Encoding.UTF8;
|
||||
StreamReader reader = new StreamReader(requestStream, encoding);
|
||||
|
||||
string requestBody = reader.ReadToEnd();
|
||||
|
||||
Hashtable keysvals = new Hashtable();
|
||||
Hashtable headervals = new Hashtable();
|
||||
|
||||
string[] querystringkeys = req.QueryString.AllKeys;
|
||||
string[] rHeaders = req.Headers.AllKeys;
|
||||
|
||||
keysvals.Add("body", requestBody);
|
||||
keysvals.Add("uri", req.RawUrl);
|
||||
keysvals.Add("content-type", req.ContentType);
|
||||
keysvals.Add("http-method", req.HttpMethod);
|
||||
|
||||
foreach (string queryname in querystringkeys)
|
||||
{
|
||||
keysvals.Add(queryname, req.QueryString[queryname]);
|
||||
}
|
||||
|
||||
foreach (string headername in rHeaders)
|
||||
{
|
||||
headervals[headername] = req.Headers[headername];
|
||||
}
|
||||
|
||||
keysvals.Add("headers",headervals);
|
||||
keysvals.Add("querystringkeys", querystringkeys);
|
||||
|
||||
psEvArgs.Request(psreq.RequestID, keysvals);
|
||||
}
|
||||
|
||||
m_PollServiceManager.Enqueue(psreq);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -275,49 +313,17 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||
//resp.KeepAlive = req.KeepAlive;
|
||||
//m_log.Info("[Debug BASE HTTP SERVER]: Got Request");
|
||||
//HttpServerContextObj objstate= new HttpServerContextObj(req,resp);
|
||||
//ThreadPool.QueueUserWorkItem(new WaitCallback(ConvertIHttpClientContextToOSHttp), (object)objstate);
|
||||
HandleRequest(req, resp);
|
||||
}
|
||||
|
||||
public void ConvertIHttpClientContextToOSHttp(object stateinfo)
|
||||
{
|
||||
HttpServerContextObj objstate = (HttpServerContextObj)stateinfo;
|
||||
//OSHttpRequest request = new OSHttpRequest(objstate.context,objstate.req);
|
||||
//OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req));
|
||||
|
||||
OSHttpRequest request = objstate.oreq;
|
||||
OSHttpResponse resp = objstate.oresp;
|
||||
//OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req));
|
||||
|
||||
/*
|
||||
request.AcceptTypes = objstate.req.AcceptTypes;
|
||||
request.ContentLength = (long)objstate.req.ContentLength;
|
||||
request.Headers = objstate.req.Headers;
|
||||
request.HttpMethod = objstate.req.Method;
|
||||
request.InputStream = objstate.req.Body;
|
||||
foreach (string str in request.Headers)
|
||||
{
|
||||
if (str.ToLower().Contains("content-type: "))
|
||||
{
|
||||
request.ContentType = str.Substring(13, str.Length - 13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//request.KeepAlive = objstate.req.
|
||||
foreach (HttpServer.HttpInput httpinput in objstate.req.QueryString)
|
||||
{
|
||||
request.QueryString.Add(httpinput.Name, httpinput[httpinput.Name]);
|
||||
}
|
||||
|
||||
//request.Query = objstate.req.//objstate.req.QueryString;
|
||||
//foreach (
|
||||
//request.QueryString = objstate.req.QueryString;
|
||||
|
||||
*/
|
||||
HandleRequest(request,resp);
|
||||
HandleRequest(request,resp);
|
||||
}
|
||||
|
||||
public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response)
|
||||
|
@ -332,6 +338,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
// probability event; if a request is matched it is normally expected to be
|
||||
// handled
|
||||
//m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl);
|
||||
|
||||
IHttpAgentHandler agentHandler;
|
||||
|
||||
if (TryGetAgentHandler(request, response, out agentHandler))
|
||||
|
@ -342,10 +349,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
}
|
||||
|
||||
IRequestHandler requestHandler;
|
||||
//response.KeepAlive = true;
|
||||
response.SendChunked = false;
|
||||
|
||||
IRequestHandler requestHandler;
|
||||
|
||||
string path = request.RawUrl;
|
||||
string handlerKey = GetHandlerKey(request.HttpMethod, path);
|
||||
|
||||
|
@ -359,6 +367,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type.
|
||||
|
||||
|
||||
if (requestHandler is IStreamedRequestHandler)
|
||||
{
|
||||
IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
|
||||
|
@ -404,6 +413,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
// }
|
||||
|
||||
keysvals.Add("requestbody", requestBody);
|
||||
keysvals.Add("headers",headervals);
|
||||
if (keysvals.Contains("method"))
|
||||
{
|
||||
//m_log.Warn("[HTTP]: Contains Method");
|
||||
|
@ -702,7 +712,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
lock (m_rpcHandlers)
|
||||
{
|
||||
methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method);
|
||||
}
|
||||
}
|
||||
|
||||
if (methodWasFound)
|
||||
{
|
||||
|
@ -726,8 +736,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
else
|
||||
{
|
||||
xmlRpcResponse = new XmlRpcResponse();
|
||||
|
||||
// Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php
|
||||
xmlRpcResponse.SetFault(-32601, String.Format("Requested method [{0}] not found", methodName));
|
||||
xmlRpcResponse.SetFault(
|
||||
XmlRpcErrorCodes.SERVER_ERROR_METHOD,
|
||||
String.Format("Requested method [{0}] not found", methodName));
|
||||
}
|
||||
|
||||
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
|
||||
|
@ -747,6 +760,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
response.SendChunked = false;
|
||||
response.ContentLength64 = buf.Length;
|
||||
response.ContentEncoding = Encoding.UTF8;
|
||||
|
||||
try
|
||||
{
|
||||
response.OutputStream.Write(buf, 0, buf.Length);
|
||||
|
@ -917,7 +931,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e);
|
||||
m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e);
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
|
@ -1354,7 +1368,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
bestMatch = pattern;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (String.IsNullOrEmpty(bestMatch))
|
||||
{
|
||||
|
@ -1466,7 +1480,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SendHTML404(OSHttpResponse response, string host)
|
||||
|
@ -1575,7 +1589,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
// if you want more detailed trace information from the HttpServer
|
||||
//m_httpListener2.UseTraceLogs = true;
|
||||
|
||||
//m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
|
||||
//m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1610,7 +1624,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err)
|
||||
{
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case SocketError.NotSocket:
|
||||
|
@ -1621,7 +1635,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
|
||||
public void httpServerException(object source, Exception exception)
|
||||
{
|
||||
{
|
||||
m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString());
|
||||
/*
|
||||
if (HTTPDRunning)// && NotSocketErrors > 5)
|
||||
|
@ -1648,7 +1662,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer.");
|
||||
m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -128,6 +128,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
|
||||
string GetHTTP404(string host);
|
||||
|
||||
string GetHTTP500();
|
||||
string GetHTTP500();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,20 +30,23 @@ using System.Collections;
|
|||
using OpenMetaverse;
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public delegate bool HasEventsMethod(UUID pId);
|
||||
public delegate void RequestMethod(UUID requestID, Hashtable request);
|
||||
public delegate bool HasEventsMethod(UUID requestID, UUID pId);
|
||||
|
||||
public delegate Hashtable GetEventsMethod(UUID pId, string request);
|
||||
public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request);
|
||||
|
||||
public delegate Hashtable NoEventsMethod();
|
||||
public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId);
|
||||
|
||||
public class PollServiceEventArgs : EventArgs
|
||||
{
|
||||
public HasEventsMethod HasEvents;
|
||||
public GetEventsMethod GetEvents;
|
||||
public NoEventsMethod NoEvents;
|
||||
public RequestMethod Request;
|
||||
public UUID Id;
|
||||
public PollServiceEventArgs(HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId)
|
||||
public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId)
|
||||
{
|
||||
Request = pRequest;
|
||||
HasEvents = pHasEvents;
|
||||
GetEvents = pGetEvents;
|
||||
NoEvents = pNoEvents;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
|
||||
using System;
|
||||
using HttpServer;
|
||||
using OpenMetaverse;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
|
@ -37,12 +38,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
public readonly IHttpClientContext HttpContext;
|
||||
public readonly IHttpRequest Request;
|
||||
public readonly int RequestTime;
|
||||
public readonly UUID RequestID;
|
||||
public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
|
||||
{
|
||||
PollServiceArgs = pPollServiceArgs;
|
||||
HttpContext = pHttpContext;
|
||||
Request = pRequest;
|
||||
RequestTime = System.Environment.TickCount;
|
||||
RequestID = UUID.Random();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
foreach (object o in m_requests)
|
||||
{
|
||||
PollServiceHttpRequest req = (PollServiceHttpRequest) o;
|
||||
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
|
||||
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext));
|
||||
}
|
||||
|
||||
m_requests.Clear();
|
||||
|
|
|
@ -100,11 +100,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
PollServiceHttpRequest req = m_request.Dequeue();
|
||||
try
|
||||
{
|
||||
if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id))
|
||||
if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id))
|
||||
{
|
||||
StreamReader str = new StreamReader(req.Request.Body);
|
||||
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd());
|
||||
m_server.DoHTTPGruntWork(responsedata,
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
{
|
||||
if ((Environment.TickCount - req.RequestTime) > m_timeout)
|
||||
{
|
||||
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(),
|
||||
m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id),
|
||||
new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext));
|
||||
}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace OpenSim.Framework.Servers.HttpServer
|
||||
{
|
||||
public class SynchronousRestFormsRequester
|
||||
{
|
||||
/// <summary>
|
||||
/// Perform a synchronous REST request.
|
||||
/// </summary>
|
||||
/// <param name="verb"></param>
|
||||
/// <param name="requestUrl"></param>
|
||||
/// <param name="obj"> </param>
|
||||
/// <returns></returns>
|
||||
///
|
||||
/// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting
|
||||
/// the request. You'll want to make sure you deal with this as they're not uncommon</exception>
|
||||
public static string MakeRequest(string verb, string requestUrl, string obj)
|
||||
{
|
||||
WebRequest request = WebRequest.Create(requestUrl);
|
||||
request.Method = verb;
|
||||
|
||||
if ((verb == "POST") || (verb == "PUT"))
|
||||
{
|
||||
request.ContentType = "text/www-form-urlencoded";
|
||||
|
||||
MemoryStream buffer = new MemoryStream();
|
||||
int length = 0;
|
||||
using (StreamWriter writer = new StreamWriter(buffer))
|
||||
{
|
||||
writer.Write(obj);
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
length = (int)obj.Length;
|
||||
request.ContentLength = length;
|
||||
|
||||
Stream requestStream = request.GetRequestStream();
|
||||
requestStream.Write(buffer.ToArray(), 0, length);
|
||||
}
|
||||
|
||||
string respstring = String.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
using (WebResponse resp = request.GetResponse())
|
||||
{
|
||||
if (resp.ContentLength > 0)
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(resp.GetResponseStream()))
|
||||
{
|
||||
respstring = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// This is what happens when there is invalid XML
|
||||
}
|
||||
return respstring;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Xml.Serialization;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Framework.Servers
|
||||
{
|
||||
public class PostAssetStreamHandler : BaseStreamHandler
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
// private OpenAsset_Main m_assetManager;
|
||||
private IAssetDataPlugin m_assetProvider;
|
||||
|
||||
public override byte[] Handle(string path, Stream request,
|
||||
OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
string param = GetParam(path);
|
||||
|
||||
UUID assetId;
|
||||
if (param.Length > 0)
|
||||
UUID.TryParse(param, out assetId);
|
||||
// byte[] txBuffer = new byte[4096];
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||
AssetBase asset = (AssetBase) xs.Deserialize(request);
|
||||
|
||||
m_log.InfoFormat("[REST]: Creating asset {0}", asset.FullID);
|
||||
m_assetProvider.StoreAsset(asset);
|
||||
|
||||
return new byte[] {};
|
||||
}
|
||||
|
||||
public PostAssetStreamHandler(IAssetDataPlugin assetProvider)
|
||||
: base("POST", "/assets")
|
||||
{
|
||||
// m_assetManager = assetManager;
|
||||
m_assetProvider = assetProvider;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using HttpServer;
|
||||
using NUnit.Framework;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Tests.Common;
|
||||
using OpenSim.Tests.Common.Mock;
|
||||
using OpenSim.Tests.Common.Setup;
|
||||
|
||||
namespace OpenSim.Framework.Servers.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class GetAssetStreamHandlerTests
|
||||
{
|
||||
private const string ASSETS_PATH = "/assets";
|
||||
|
||||
[Test]
|
||||
public void TestConstructor()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
// GetAssetStreamHandler handler =
|
||||
new GetAssetStreamHandler(null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetParams()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||
BaseRequestHandlerTestHelper.BaseTestGetParams(handler, ASSETS_PATH);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSplitParams()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||
BaseRequestHandlerTestHelper.BaseTestSplitParams(handler, ASSETS_PATH);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHandleNoParams()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||
|
||||
BaseRequestHandlerTestHelper.BaseTestHandleNoParams(handler, ASSETS_PATH);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHandleMalformedGuid()
|
||||
{
|
||||
TestHelper.InMethod();
|
||||
|
||||
GetAssetStreamHandler handler = new GetAssetStreamHandler(null);
|
||||
|
||||
BaseRequestHandlerTestHelper.BaseTestHandleMalformedGuid(handler, ASSETS_PATH);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHandleFetchMissingAsset()
|
||||
{
|
||||
GetAssetStreamHandler handler;
|
||||
OSHttpResponse response;
|
||||
CreateTestEnvironment(out handler, out response);
|
||||
|
||||
GetAssetStreamHandlerTestHelpers.BaseFetchMissingAsset(handler, response);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHandleFetchExistingAssetData()
|
||||
{
|
||||
GetAssetStreamHandler handler;
|
||||
OSHttpResponse response;
|
||||
AssetBase asset = CreateTestEnvironment(out handler, out response);
|
||||
|
||||
GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetDataTest(asset, handler, response);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHandleFetchExistingAssetXml()
|
||||
{
|
||||
GetAssetStreamHandler handler;
|
||||
OSHttpResponse response;
|
||||
AssetBase asset = CreateTestEnvironment(out handler, out response);
|
||||
|
||||
GetAssetStreamHandlerTestHelpers.BaseFetchExistingAssetXmlTest(asset, handler, response);
|
||||
}
|
||||
|
||||
private static AssetBase CreateTestEnvironment(out GetAssetStreamHandler handler, out OSHttpResponse response)
|
||||
{
|
||||
AssetBase asset = GetAssetStreamHandlerTestHelpers.CreateCommonTestResources(out response);
|
||||
|
||||
IAssetDataPlugin assetDataPlugin = new TestAssetDataPlugin();
|
||||
handler = new GetAssetStreamHandler(assetDataPlugin);
|
||||
|
||||
assetDataPlugin.StoreAsset(asset);
|
||||
return asset;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ namespace OpenSim
|
|||
{
|
||||
public class VersionInfo
|
||||
{
|
||||
private const string VERSION_NUMBER = "0.6.6";
|
||||
private const string VERSION_NUMBER = "0.6.8";
|
||||
private const Flavour VERSION_FLAVOUR = Flavour.Dev;
|
||||
|
||||
public enum Flavour
|
||||
|
@ -67,8 +67,8 @@ namespace OpenSim
|
|||
///
|
||||
/// Having this version number allows the grid service to reject connections from regions running a version
|
||||
/// of the code that is too old.
|
||||
///
|
||||
///
|
||||
/// </value>
|
||||
public readonly static int MajorInterfaceVersion = 5;
|
||||
public readonly static int MajorInterfaceVersion = 6;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace OpenSim.Framework
|
|||
///
|
||||
/// TODO: This looks very much like the OpenMetaverse SimStatsPacket. It should be much more generic stats
|
||||
/// storage.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public class SimStats
|
||||
{
|
||||
{
|
||||
public uint RegionX
|
||||
{
|
||||
get { return m_regionX; }
|
||||
|
@ -47,25 +47,25 @@ namespace OpenSim.Framework
|
|||
public uint RegionY
|
||||
{
|
||||
get { return m_regionY; }
|
||||
}
|
||||
}
|
||||
private uint m_regionY;
|
||||
|
||||
public SimStatsPacket.RegionBlock RegionBlock
|
||||
{
|
||||
get { return m_regionBlock; }
|
||||
}
|
||||
}
|
||||
private SimStatsPacket.RegionBlock m_regionBlock;
|
||||
|
||||
public SimStatsPacket.StatBlock[] StatsBlock
|
||||
{
|
||||
get { return m_statsBlock; }
|
||||
}
|
||||
}
|
||||
private SimStatsPacket.StatBlock[] m_statsBlock;
|
||||
|
||||
public uint RegionFlags
|
||||
{
|
||||
get { return m_regionFlags; }
|
||||
}
|
||||
}
|
||||
private uint m_regionFlags;
|
||||
|
||||
public uint ObjectCapacity
|
||||
|
@ -76,7 +76,7 @@ namespace OpenSim.Framework
|
|||
|
||||
public UUID RegionUUID
|
||||
{
|
||||
get { return regionUUID;}
|
||||
get { return regionUUID; }
|
||||
}
|
||||
private UUID regionUUID;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace OpenSim.Framework
|
|||
/// A dictionary for task inventory.
|
||||
/// </summary>
|
||||
/// This class is not thread safe. Callers must synchronize on Dictionary methods or Clone() this object before
|
||||
/// iterating over it.
|
||||
/// iterating over it.
|
||||
public class TaskInventoryDictionary : Dictionary<UUID, TaskInventoryItem>,
|
||||
ICloneable, IXmlSerializable
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenSim.Framework
|
|||
}
|
||||
|
||||
private static void ThreadTrackerThreadLoop()
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
while (true)
|
||||
|
@ -70,8 +70,8 @@ namespace OpenSim.Framework
|
|||
{
|
||||
m_log.ErrorFormat(
|
||||
"[THREAD TRACKER]: Thread tracker cleanup thread terminating with exception. Please report this error. Exception is {0}",
|
||||
e);
|
||||
}
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void Add(Thread thread)
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace OpenSim.Framework
|
|||
m_configMember.addConfigurationOption("library_location",
|
||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||
"Path to library control file",
|
||||
string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar), false);
|
||||
string.Format(".{0}inventory{0}Libraries.xml", Path.DirectorySeparatorChar), false);
|
||||
|
||||
m_configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||
"DLL for database provider", "OpenSim.Data.MySQL.dll", false);
|
||||
|
|
|
@ -217,7 +217,7 @@ namespace OpenSim.Framework
|
|||
public string Name
|
||||
{
|
||||
get { return String.Format("{0} {1}", m_firstname, m_surname); }
|
||||
}
|
||||
}
|
||||
|
||||
public string Email
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace OpenSim.Framework
|
|||
/// </summary>
|
||||
public class Util
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private static uint nextXferID = 5000;
|
||||
private static Random randomClass = new Random();
|
||||
|
@ -70,6 +70,39 @@ namespace OpenSim.Framework
|
|||
public static readonly Regex UUIDPattern
|
||||
= new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$");
|
||||
|
||||
/// <summary>
|
||||
/// Linear interpolates B<->C using percent A
|
||||
/// </summary>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static double lerp(double a, double b, double c)
|
||||
{
|
||||
return (b*a) + (c*(1 - a));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bilinear Interpolate, see Lerp but for 2D using 'percents' X & Y.
|
||||
/// Layout:
|
||||
/// A B
|
||||
/// C D
|
||||
/// A<->C = Y
|
||||
/// C<->D = X
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="a"></param>
|
||||
/// <param name="b"></param>
|
||||
/// <param name="c"></param>
|
||||
/// <param name="d"></param>
|
||||
/// <returns></returns>
|
||||
public static double lerp2D(double x, double y, double a, double b, double c, double d)
|
||||
{
|
||||
return lerp(y, lerp(x, a, b), lerp(x, c, d));
|
||||
}
|
||||
|
||||
|
||||
/// <value>
|
||||
/// Well known UUID for the blank texture used in the Linden SL viewer version 1.20 (and hopefully onwards)
|
||||
/// </value>
|
||||
|
@ -103,7 +136,7 @@ namespace OpenSim.Framework
|
|||
float dx = a.X - b.X;
|
||||
float dy = a.Y - b.Y;
|
||||
float dz = a.Z - b.Z;
|
||||
return (dx*dx + dy*dy + dz*dz) < (amount*amount);
|
||||
return (dx*dx + dy*dy + dz*dz) < (amount*amount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -942,7 +975,7 @@ namespace OpenSim.Framework
|
|||
else
|
||||
{
|
||||
os = ReadEtcIssue();
|
||||
}
|
||||
}
|
||||
|
||||
if (os.Length > 45)
|
||||
{
|
||||
|
@ -1170,6 +1203,32 @@ namespace OpenSim.Framework
|
|||
return found.ToArray();
|
||||
}
|
||||
|
||||
public static string ServerURI(string uri)
|
||||
{
|
||||
if (uri == string.Empty)
|
||||
return string.Empty;
|
||||
|
||||
// Get rid of eventual slashes at the end
|
||||
uri = uri.TrimEnd('/');
|
||||
|
||||
IPAddress ipaddr1 = null;
|
||||
string port1 = "";
|
||||
try
|
||||
{
|
||||
ipaddr1 = Util.GetHostFromURL(uri);
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
port1 = uri.Split(new char[] { ':' })[2];
|
||||
}
|
||||
catch { }
|
||||
|
||||
// We tried our best to convert the domain names to IP addresses
|
||||
return (ipaddr1 != null) ? "http://" + ipaddr1.ToString() + ":" + port1 : uri;
|
||||
}
|
||||
|
||||
#region FireAndForget Threading Pattern
|
||||
|
||||
public static void FireAndForget(System.Threading.WaitCallback callback)
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.AssetLoader.Filesystem;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Framework.Statistics;
|
||||
|
||||
namespace OpenSim.Grid.AssetServer
|
||||
{
|
||||
/// <summary>
|
||||
/// An asset server
|
||||
/// </summary>
|
||||
public class OpenAsset_Main : BaseOpenSimServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public static OpenAsset_Main assetserver;
|
||||
|
||||
// Temporarily hardcoded - should be a plugin
|
||||
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
|
||||
|
||||
private IAssetDataPlugin m_assetProvider;
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
|
||||
assetserver = new OpenAsset_Main();
|
||||
assetserver.Startup();
|
||||
|
||||
assetserver.Work();
|
||||
}
|
||||
|
||||
private void Work()
|
||||
{
|
||||
m_console.Output("Enter help for a list of commands");
|
||||
|
||||
while (true)
|
||||
{
|
||||
m_console.Prompt();
|
||||
}
|
||||
}
|
||||
|
||||
public OpenAsset_Main()
|
||||
{
|
||||
m_console = new LocalConsole("Asset");
|
||||
|
||||
MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
|
||||
|
||||
m_log.Info("[ASSET]: Setting up asset DB");
|
||||
setupDB(config);
|
||||
|
||||
m_log.Info("[ASSET]: Loading default asset set from '" + config.AssetSetsLocation + "'");
|
||||
LoadDefaultAssets(config.AssetSetsLocation);
|
||||
|
||||
m_log.Info("[ASSET]: Starting HTTP process");
|
||||
m_httpServer = new BaseHttpServer(config.HttpPort);
|
||||
|
||||
m_stats = StatsManager.StartCollectingAssetStats();
|
||||
|
||||
AddHttpHandlers();
|
||||
|
||||
m_httpServer.Start();
|
||||
|
||||
base.StartupSpecific();
|
||||
}
|
||||
|
||||
protected void AddHttpHandlers()
|
||||
{
|
||||
m_httpServer.AddStreamHandler(new GetAssetStreamHandler(m_assetProvider));
|
||||
m_httpServer.AddStreamHandler(new PostAssetStreamHandler(m_assetProvider));
|
||||
}
|
||||
|
||||
public byte[] GetAssetData(UUID assetID, bool isTexture)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setupDB(AssetConfig config)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_assetProvider = DataPluginFactory.LoadDataPlugin<IAssetDataPlugin>(config.DatabaseProvider, config.DatabaseConnect);
|
||||
if (m_assetProvider == null)
|
||||
{
|
||||
m_log.Error("[ASSET]: Failed to load a database plugin, server halting");
|
||||
Environment.Exit(-1);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Warn("[ASSET]: setupDB() - Exception occured");
|
||||
m_log.Warn("[ASSET]: " + e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultAssets(string pAssetSetsLocation)
|
||||
{
|
||||
assetLoader.ForEachDefaultXmlAsset(pAssetSetsLocation, StoreAsset);
|
||||
}
|
||||
|
||||
protected void StoreAsset(AssetBase asset)
|
||||
{
|
||||
m_assetProvider.StoreAsset(asset);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
public class AuthedSessionCache
|
||||
{
|
||||
public class CacheData
|
||||
{
|
||||
private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1);
|
||||
private string m_session_id;
|
||||
private string m_agent_id;
|
||||
private int m_expire;
|
||||
|
||||
private int get_current_unix_time()
|
||||
{
|
||||
return (int)(DateTime.UtcNow - UNIX_EPOCH).TotalSeconds;
|
||||
}
|
||||
|
||||
public CacheData(string sid, string aid)
|
||||
{
|
||||
m_session_id = sid;
|
||||
m_agent_id = aid;
|
||||
m_expire = get_current_unix_time() + DEFAULT_LIFETIME;
|
||||
}
|
||||
|
||||
public CacheData(string sid, string aid, int time_now)
|
||||
{
|
||||
m_session_id = sid;
|
||||
m_agent_id = aid;
|
||||
m_expire = time_now + DEFAULT_LIFETIME;
|
||||
}
|
||||
|
||||
public string SessionID
|
||||
{
|
||||
get { return m_session_id; }
|
||||
set { m_session_id = value; }
|
||||
}
|
||||
|
||||
public string AgentID
|
||||
{
|
||||
get { return m_agent_id; }
|
||||
set { m_agent_id = value; }
|
||||
}
|
||||
|
||||
public bool isExpired
|
||||
{
|
||||
get { return m_expire < get_current_unix_time(); }
|
||||
}
|
||||
|
||||
public void Renew()
|
||||
{
|
||||
m_expire = get_current_unix_time() + DEFAULT_LIFETIME;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly int DEFAULT_LIFETIME = 30;
|
||||
private Dictionary<string, CacheData> m_authed_sessions = new Dictionary<string,CacheData>();
|
||||
// private int m_session_lifetime = DEFAULT_LIFETIME;
|
||||
|
||||
public AuthedSessionCache()
|
||||
{
|
||||
// m_session_lifetime = DEFAULT_LIFETIME;
|
||||
}
|
||||
|
||||
public AuthedSessionCache(int timeout)
|
||||
{
|
||||
// m_session_lifetime = timeout;
|
||||
}
|
||||
|
||||
public CacheData getCachedSession(string session_id, string agent_id)
|
||||
{
|
||||
CacheData ret = null;
|
||||
lock (m_authed_sessions)
|
||||
{
|
||||
if (m_authed_sessions.ContainsKey(session_id))
|
||||
{
|
||||
CacheData cached_session = m_authed_sessions[session_id];
|
||||
if (!cached_session.isExpired && cached_session.AgentID == agent_id)
|
||||
{
|
||||
ret = m_authed_sessions[session_id];
|
||||
// auto renew
|
||||
m_authed_sessions[session_id].Renew();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void Add(string session_id, string agent_id)
|
||||
{
|
||||
CacheData data = new CacheData(session_id, agent_id);
|
||||
lock (m_authed_sessions)
|
||||
{
|
||||
if (m_authed_sessions.ContainsKey(session_id))
|
||||
{
|
||||
m_authed_sessions[session_id] = data;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_authed_sessions.Add(session_id, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,256 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Used on a grid server to satisfy external inventory requests
|
||||
/// </summary>
|
||||
public class GridInventoryService : InventoryServiceBase
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private bool m_doLookup = false;
|
||||
|
||||
public bool DoLookup
|
||||
{
|
||||
get { return m_doLookup; }
|
||||
set { m_doLookup = value; }
|
||||
}
|
||||
|
||||
private static readonly int INVENTORY_DEFAULT_SESSION_TIME = 30; // secs
|
||||
|
||||
private string m_userserver_url;
|
||||
private AuthedSessionCache m_session_cache = new AuthedSessionCache(INVENTORY_DEFAULT_SESSION_TIME);
|
||||
|
||||
public GridInventoryService(string userserver_url)
|
||||
{
|
||||
m_userserver_url = userserver_url;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check that the source of an inventory request is one that we trust.
|
||||
/// </summary>
|
||||
/// <param name="peer"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckTrustSource(IPEndPoint peer)
|
||||
{
|
||||
if (m_doLookup)
|
||||
{
|
||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer);
|
||||
UriBuilder ub = new UriBuilder(m_userserver_url);
|
||||
IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host);
|
||||
foreach (IPAddress uaddr in uaddrs)
|
||||
{
|
||||
if (uaddr.Equals(peer.Address))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
m_log.WarnFormat(
|
||||
"[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources",
|
||||
peer);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check that the source of an inventory request for a particular agent is a current session belonging to
|
||||
/// that agent.
|
||||
/// </summary>
|
||||
/// <param name="session_id"></param>
|
||||
/// <param name="avatar_id"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckAuthSession(string session_id, string avatar_id)
|
||||
{
|
||||
if (m_doLookup)
|
||||
{
|
||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id);
|
||||
|
||||
if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
|
||||
{
|
||||
// cache miss, ask userserver
|
||||
Hashtable requestData = new Hashtable();
|
||||
requestData["avatar_uuid"] = avatar_id;
|
||||
requestData["session_id"] = session_id;
|
||||
ArrayList SendParams = new ArrayList();
|
||||
SendParams.Add(requestData);
|
||||
XmlRpcRequest UserReq = new XmlRpcRequest("check_auth_session", SendParams);
|
||||
XmlRpcResponse UserResp = UserReq.Send(m_userserver_url, 3000);
|
||||
|
||||
Hashtable responseData = (Hashtable)UserResp.Value;
|
||||
if (responseData.ContainsKey("auth_session") && responseData["auth_session"].ToString() == "TRUE")
|
||||
{
|
||||
m_log.Info("[GRID AGENT INVENTORY]: got authed session from userserver");
|
||||
// add to cache; the session time will be automatically renewed
|
||||
m_session_cache.Add(session_id, avatar_id);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// cache hits
|
||||
m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
|
||||
return true;
|
||||
}
|
||||
|
||||
m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return a user's entire inventory
|
||||
/// </summary>
|
||||
/// <param name="rawUserID"></param>
|
||||
/// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns>
|
||||
public InventoryCollection GetUserInventory(Guid rawUserID)
|
||||
{
|
||||
UUID userID = new UUID(rawUserID);
|
||||
|
||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: Processing request for inventory of {0}", userID);
|
||||
|
||||
// Uncomment me to simulate a slow responding inventory server
|
||||
//Thread.Sleep(16000);
|
||||
|
||||
InventoryCollection invCollection = new InventoryCollection();
|
||||
|
||||
List<InventoryFolderBase> allFolders = GetInventorySkeleton(userID);
|
||||
|
||||
if (null == allFolders)
|
||||
{
|
||||
m_log.WarnFormat("[GRID AGENT INVENTORY]: No inventory found for user {0}", rawUserID);
|
||||
|
||||
return invCollection;
|
||||
}
|
||||
|
||||
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
||||
|
||||
foreach (InventoryFolderBase folder in allFolders)
|
||||
{
|
||||
List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
allItems.InsertRange(0, items);
|
||||
}
|
||||
}
|
||||
|
||||
invCollection.UserID = userID;
|
||||
invCollection.Folders = allFolders;
|
||||
invCollection.Items = allItems;
|
||||
|
||||
// foreach (InventoryFolderBase folder in invCollection.Folders)
|
||||
// {
|
||||
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID);
|
||||
// }
|
||||
//
|
||||
// foreach (InventoryItemBase item in invCollection.Items)
|
||||
// {
|
||||
// m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder);
|
||||
// }
|
||||
|
||||
m_log.InfoFormat(
|
||||
"[GRID AGENT INVENTORY]: Sending back inventory response to user {0} containing {1} folders and {2} items",
|
||||
invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count);
|
||||
|
||||
return invCollection;
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetFolderItems(Guid folderID)
|
||||
{
|
||||
List<InventoryItemBase> allItems = new List<InventoryItemBase>();
|
||||
|
||||
|
||||
List<InventoryItemBase> items = RequestFolderItems(new UUID(folderID));
|
||||
|
||||
if (items != null)
|
||||
{
|
||||
allItems.InsertRange(0, items);
|
||||
}
|
||||
m_log.InfoFormat(
|
||||
"[GRID AGENT INVENTORY]: Sending back inventory response containing {0} items", allItems.Count.ToString());
|
||||
return allItems;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Guid to UUID wrapper for same name IInventoryServices method
|
||||
/// </summary>
|
||||
/// <param name="rawUserID"></param>
|
||||
/// <returns></returns>
|
||||
public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID)
|
||||
{
|
||||
UUID userID = new UUID(rawUserID);
|
||||
return GetInventorySkeleton(userID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an inventory for the given user.
|
||||
/// </summary>
|
||||
/// <param name="rawUserID"></param>
|
||||
/// <returns></returns>
|
||||
public bool CreateUsersInventory(Guid rawUserID)
|
||||
{
|
||||
UUID userID = new UUID(rawUserID);
|
||||
|
||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: Creating new set of inventory folders for user {0}", userID);
|
||||
|
||||
return CreateNewUserInventory(userID);
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetActiveGestures(Guid rawUserID)
|
||||
{
|
||||
UUID userID = new UUID(rawUserID);
|
||||
|
||||
m_log.InfoFormat("[GRID AGENT INVENTORY]: fetching active gestures for user {0}", userID);
|
||||
|
||||
return GetActiveGestures(userID);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,519 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Abstract base class used by local and grid implementations of an inventory service.
|
||||
/// </summary>
|
||||
public abstract class InventoryServiceBase : IInterServiceInventoryServices
|
||||
{
|
||||
|
||||
private static readonly ILog m_log
|
||||
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
protected List<IInventoryDataPlugin> m_plugins = new List<IInventoryDataPlugin>();
|
||||
|
||||
#region Plugin methods
|
||||
|
||||
/// <summary>
|
||||
/// Add a new inventory data plugin - plugins will be requested in the order they were added.
|
||||
/// </summary>
|
||||
/// <param name="plugin">The plugin that will provide data</param>
|
||||
public void AddPlugin(IInventoryDataPlugin plugin)
|
||||
{
|
||||
m_plugins.Add(plugin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a list of inventory data plugins, as described by `provider'
|
||||
/// and `connect', to `m_plugins'.
|
||||
/// </summary>
|
||||
/// <param name="provider">
|
||||
/// The filename of the inventory server plugin DLL.
|
||||
/// </param>
|
||||
/// <param name="connect">
|
||||
/// The connection string for the storage backend.
|
||||
/// </param>
|
||||
public void AddPlugin(string provider, string connect)
|
||||
{
|
||||
m_plugins.AddRange(DataPluginFactory.LoadDataPlugins<IInventoryDataPlugin>(provider, connect));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IInventoryServices methods
|
||||
|
||||
public string Host
|
||||
{
|
||||
get { return "default"; }
|
||||
}
|
||||
|
||||
public List<InventoryFolderBase> GetInventorySkeleton(UUID userId)
|
||||
{
|
||||
// m_log.DebugFormat("[AGENT INVENTORY]: Getting inventory skeleton for {0}", userId);
|
||||
|
||||
InventoryFolderBase rootFolder = RequestRootFolder(userId);
|
||||
|
||||
// Agent has no inventory structure yet.
|
||||
if (null == rootFolder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<InventoryFolderBase> userFolders = new List<InventoryFolderBase>();
|
||||
|
||||
userFolders.Add(rootFolder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
IList<InventoryFolderBase> folders = plugin.getFolderHierarchy(rootFolder.ID);
|
||||
userFolders.AddRange(folders);
|
||||
}
|
||||
|
||||
// foreach (InventoryFolderBase folder in userFolders)
|
||||
// {
|
||||
// m_log.DebugFormat("[AGENT INVENTORY]: Got folder {0} {1}", folder.name, folder.folderID);
|
||||
// }
|
||||
|
||||
return userFolders;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool HasInventoryForUser(UUID userID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual InventoryFolderBase RequestRootFolder(UUID userID)
|
||||
{
|
||||
// Retrieve the first root folder we get from the list of plugins.
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryFolderBase rootFolder = plugin.getUserRootFolder(userID);
|
||||
if (rootFolder != null)
|
||||
return rootFolder;
|
||||
}
|
||||
|
||||
// Return nothing if no plugin was able to supply a root folder
|
||||
return null;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public bool CreateNewUserInventory(UUID user)
|
||||
{
|
||||
InventoryFolderBase existingRootFolder = RequestRootFolder(user);
|
||||
|
||||
if (null != existingRootFolder)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Did not create a new inventory for user {0} since they already have "
|
||||
+ "a root inventory folder with id {1}",
|
||||
user, existingRootFolder.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
UsersInventory inven = new UsersInventory();
|
||||
inven.CreateNewInventorySet(user);
|
||||
AddNewInventorySet(inven);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
List<InventoryItemBase> activeGestures = new List<InventoryItemBase>();
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
activeGestures.AddRange(plugin.fetchActiveGestures(userId));
|
||||
}
|
||||
|
||||
return activeGestures;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods used by GridInventoryService
|
||||
|
||||
public List<InventoryFolderBase> RequestSubFolders(UUID parentFolderID)
|
||||
{
|
||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
inventoryList.AddRange(plugin.getInventoryFolders(parentFolderID));
|
||||
}
|
||||
|
||||
return inventoryList;
|
||||
}
|
||||
|
||||
public List<InventoryItemBase> RequestFolderItems(UUID folderID)
|
||||
{
|
||||
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
itemsList.AddRange(plugin.getInventoryInFolder(folderID));
|
||||
}
|
||||
|
||||
return itemsList;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool AddFolder(InventoryFolderBase folder)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Adding folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.addInventoryFolder(folder);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool UpdateFolder(InventoryFolderBase folder)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Updating folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.updateInventoryFolder(folder);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool MoveFolder(InventoryFolderBase folder)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Moving folder {0} {1} to folder {2}", folder.Name, folder.ID, folder.ParentID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.moveInventoryFolder(folder);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Adding item {0} {1} to folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.addInventoryItem(item);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool UpdateItem(InventoryItemBase item)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[AGENT INVENTORY]: Updating item {0} {1} in folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.updateInventoryItem(item);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
// See IInventoryServices
|
||||
public virtual bool DeleteItem(InventoryItemBase item)
|
||||
{
|
||||
m_log.InfoFormat(
|
||||
"[AGENT INVENTORY]: Deleting item {0} {1} from folder {2}", item.Name, item.ID, item.Folder);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.deleteInventoryItem(item.ID);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryItemBase result = plugin.queryInventoryItem(item.ID);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryFolderBase result = plugin.queryInventoryFolder(item.ID);
|
||||
if (result != null)
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Purge a folder of all items items and subfolders.
|
||||
///
|
||||
/// FIXME: Really nasty in a sense, because we have to query the database to get information we may
|
||||
/// already know... Needs heavy refactoring.
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
public virtual bool PurgeFolder(InventoryFolderBase folder)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Purging folder {0} {1} of its contents", folder.Name, folder.ID);
|
||||
|
||||
List<InventoryFolderBase> subFolders = RequestSubFolders(folder.ID);
|
||||
|
||||
foreach (InventoryFolderBase subFolder in subFolders)
|
||||
{
|
||||
// m_log.DebugFormat("[AGENT INVENTORY]: Deleting folder {0} {1}", subFolder.Name, subFolder.ID);
|
||||
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
plugin.deleteInventoryFolder(subFolder.ID);
|
||||
}
|
||||
}
|
||||
|
||||
List<InventoryItemBase> items = RequestFolderItems(folder.ID);
|
||||
|
||||
foreach (InventoryItemBase item in items)
|
||||
{
|
||||
DeleteItem(item);
|
||||
}
|
||||
|
||||
// FIXME: Should return false on failure
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddNewInventorySet(UsersInventory inventory)
|
||||
{
|
||||
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
||||
{
|
||||
AddFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
public InventoryItemBase GetInventoryItem(UUID itemID)
|
||||
{
|
||||
foreach (IInventoryDataPlugin plugin in m_plugins)
|
||||
{
|
||||
InventoryItemBase item = plugin.getInventoryItem(itemID);
|
||||
if (item != null)
|
||||
return item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to create a new user inventory.
|
||||
/// </summary>
|
||||
private class UsersInventory
|
||||
{
|
||||
public Dictionary<UUID, InventoryFolderBase> Folders = new Dictionary<UUID, InventoryFolderBase>();
|
||||
public Dictionary<UUID, InventoryItemBase> Items = new Dictionary<UUID, InventoryItemBase>();
|
||||
|
||||
public virtual void CreateNewInventorySet(UUID user)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase();
|
||||
|
||||
folder.ParentID = UUID.Zero;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "My Inventory";
|
||||
folder.Type = (short)AssetType.Folder;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
UUID rootFolder = folder.ID;
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Animations";
|
||||
folder.Type = (short)AssetType.Animation;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Body Parts";
|
||||
folder.Type = (short)AssetType.Bodypart;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Calling Cards";
|
||||
folder.Type = (short)AssetType.CallingCard;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Clothing";
|
||||
folder.Type = (short)AssetType.Clothing;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Gestures";
|
||||
folder.Type = (short)AssetType.Gesture;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Landmarks";
|
||||
folder.Type = (short)AssetType.Landmark;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Lost And Found";
|
||||
folder.Type = (short)AssetType.LostAndFoundFolder;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Notecards";
|
||||
folder.Type = (short)AssetType.Notecard;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Objects";
|
||||
folder.Type = (short)AssetType.Object;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Photo Album";
|
||||
folder.Type = (short)AssetType.SnapshotFolder;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Scripts";
|
||||
folder.Type = (short)AssetType.LSLText;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Sounds";
|
||||
folder.Type = (short)AssetType.Sound;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Textures";
|
||||
folder.Type = (short)AssetType.Texture;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
|
||||
folder = new InventoryFolderBase();
|
||||
folder.ParentID = rootFolder;
|
||||
folder.Owner = user;
|
||||
folder.ID = UUID.Random();
|
||||
folder.Name = "Trash";
|
||||
folder.Type = (short)AssetType.TrashFolder;
|
||||
folder.Version = 1;
|
||||
Folders.Add(folder.ID, folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,182 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) Contributors, http://opensimulator.org/
|
||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the OpenSimulator Project nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Services;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
|
||||
namespace OpenSim.Grid.InventoryServer
|
||||
{
|
||||
public class OpenInventory_Main : BaseOpenSimServer
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
private GridInventoryService m_inventoryService;
|
||||
//private HGInventoryService m_directInventoryService;
|
||||
|
||||
public const string LogName = "INVENTORY";
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
XmlConfigurator.Configure();
|
||||
|
||||
OpenInventory_Main theServer = new OpenInventory_Main();
|
||||
theServer.Startup();
|
||||
|
||||
theServer.Work();
|
||||
}
|
||||
|
||||
public OpenInventory_Main()
|
||||
{
|
||||
m_console = new LocalConsole("Inventory");
|
||||
MainConsole.Instance = m_console;
|
||||
}
|
||||
|
||||
protected override void StartupSpecific()
|
||||
{
|
||||
InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
|
||||
|
||||
m_inventoryService = new GridInventoryService(config.UserServerURL);
|
||||
m_inventoryService.DoLookup = config.SessionLookUp;
|
||||
m_inventoryService.AddPlugin(config.DatabaseProvider, config.DatabaseConnect);
|
||||
|
||||
|
||||
m_log.Info("[" + LogName + "]: Starting HTTP server ...");
|
||||
|
||||
m_httpServer = new BaseHttpServer(config.HttpPort);
|
||||
|
||||
AddHttpHandlers(config.RegionAccessToAgentsInventory);
|
||||
|
||||
m_httpServer.Start();
|
||||
|
||||
m_log.Info("[" + LogName + "]: Started HTTP server");
|
||||
|
||||
base.StartupSpecific();
|
||||
|
||||
m_console.Commands.AddCommand("inventoryserver", false, "add user",
|
||||
"add user",
|
||||
"Add a random user inventory", HandleAddUser);
|
||||
}
|
||||
|
||||
protected void AddHttpHandlers(bool regionAccess)
|
||||
{
|
||||
if (regionAccess)
|
||||
{
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<Guid, InventoryCollection>(
|
||||
"POST", "/GetInventory/", m_inventoryService.GetUserInventory, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/MoveFolder/", m_inventoryService.MoveFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/DeleteItem/", m_inventoryService.DeleteItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||
"POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||
"POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
}
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, bool>(
|
||||
"POST", "/CreateInventory/", m_inventoryService.CreateUsersInventory, m_inventoryService.CheckTrustSource));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/NewFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<InventoryFolderBase, bool>(
|
||||
"POST", "/CreateFolder/", m_inventoryService.AddFolder, m_inventoryService.CheckTrustSource));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, bool>(
|
||||
"POST", "/NewItem/", m_inventoryService.AddItem, m_inventoryService.CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<InventoryItemBase, bool>(
|
||||
"POST", "/AddNewItem/", m_inventoryService.AddItem, m_inventoryService.CheckTrustSource));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>(
|
||||
"POST", "/GetItems/", m_inventoryService.GetFolderItems, m_inventoryService.CheckTrustSource));
|
||||
|
||||
// for persistent active gestures
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>>
|
||||
("POST", "/ActiveGestures/", m_inventoryService.GetActiveGestures, m_inventoryService.CheckTrustSource));
|
||||
|
||||
// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
|
||||
// system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
|
||||
// It would have been better to rename this request, but complexities in the BaseHttpServer
|
||||
// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier
|
||||
// to do this for now.
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||
("POST", "/RootFolders/", m_inventoryService.GetInventorySkeleton, m_inventoryService.CheckTrustSource));
|
||||
}
|
||||
|
||||
private void Work()
|
||||
{
|
||||
m_console.Output("Enter help for a list of commands\n");
|
||||
|
||||
while (true)
|
||||
{
|
||||
m_console.Prompt();
|
||||
}
|
||||
}
|
||||
|
||||
private void HandleAddUser(string module, string[] args)
|
||||
{
|
||||
m_inventoryService.CreateUsersInventory(UUID.Random().Guid);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -70,6 +70,6 @@ namespace OpenSim.Grid.MessagingServer.Modules
|
|||
{
|
||||
//throw new Exception("The method or operation is not implemented.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
|
||||
/// <summary>
|
||||
/// Hypergrid login service used in grid mode.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public class UserLoginAuthService : HGLoginAuthService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
|
|
@ -34,6 +34,7 @@ using System.Text.RegularExpressions;
|
|||
using log4net;
|
||||
using Nwc.XmlRpc;
|
||||
using OpenMetaverse;
|
||||
using Nini.Config;
|
||||
using OpenSim.Data;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications;
|
||||
|
@ -42,6 +43,9 @@ using OpenSim.Framework.Communications.Cache;
|
|||
using OpenSim.Framework.Capabilities;
|
||||
using OpenSim.Framework.Servers;
|
||||
using OpenSim.Framework.Servers.HttpServer;
|
||||
using OpenSim.Services.Interfaces;
|
||||
using OpenSim.Services.Connectors;
|
||||
using GridRegion = OpenSim.Services.Interfaces.GridRegion;
|
||||
|
||||
namespace OpenSim.Grid.UserServer.Modules
|
||||
{
|
||||
|
@ -51,7 +55,7 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
|
||||
/// <summary>
|
||||
/// Login service used in grid mode.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public class UserLoginService : LoginService
|
||||
{
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
@ -63,6 +67,8 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
public UserConfig m_config;
|
||||
private readonly IRegionProfileRouter m_regionProfileService;
|
||||
|
||||
private IGridService m_GridService;
|
||||
|
||||
protected BaseHttpServer m_httpServer;
|
||||
|
||||
public UserLoginService(
|
||||
|
@ -76,6 +82,8 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
m_defaultHomeY = m_config.DefaultY;
|
||||
m_interInventoryService = inventoryService;
|
||||
m_regionProfileService = regionProfileService;
|
||||
|
||||
m_GridService = new GridServicesConnector(config.GridServerURL.ToString());
|
||||
}
|
||||
|
||||
public void RegisterHandlers(BaseHttpServer httpServer, bool registerLLSDHandler, bool registerOpenIDHandlers)
|
||||
|
@ -203,47 +211,38 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
|
||||
protected override RegionInfo RequestClosestRegion(string region)
|
||||
{
|
||||
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(region,
|
||||
m_config.GridServerURL, m_config.GridSendKey, m_config.GridRecvKey);
|
||||
|
||||
if (profileData != null)
|
||||
{
|
||||
return profileData.ToRegionInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return GridRegionToRegionInfo(m_GridService.GetRegionByName(UUID.Zero, region));
|
||||
}
|
||||
|
||||
protected override RegionInfo GetRegionInfo(ulong homeRegionHandle)
|
||||
{
|
||||
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionHandle,
|
||||
m_config.GridServerURL, m_config.GridSendKey,
|
||||
m_config.GridRecvKey);
|
||||
if (profileData != null)
|
||||
{
|
||||
return profileData.ToRegionInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
uint x = 0, y = 0;
|
||||
Utils.LongToUInts(homeRegionHandle, out x, out y);
|
||||
return GridRegionToRegionInfo(m_GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y));
|
||||
}
|
||||
|
||||
protected override RegionInfo GetRegionInfo(UUID homeRegionId)
|
||||
{
|
||||
RegionProfileData profileData = m_regionProfileService.RequestSimProfileData(homeRegionId,
|
||||
m_config.GridServerURL, m_config.GridSendKey,
|
||||
m_config.GridRecvKey);
|
||||
if (profileData != null)
|
||||
{
|
||||
return profileData.ToRegionInfo();
|
||||
}
|
||||
else
|
||||
{
|
||||
return GridRegionToRegionInfo(m_GridService.GetRegionByUUID(UUID.Zero, homeRegionId));
|
||||
}
|
||||
|
||||
private RegionInfo GridRegionToRegionInfo(GridRegion gregion)
|
||||
{
|
||||
if (gregion == null)
|
||||
return null;
|
||||
}
|
||||
|
||||
RegionInfo rinfo = new RegionInfo();
|
||||
rinfo.ExternalHostName = gregion.ExternalHostName;
|
||||
rinfo.HttpPort = gregion.HttpPort;
|
||||
rinfo.InternalEndPoint = gregion.InternalEndPoint;
|
||||
rinfo.RegionID = gregion.RegionID;
|
||||
rinfo.RegionLocX = (uint)(gregion.RegionLocX / Constants.RegionSize);
|
||||
rinfo.RegionLocY = (uint)(gregion.RegionLocY / Constants.RegionSize);
|
||||
rinfo.RegionName = gregion.RegionName;
|
||||
rinfo.ScopeID = gregion.ScopeID;
|
||||
rinfo.ServerURI = gregion.ServerURI;
|
||||
|
||||
return rinfo;
|
||||
}
|
||||
|
||||
protected override bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint remoteClient)
|
||||
|
@ -280,9 +279,8 @@ namespace OpenSim.Grid.UserServer.Modules
|
|||
//response.SeedCapability = serverURI + CapsUtil.GetCapsSeedPath(capsPath);
|
||||
|
||||
// Take off trailing / so that the caps path isn't //CAPS/someUUID
|
||||
if (regionInfo.httpServerURI.EndsWith("/"))
|
||||
regionInfo.httpServerURI = regionInfo.httpServerURI.Substring(0, regionInfo.httpServerURI.Length - 1);
|
||||
response.SeedCapability = regionInfo.httpServerURI + CapsUtil.GetCapsSeedPath(capsPath);
|
||||
string uri = regionInfo.httpServerURI.Trim(new char[] { '/' });
|
||||
response.SeedCapability = uri + CapsUtil.GetCapsSeedPath(capsPath);
|
||||
|
||||
|
||||
// Notify the target of an incoming user
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue