* Rex merge, Framework (some problems in one or two files).
parent
8df0331405
commit
4853884c30
|
@ -1,263 +1,263 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
// ACL Class
|
// ACL Class
|
||||||
// Modelled after the structure of the Zend ACL Framework Library
|
// Modelled after the structure of the Zend ACL Framework Library
|
||||||
// with one key difference - the tree will search for all matching
|
// with one key difference - the tree will search for all matching
|
||||||
// permissions rather than just the first. Deny permissions will
|
// permissions rather than just the first. Deny permissions will
|
||||||
// override all others.
|
// override all others.
|
||||||
|
|
||||||
#region ACL Core Class
|
#region ACL Core Class
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Access Control List Engine
|
/// Access Control List Engine
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ACL
|
public class ACL
|
||||||
{
|
{
|
||||||
private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
|
private Dictionary<string, Role> Roles = new Dictionary<string, Role>();
|
||||||
private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
|
private Dictionary<string, Resource> Resources = new Dictionary<string, Resource>();
|
||||||
|
|
||||||
public ACL AddRole(Role role)
|
public ACL AddRole(Role role)
|
||||||
{
|
{
|
||||||
if (Roles.ContainsKey(role.Name))
|
if (Roles.ContainsKey(role.Name))
|
||||||
throw new AlreadyContainsRoleException(role);
|
throw new AlreadyContainsRoleException(role);
|
||||||
|
|
||||||
Roles.Add(role.Name, role);
|
Roles.Add(role.Name, role);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL AddResource(Resource resource)
|
public ACL AddResource(Resource resource)
|
||||||
{
|
{
|
||||||
Resources.Add(resource.Name, resource);
|
Resources.Add(resource.Name, resource);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permission HasPermission(string role, string resource)
|
public Permission HasPermission(string role, string resource)
|
||||||
{
|
{
|
||||||
if (!Roles.ContainsKey(role))
|
if (!Roles.ContainsKey(role))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
if (!Resources.ContainsKey(resource))
|
if (!Resources.ContainsKey(resource))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
return Roles[role].RequestPermission(resource);
|
return Roles[role].RequestPermission(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL GrantPermission(string role, string resource)
|
public ACL GrantPermission(string role, string resource)
|
||||||
{
|
{
|
||||||
if (!Roles.ContainsKey(role))
|
if (!Roles.ContainsKey(role))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
if (!Resources.ContainsKey(resource))
|
if (!Resources.ContainsKey(resource))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
Roles[role].GivePermission(resource, Permission.Allow);
|
Roles[role].GivePermission(resource, Permission.Allow);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL DenyPermission(string role, string resource)
|
public ACL DenyPermission(string role, string resource)
|
||||||
{
|
{
|
||||||
if (!Roles.ContainsKey(role))
|
if (!Roles.ContainsKey(role))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
if (!Resources.ContainsKey(resource))
|
if (!Resources.ContainsKey(resource))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
Roles[role].GivePermission(resource, Permission.Deny);
|
Roles[role].GivePermission(resource, Permission.Deny);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ACL ResetPermission(string role, string resource)
|
public ACL ResetPermission(string role, string resource)
|
||||||
{
|
{
|
||||||
if (!Roles.ContainsKey(role))
|
if (!Roles.ContainsKey(role))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
if (!Resources.ContainsKey(resource))
|
if (!Resources.ContainsKey(resource))
|
||||||
throw new KeyNotFoundException();
|
throw new KeyNotFoundException();
|
||||||
|
|
||||||
Roles[role].GivePermission(resource, Permission.None);
|
Roles[role].GivePermission(resource, Permission.None);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Exceptions
|
#region Exceptions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Thrown when an ACL attempts to add a duplicate role.
|
/// Thrown when an ACL attempts to add a duplicate role.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AlreadyContainsRoleException : Exception
|
public class AlreadyContainsRoleException : Exception
|
||||||
{
|
{
|
||||||
protected Role m_role;
|
protected Role m_role;
|
||||||
|
|
||||||
public Role ErrorRole
|
public Role ErrorRole
|
||||||
{
|
{
|
||||||
get { return m_role; }
|
get { return m_role; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlreadyContainsRoleException(Role role)
|
public AlreadyContainsRoleException(Role role)
|
||||||
{
|
{
|
||||||
m_role = role;
|
m_role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return "This ACL already contains a role called '" + m_role.Name + "'.";
|
return "This ACL already contains a role called '" + m_role.Name + "'.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Roles and Resources
|
#region Roles and Resources
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Does this Role have permission to access a specified Resource?
|
/// Does this Role have permission to access a specified Resource?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum Permission
|
public enum Permission
|
||||||
{
|
{
|
||||||
Deny,
|
Deny,
|
||||||
None,
|
None,
|
||||||
Allow
|
Allow
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A role class, for use with Users or Groups
|
/// A role class, for use with Users or Groups
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Role
|
public class Role
|
||||||
{
|
{
|
||||||
private string m_name;
|
private string m_name;
|
||||||
private Role[] m_parents;
|
private Role[] m_parents;
|
||||||
private Dictionary<string, Permission> m_resources = new Dictionary<string, Permission>();
|
private Dictionary<string, Permission> m_resources = new Dictionary<string, Permission>();
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return m_name; }
|
get { return m_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permission RequestPermission(string resource)
|
public Permission RequestPermission(string resource)
|
||||||
{
|
{
|
||||||
return RequestPermission(resource, Permission.None);
|
return RequestPermission(resource, Permission.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Permission RequestPermission(string resource, Permission current)
|
public Permission RequestPermission(string resource, Permission current)
|
||||||
{
|
{
|
||||||
// Deny permissions always override any others
|
// Deny permissions always override any others
|
||||||
if (current == Permission.Deny)
|
if (current == Permission.Deny)
|
||||||
return current;
|
return current;
|
||||||
|
|
||||||
Permission temp = Permission.None;
|
Permission temp = Permission.None;
|
||||||
|
|
||||||
// Pickup non-None permissions
|
// Pickup non-None permissions
|
||||||
if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None)
|
if (m_resources.ContainsKey(resource) && m_resources[resource] != Permission.None)
|
||||||
temp = m_resources[resource];
|
temp = m_resources[resource];
|
||||||
|
|
||||||
if (m_parents != null)
|
if (m_parents != null)
|
||||||
{
|
{
|
||||||
foreach (Role parent in m_parents)
|
foreach (Role parent in m_parents)
|
||||||
{
|
{
|
||||||
temp = parent.RequestPermission(resource, temp);
|
temp = parent.RequestPermission(resource, temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GivePermission(string resource, Permission perm)
|
public void GivePermission(string resource, Permission perm)
|
||||||
{
|
{
|
||||||
m_resources[resource] = perm;
|
m_resources[resource] = perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Role(string name)
|
public Role(string name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_parents = null;
|
m_parents = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Role(string name, Role[] parents)
|
public Role(string name, Role[] parents)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
m_parents = parents;
|
m_parents = parents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Resource
|
public class Resource
|
||||||
{
|
{
|
||||||
private string m_name;
|
private string m_name;
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
get { return m_name; }
|
get { return m_name; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource(string name)
|
public Resource(string name)
|
||||||
{
|
{
|
||||||
m_name = name;
|
m_name = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Tests
|
#region Tests
|
||||||
|
|
||||||
internal class ACLTester
|
internal class ACLTester
|
||||||
{
|
{
|
||||||
public ACLTester()
|
public ACLTester()
|
||||||
{
|
{
|
||||||
ACL acl = new ACL();
|
ACL acl = new ACL();
|
||||||
|
|
||||||
Role Guests = new Role("Guests");
|
Role Guests = new Role("Guests");
|
||||||
acl.AddRole(Guests);
|
acl.AddRole(Guests);
|
||||||
|
|
||||||
Role[] parents = new Role[0];
|
Role[] parents = new Role[0];
|
||||||
parents[0] = Guests;
|
parents[0] = Guests;
|
||||||
|
|
||||||
Role JoeGuest = new Role("JoeGuest", parents);
|
Role JoeGuest = new Role("JoeGuest", parents);
|
||||||
acl.AddRole(JoeGuest);
|
acl.AddRole(JoeGuest);
|
||||||
|
|
||||||
Resource CanBuild = new Resource("CanBuild");
|
Resource CanBuild = new Resource("CanBuild");
|
||||||
acl.AddResource(CanBuild);
|
acl.AddResource(CanBuild);
|
||||||
|
|
||||||
|
|
||||||
acl.GrantPermission("Guests", "CanBuild");
|
acl.GrantPermission("Guests", "CanBuild");
|
||||||
|
|
||||||
acl.HasPermission("JoeGuest", "CanBuild");
|
acl.HasPermission("JoeGuest", "CanBuild");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,111 +1,111 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class AgentCircuitData
|
public class AgentCircuitData
|
||||||
{
|
{
|
||||||
public AgentCircuitData()
|
public AgentCircuitData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public AgentCircuitData(sAgentCircuitData cAgent)
|
public AgentCircuitData(sAgentCircuitData cAgent)
|
||||||
{
|
{
|
||||||
AgentID = new LLUUID(cAgent.AgentID);
|
AgentID = new LLUUID(cAgent.AgentID);
|
||||||
SessionID = new LLUUID(cAgent.SessionID);
|
SessionID = new LLUUID(cAgent.SessionID);
|
||||||
SecureSessionID = new LLUUID(cAgent.SecureSessionID);
|
SecureSessionID = new LLUUID(cAgent.SecureSessionID);
|
||||||
startpos = new LLVector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
|
startpos = new LLVector3(cAgent.startposx, cAgent.startposy, cAgent.startposz);
|
||||||
firstname = cAgent.firstname;
|
firstname = cAgent.firstname;
|
||||||
lastname = cAgent.lastname;
|
lastname = cAgent.lastname;
|
||||||
circuitcode = cAgent.circuitcode;
|
circuitcode = cAgent.circuitcode;
|
||||||
child = cAgent.child;
|
child = cAgent.child;
|
||||||
InventoryFolder = new LLUUID(cAgent.InventoryFolder);
|
InventoryFolder = new LLUUID(cAgent.InventoryFolder);
|
||||||
BaseFolder = new LLUUID(cAgent.BaseFolder);
|
BaseFolder = new LLUUID(cAgent.BaseFolder);
|
||||||
CapsPath = cAgent.CapsPath;
|
CapsPath = cAgent.CapsPath;
|
||||||
ClientVersion = cAgent.ClientVersion; //rex
|
ClientVersion = cAgent.ClientVersion; //rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
public LLUUID SessionID;
|
public LLUUID SessionID;
|
||||||
public LLUUID SecureSessionID;
|
public LLUUID SecureSessionID;
|
||||||
public LLVector3 startpos;
|
public LLVector3 startpos;
|
||||||
public string firstname;
|
public string firstname;
|
||||||
public string lastname;
|
public string lastname;
|
||||||
public uint circuitcode;
|
public uint circuitcode;
|
||||||
public bool child;
|
public bool child;
|
||||||
public LLUUID InventoryFolder;
|
public LLUUID InventoryFolder;
|
||||||
public LLUUID BaseFolder;
|
public LLUUID BaseFolder;
|
||||||
public string CapsPath = "";
|
public string CapsPath = String.Empty;
|
||||||
public string ClientVersion = "not set"; //rex
|
public string ClientVersion = "not set"; //rex
|
||||||
public string authenticationAddr;
|
public string authenticationAddr;
|
||||||
public string asAddress = "";
|
public string asAddress = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class sAgentCircuitData
|
public class sAgentCircuitData
|
||||||
{
|
{
|
||||||
public sAgentCircuitData()
|
public sAgentCircuitData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sAgentCircuitData(AgentCircuitData cAgent)
|
public sAgentCircuitData(AgentCircuitData cAgent)
|
||||||
{
|
{
|
||||||
AgentID = cAgent.AgentID.UUID;
|
AgentID = cAgent.AgentID.UUID;
|
||||||
SessionID = cAgent.SessionID.UUID;
|
SessionID = cAgent.SessionID.UUID;
|
||||||
SecureSessionID = cAgent.SecureSessionID.UUID;
|
SecureSessionID = cAgent.SecureSessionID.UUID;
|
||||||
startposx = cAgent.startpos.X;
|
startposx = cAgent.startpos.X;
|
||||||
startposy = cAgent.startpos.Y;
|
startposy = cAgent.startpos.Y;
|
||||||
startposz = cAgent.startpos.Z;
|
startposz = cAgent.startpos.Z;
|
||||||
firstname = cAgent.firstname;
|
firstname = cAgent.firstname;
|
||||||
lastname = cAgent.lastname;
|
lastname = cAgent.lastname;
|
||||||
circuitcode = cAgent.circuitcode;
|
circuitcode = cAgent.circuitcode;
|
||||||
child = cAgent.child;
|
child = cAgent.child;
|
||||||
InventoryFolder = cAgent.InventoryFolder.UUID;
|
InventoryFolder = cAgent.InventoryFolder.UUID;
|
||||||
BaseFolder = cAgent.BaseFolder.UUID;
|
BaseFolder = cAgent.BaseFolder.UUID;
|
||||||
CapsPath = cAgent.CapsPath;
|
CapsPath = cAgent.CapsPath;
|
||||||
ClientVersion = cAgent.ClientVersion; //rex
|
ClientVersion = cAgent.ClientVersion; //rex
|
||||||
}
|
}
|
||||||
|
|
||||||
public Guid AgentID;
|
public Guid AgentID;
|
||||||
public Guid SessionID;
|
public Guid SessionID;
|
||||||
public Guid SecureSessionID;
|
public Guid SecureSessionID;
|
||||||
public float startposx;
|
public float startposx;
|
||||||
public float startposy;
|
public float startposy;
|
||||||
public float startposz;
|
public float startposz;
|
||||||
public string firstname;
|
public string firstname;
|
||||||
public string lastname;
|
public string lastname;
|
||||||
public uint circuitcode;
|
public uint circuitcode;
|
||||||
public bool child;
|
public bool child;
|
||||||
public Guid InventoryFolder;
|
public Guid InventoryFolder;
|
||||||
public Guid BaseFolder;
|
public Guid BaseFolder;
|
||||||
public string CapsPath = "";
|
public string CapsPath = String.Empty;
|
||||||
public string ClientVersion = "not set"; //rex
|
public string ClientVersion = "not set"; //rex
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,258 +1,258 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife.Packets;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class AgentInventory
|
public class AgentInventory
|
||||||
{
|
{
|
||||||
//Holds the local copy of Inventory info for a agent
|
//Holds the local copy of Inventory info for a agent
|
||||||
public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
|
public Dictionary<LLUUID, InventoryFolder> InventoryFolders;
|
||||||
public Dictionary<LLUUID, InventoryItem> InventoryItems;
|
public Dictionary<LLUUID, InventoryItem> InventoryItems;
|
||||||
public InventoryFolder InventoryRoot;
|
public InventoryFolder InventoryRoot;
|
||||||
public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
|
public int LastCached; //maybe used by opensim app, time this was last stored/compared to user server
|
||||||
public LLUUID AgentID;
|
public LLUUID AgentID;
|
||||||
public AvatarWearable[] Wearables;
|
public AvatarWearable[] Wearables;
|
||||||
|
|
||||||
public AgentInventory()
|
public AgentInventory()
|
||||||
{
|
{
|
||||||
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
|
InventoryFolders = new Dictionary<LLUUID, InventoryFolder>();
|
||||||
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
|
InventoryItems = new Dictionary<LLUUID, InventoryItem>();
|
||||||
Initialise();
|
Initialise();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Initialise()
|
public virtual void Initialise()
|
||||||
{
|
{
|
||||||
Wearables = new AvatarWearable[13];
|
Wearables = new AvatarWearable[13];
|
||||||
for (int i = 0; i < 13; i++)
|
for (int i = 0; i < 13; i++)
|
||||||
{
|
{
|
||||||
Wearables[i] = new AvatarWearable();
|
Wearables[i] = new AvatarWearable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateNewFolder(LLUUID folderID, ushort type)
|
public bool CreateNewFolder(LLUUID folderID, ushort type)
|
||||||
{
|
{
|
||||||
InventoryFolder Folder = new InventoryFolder();
|
InventoryFolder Folder = new InventoryFolder();
|
||||||
Folder.FolderID = folderID;
|
Folder.FolderID = folderID;
|
||||||
Folder.OwnerID = AgentID;
|
Folder.OwnerID = AgentID;
|
||||||
Folder.DefaultType = type;
|
Folder.DefaultType = type;
|
||||||
InventoryFolders.Add(Folder.FolderID, Folder);
|
InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
|
public void CreateRootFolder(LLUUID newAgentID, bool createTextures)
|
||||||
{
|
{
|
||||||
AgentID = newAgentID;
|
AgentID = newAgentID;
|
||||||
InventoryRoot = new InventoryFolder();
|
InventoryRoot = new InventoryFolder();
|
||||||
InventoryRoot.FolderID = LLUUID.Random();
|
InventoryRoot.FolderID = LLUUID.Random();
|
||||||
InventoryRoot.ParentID = LLUUID.Zero;
|
InventoryRoot.ParentID = LLUUID.Zero;
|
||||||
InventoryRoot.Version = 1;
|
InventoryRoot.Version = 1;
|
||||||
InventoryRoot.DefaultType = 8;
|
InventoryRoot.DefaultType = 8;
|
||||||
InventoryRoot.OwnerID = AgentID;
|
InventoryRoot.OwnerID = AgentID;
|
||||||
InventoryRoot.FolderName = "My Inventory";
|
InventoryRoot.FolderName = "My Inventory";
|
||||||
InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
|
InventoryFolders.Add(InventoryRoot.FolderID, InventoryRoot);
|
||||||
InventoryRoot.OwnerID = AgentID;
|
InventoryRoot.OwnerID = AgentID;
|
||||||
if (createTextures)
|
if (createTextures)
|
||||||
{
|
{
|
||||||
CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
|
CreateNewFolder(LLUUID.Random(), 0, "Textures", InventoryRoot.FolderID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
|
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName)
|
||||||
{
|
{
|
||||||
InventoryFolder Folder = new InventoryFolder();
|
InventoryFolder Folder = new InventoryFolder();
|
||||||
Folder.FolderID = folderID;
|
Folder.FolderID = folderID;
|
||||||
Folder.OwnerID = AgentID;
|
Folder.OwnerID = AgentID;
|
||||||
Folder.DefaultType = type;
|
Folder.DefaultType = type;
|
||||||
Folder.FolderName = folderName;
|
Folder.FolderName = folderName;
|
||||||
InventoryFolders.Add(Folder.FolderID, Folder);
|
InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
|
public bool CreateNewFolder(LLUUID folderID, ushort type, string folderName, LLUUID parentID)
|
||||||
{
|
{
|
||||||
if (!InventoryFolders.ContainsKey(folderID))
|
if (!InventoryFolders.ContainsKey(folderID))
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
|
System.Console.WriteLine("creating new folder called " + folderName + " in agents inventory");
|
||||||
InventoryFolder Folder = new InventoryFolder();
|
InventoryFolder Folder = new InventoryFolder();
|
||||||
Folder.FolderID = folderID;
|
Folder.FolderID = folderID;
|
||||||
Folder.OwnerID = AgentID;
|
Folder.OwnerID = AgentID;
|
||||||
Folder.DefaultType = type;
|
Folder.DefaultType = type;
|
||||||
Folder.FolderName = folderName;
|
Folder.FolderName = folderName;
|
||||||
Folder.ParentID = parentID;
|
Folder.ParentID = parentID;
|
||||||
InventoryFolders.Add(Folder.FolderID, Folder);
|
InventoryFolders.Add(Folder.FolderID, Folder);
|
||||||
}
|
}
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasFolder(LLUUID folderID)
|
public bool HasFolder(LLUUID folderID)
|
||||||
{
|
{
|
||||||
if (InventoryFolders.ContainsKey(folderID))
|
if (InventoryFolders.ContainsKey(folderID))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLUUID GetFolderID(string folderName)
|
public LLUUID GetFolderID(string folderName)
|
||||||
{
|
{
|
||||||
foreach (InventoryFolder inv in InventoryFolders.Values)
|
foreach (InventoryFolder inv in InventoryFolders.Values)
|
||||||
{
|
{
|
||||||
if (inv.FolderName == folderName)
|
if (inv.FolderName == folderName)
|
||||||
{
|
{
|
||||||
return inv.FolderID;
|
return inv.FolderID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return LLUUID.Zero;
|
return LLUUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
|
public bool UpdateItemAsset(LLUUID itemID, AssetBase asset)
|
||||||
{
|
{
|
||||||
if (InventoryItems.ContainsKey(itemID))
|
if (InventoryItems.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
InventoryItem Item = InventoryItems[itemID];
|
InventoryItem Item = InventoryItems[itemID];
|
||||||
Item.AssetID = asset.FullID;
|
Item.AssetID = asset.FullID;
|
||||||
System.Console.WriteLine("updated inventory item " + itemID.ToString() +
|
System.Console.WriteLine("updated inventory item " + itemID.ToString() +
|
||||||
" so it now is set to asset " + asset.FullID.ToString());
|
" so it now is set to asset " + asset.FullID.ToString());
|
||||||
//TODO need to update the rest of the info
|
//TODO need to update the rest of the info
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
|
public bool UpdateItemDetails(LLUUID itemID, UpdateInventoryItemPacket.InventoryDataBlock packet)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("updating inventory item details");
|
System.Console.WriteLine("updating inventory item details");
|
||||||
if (InventoryItems.ContainsKey(itemID))
|
if (InventoryItems.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name));
|
System.Console.WriteLine("changing name to " + Util.FieldToString(packet.Name));
|
||||||
InventoryItem Item = InventoryItems[itemID];
|
InventoryItem Item = InventoryItems[itemID];
|
||||||
Item.Name = Util.FieldToString(packet.Name);
|
Item.Name = Util.FieldToString(packet.Name);
|
||||||
System.Console.WriteLine("updated inventory item " + itemID.ToString());
|
System.Console.WriteLine("updated inventory item " + itemID.ToString());
|
||||||
//TODO need to update the rest of the info
|
//TODO need to update the rest of the info
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
|
public LLUUID AddToInventory(LLUUID folderID, AssetBase asset)
|
||||||
{
|
{
|
||||||
if (InventoryFolders.ContainsKey(folderID))
|
if (InventoryFolders.ContainsKey(folderID))
|
||||||
{
|
{
|
||||||
LLUUID NewItemID = LLUUID.Random();
|
LLUUID NewItemID = LLUUID.Random();
|
||||||
|
|
||||||
InventoryItem Item = new InventoryItem();
|
InventoryItem Item = new InventoryItem();
|
||||||
Item.FolderID = folderID;
|
Item.FolderID = folderID;
|
||||||
Item.OwnerID = AgentID;
|
Item.OwnerID = AgentID;
|
||||||
Item.AssetID = asset.FullID;
|
Item.AssetID = asset.FullID;
|
||||||
Item.ItemID = NewItemID;
|
Item.ItemID = NewItemID;
|
||||||
Item.Type = asset.Type;
|
Item.Type = asset.Type;
|
||||||
Item.Name = asset.Name;
|
Item.Name = asset.Name;
|
||||||
Item.Description = asset.Description;
|
Item.Description = asset.Description;
|
||||||
Item.InvType = asset.InvType;
|
Item.InvType = asset.InvType;
|
||||||
InventoryItems.Add(Item.ItemID, Item);
|
InventoryItems.Add(Item.ItemID, Item);
|
||||||
InventoryFolder Folder = InventoryFolders[Item.FolderID];
|
InventoryFolder Folder = InventoryFolders[Item.FolderID];
|
||||||
Folder.Items.Add(Item);
|
Folder.Items.Add(Item);
|
||||||
return (Item.ItemID);
|
return (Item.ItemID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeleteFromInventory(LLUUID itemID)
|
public bool DeleteFromInventory(LLUUID itemID)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
if (InventoryItems.ContainsKey(itemID))
|
if (InventoryItems.ContainsKey(itemID))
|
||||||
{
|
{
|
||||||
InventoryItem item = InventoryItems[itemID];
|
InventoryItem item = InventoryItems[itemID];
|
||||||
InventoryItems.Remove(itemID);
|
InventoryItems.Remove(itemID);
|
||||||
foreach (InventoryFolder fold in InventoryFolders.Values)
|
foreach (InventoryFolder fold in InventoryFolders.Values)
|
||||||
{
|
{
|
||||||
if (fold.Items.Contains(item))
|
if (fold.Items.Contains(item))
|
||||||
{
|
{
|
||||||
fold.Items.Remove(item);
|
fold.Items.Remove(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InventoryFolder
|
public class InventoryFolder
|
||||||
{
|
{
|
||||||
public List<InventoryItem> Items;
|
public List<InventoryItem> Items;
|
||||||
//public List<InventoryFolder> Subfolders;
|
//public List<InventoryFolder> Subfolders;
|
||||||
public LLUUID FolderID;
|
public LLUUID FolderID;
|
||||||
public LLUUID OwnerID;
|
public LLUUID OwnerID;
|
||||||
public LLUUID ParentID = LLUUID.Zero;
|
public LLUUID ParentID = LLUUID.Zero;
|
||||||
public string FolderName;
|
public string FolderName;
|
||||||
public ushort DefaultType;
|
public ushort DefaultType;
|
||||||
public ushort Version;
|
public ushort Version;
|
||||||
|
|
||||||
public InventoryFolder()
|
public InventoryFolder()
|
||||||
{
|
{
|
||||||
Items = new List<InventoryItem>();
|
Items = new List<InventoryItem>();
|
||||||
//Subfolders = new List<InventoryFolder>();
|
//Subfolders = new List<InventoryFolder>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class InventoryItem
|
public class InventoryItem
|
||||||
{
|
{
|
||||||
public LLUUID FolderID;
|
public LLUUID FolderID;
|
||||||
public LLUUID OwnerID;
|
public LLUUID OwnerID;
|
||||||
public LLUUID ItemID;
|
public LLUUID ItemID;
|
||||||
public LLUUID AssetID;
|
public LLUUID AssetID;
|
||||||
public LLUUID CreatorID;
|
public LLUUID CreatorID;
|
||||||
public sbyte InvType;
|
public sbyte InvType;
|
||||||
public sbyte Type;
|
public sbyte Type;
|
||||||
public string Name = "";
|
public string Name = System.String.Empty;
|
||||||
public string Description;
|
public string Description;
|
||||||
|
|
||||||
public InventoryItem()
|
public InventoryItem()
|
||||||
{
|
{
|
||||||
CreatorID = LLUUID.Zero;
|
CreatorID = LLUUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ExportString()
|
public string ExportString()
|
||||||
{
|
{
|
||||||
string typ = "notecard";
|
string typ = "notecard";
|
||||||
string result = "";
|
string result = System.String.Empty;
|
||||||
result += "\tinv_object\t0\n\t{\n";
|
result += "\tinv_object\t0\n\t{\n";
|
||||||
result += "\t\tobj_id\t%s\n";
|
result += "\t\tobj_id\t%s\n";
|
||||||
result += "\t\tparent_id\t" + ItemID.ToString() + "\n";
|
result += "\t\tparent_id\t" + ItemID.ToString() + "\n";
|
||||||
result += "\t\ttype\t" + typ + "\n";
|
result += "\t\ttype\t" + typ + "\n";
|
||||||
result += "\t\tname\t" + Name + "|\n";
|
result += "\t\tname\t" + Name + "|\n";
|
||||||
result += "\t}\n";
|
result += "\t}\n";
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,64 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.FrameWork")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.FrameWork")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyTitle("OpenSim.FrameWork")]
|
||||||
|
[assembly : AssemblyDescription("")]
|
||||||
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.FrameWork")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("a08e20c7-f191-4137-b1f0-9291408fa521")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -1,56 +1,56 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class AssetBase
|
public class AssetBase
|
||||||
{
|
{
|
||||||
public byte[] Data;
|
public byte[] Data;
|
||||||
public LLUUID FullID;
|
public LLUUID FullID;
|
||||||
public sbyte Type;
|
public sbyte Type;
|
||||||
public sbyte InvType;
|
public sbyte InvType;
|
||||||
public string Name = "";
|
public string Name = String.Empty;
|
||||||
public string Description = "";
|
public string Description = String.Empty;
|
||||||
public string MediaURL = "";//rex
|
public string MediaURL = "";//rex
|
||||||
public bool Local = false;
|
public bool Local = false;
|
||||||
public bool Temporary = false;
|
public bool Temporary = false;
|
||||||
|
|
||||||
public AssetBase()
|
public AssetBase()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public AssetBase(LLUUID assetId, string name)
|
public AssetBase(LLUUID assetId, string name)
|
||||||
{
|
{
|
||||||
FullID = assetId;
|
FullID = assetId;
|
||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,83 +1,86 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
using System;
|
||||||
{
|
using OpenSim.Framework.Console;
|
||||||
/// <summary>
|
|
||||||
/// UserConfig -- For User Server Configuration
|
namespace OpenSim.Framework
|
||||||
/// </summary>
|
{
|
||||||
public class AssetConfig
|
/// <summary>
|
||||||
{
|
/// UserConfig -- For User Server Configuration
|
||||||
public string DefaultStartupMsg = "";
|
/// </summary>
|
||||||
|
public class AssetConfig
|
||||||
public string DatabaseProvider = "";
|
{
|
||||||
|
public string DefaultStartupMsg = String.Empty;
|
||||||
public static uint DefaultHttpPort = 8003;
|
|
||||||
public uint HttpPort = DefaultHttpPort;
|
public string DatabaseProvider = String.Empty;
|
||||||
|
|
||||||
private ConfigurationMember configMember;
|
public static uint DefaultHttpPort = 8003;
|
||||||
|
public uint HttpPort = DefaultHttpPort;
|
||||||
public AssetConfig(string description, string filename)
|
|
||||||
{
|
private ConfigurationMember configMember;
|
||||||
configMember =
|
|
||||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
public AssetConfig(string description, string filename)
|
||||||
configMember.performConfigurationRetrieve();
|
{
|
||||||
}
|
configMember =
|
||||||
|
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
||||||
public void loadConfigurationOptions()
|
configMember.performConfigurationRetrieve();
|
||||||
{
|
}
|
||||||
configMember.addConfigurationOption("default_startup_message",
|
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
public void loadConfigurationOptions()
|
||||||
"Default Startup Message", "Welcome to OGS", false);
|
{
|
||||||
|
configMember.addConfigurationOption("default_startup_message",
|
||||||
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
|
"Default Startup Message", "Welcome to OGS", false);
|
||||||
|
|
||||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
|
||||||
}
|
|
||||||
|
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||||
{
|
}
|
||||||
switch (configuration_key)
|
|
||||||
{
|
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
case "default_startup_message":
|
{
|
||||||
DefaultStartupMsg = (string) configuration_result;
|
switch (configuration_key)
|
||||||
break;
|
{
|
||||||
case "database_provider":
|
case "default_startup_message":
|
||||||
DatabaseProvider = (string) configuration_result;
|
DefaultStartupMsg = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "http_port":
|
case "database_provider":
|
||||||
HttpPort = (uint) configuration_result;
|
DatabaseProvider = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
}
|
case "http_port":
|
||||||
|
HttpPort = (uint) configuration_result;
|
||||||
return true;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,164 +1,164 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Loads assets from the filesystem location. Not yet a plugin, though it should be.
|
/// Loads assets from the filesystem location. Not yet a plugin, though it should be.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
namespace OpenSim.Framework.AssetLoader.Filesystem
|
namespace OpenSim.Framework.AssetLoader.Filesystem
|
||||||
{
|
{
|
||||||
public class AssetLoaderFileSystem : IAssetLoader
|
public class AssetLoaderFileSystem : IAssetLoader
|
||||||
{
|
{
|
||||||
protected AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage)
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
{
|
|
||||||
AssetBase asset = new AssetBase(
|
protected AssetBase CreateAsset(string assetIdStr, string name, string path, bool isImage)
|
||||||
new LLUUID(assetIdStr),
|
{
|
||||||
name
|
AssetBase asset = new AssetBase(
|
||||||
);
|
new LLUUID(assetIdStr),
|
||||||
|
name
|
||||||
if (!String.IsNullOrEmpty(path))
|
);
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose("ASSETS", "Loading: [{0}][{1}]", name, path);
|
if (!String.IsNullOrEmpty(path))
|
||||||
|
{
|
||||||
LoadAsset(asset, isImage, path);
|
m_log.InfoFormat("[ASSETS]: Loading: [{0}][{1}]", name, path);
|
||||||
}
|
|
||||||
else
|
LoadAsset(asset, isImage, path);
|
||||||
{
|
}
|
||||||
MainLog.Instance.Verbose("ASSETS", "Instantiated: [{0}]", name);
|
else
|
||||||
}
|
{
|
||||||
|
m_log.InfoFormat("[ASSETS]: Instantiated: [{0}]", name);
|
||||||
return asset;
|
}
|
||||||
}
|
|
||||||
|
return asset;
|
||||||
protected void LoadAsset(AssetBase info, bool image, string path)
|
}
|
||||||
{
|
|
||||||
FileInfo fInfo = new FileInfo(path);
|
protected void LoadAsset(AssetBase info, bool image, string path)
|
||||||
long numBytes = fInfo.Length;
|
{
|
||||||
FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
FileInfo fInfo = new FileInfo(path);
|
||||||
byte[] idata = new byte[numBytes];
|
long numBytes = fInfo.Length;
|
||||||
BinaryReader br = new BinaryReader(fStream);
|
FileStream fStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||||
idata = br.ReadBytes((int) numBytes);
|
byte[] idata = new byte[numBytes];
|
||||||
br.Close();
|
BinaryReader br = new BinaryReader(fStream);
|
||||||
fStream.Close();
|
idata = br.ReadBytes((int) numBytes);
|
||||||
info.Data = idata;
|
br.Close();
|
||||||
//info.loaded=true;
|
fStream.Close();
|
||||||
}
|
info.Data = idata;
|
||||||
|
//info.loaded=true;
|
||||||
public void ForEachDefaultXmlAsset(Action<AssetBase> action)
|
}
|
||||||
{
|
|
||||||
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
public void ForEachDefaultXmlAsset(Action<AssetBase> action)
|
||||||
|
{
|
||||||
ForEachDefaultXmlAsset(assetSetFilename, action);
|
string assetSetFilename = Path.Combine(Util.assetsDir(), "AssetSets.xml");
|
||||||
}
|
|
||||||
|
ForEachDefaultXmlAsset(assetSetFilename, action);
|
||||||
public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
|
}
|
||||||
{
|
|
||||||
List<AssetBase> assets = new List<AssetBase>();
|
public void ForEachDefaultXmlAsset(string assetSetFilename, Action<AssetBase> action)
|
||||||
if (File.Exists(assetSetFilename))
|
{
|
||||||
{
|
List<AssetBase> assets = new List<AssetBase>();
|
||||||
string assetSetPath = "ERROR";
|
if (File.Exists(assetSetFilename))
|
||||||
|
{
|
||||||
try
|
string assetSetPath = "ERROR";
|
||||||
{
|
|
||||||
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
|
try
|
||||||
|
{
|
||||||
for (int i = 0; i < source.Configs.Count; i++)
|
XmlConfigSource source = new XmlConfigSource(assetSetFilename);
|
||||||
{
|
|
||||||
assetSetPath = source.Configs[i].GetString("file", "");
|
for (int i = 0; i < source.Configs.Count; i++)
|
||||||
|
{
|
||||||
LoadXmlAssetSet(Path.Combine(Util.assetsDir(), assetSetPath), assets);
|
assetSetPath = source.Configs[i].GetString("file", String.Empty);
|
||||||
}
|
|
||||||
}
|
LoadXmlAssetSet(Path.Combine(Util.assetsDir(), assetSetPath), assets);
|
||||||
catch (XmlException e)
|
}
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error("ASSETS", "Error loading {0} : {1}", assetSetPath, e);
|
catch (XmlException e)
|
||||||
}
|
{
|
||||||
}
|
m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e);
|
||||||
else
|
}
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(
|
else
|
||||||
"ASSETS",
|
{
|
||||||
"Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
m_log.Error("[ASSETS]: Asset set control file assets/AssetSets.xml does not exist! No assets loaded.");
|
||||||
}
|
}
|
||||||
|
|
||||||
assets.ForEach(action);
|
assets.ForEach(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Use the asset set information at path to load assets
|
/// Use the asset set information at path to load assets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <param name="assets"></param>
|
/// <param name="assets"></param>
|
||||||
protected void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
|
protected void LoadXmlAssetSet(string assetSetPath, List<AssetBase> assets)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("ASSETS", "Loading asset set {0}", assetSetPath);
|
m_log.InfoFormat("[ASSETS]: Loading asset set {0}", assetSetPath);
|
||||||
|
|
||||||
if (File.Exists(assetSetPath))
|
if (File.Exists(assetSetPath))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
XmlConfigSource source = new XmlConfigSource(assetSetPath);
|
XmlConfigSource source = new XmlConfigSource(assetSetPath);
|
||||||
String dir = Path.GetDirectoryName(assetSetPath);
|
String dir = Path.GetDirectoryName(assetSetPath);
|
||||||
|
|
||||||
for (int i = 0; i < source.Configs.Count; i++)
|
for (int i = 0; i < source.Configs.Count; i++)
|
||||||
{
|
{
|
||||||
string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToString());
|
string assetIdStr = source.Configs[i].GetString("assetID", LLUUID.Random().ToString());
|
||||||
string name = source.Configs[i].GetString("name", "");
|
string name = source.Configs[i].GetString("name", String.Empty);
|
||||||
sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
|
sbyte type = (sbyte) source.Configs[i].GetInt("assetType", 0);
|
||||||
sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
|
sbyte invType = (sbyte) source.Configs[i].GetInt("inventoryType", 0);
|
||||||
string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", ""));
|
string assetPath = Path.Combine(dir, source.Configs[i].GetString("fileName", String.Empty));
|
||||||
|
|
||||||
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false);
|
AssetBase newAsset = CreateAsset(assetIdStr, name, assetPath, false);
|
||||||
|
|
||||||
newAsset.Type = type;
|
newAsset.Type = type;
|
||||||
newAsset.InvType = invType;
|
newAsset.InvType = invType;
|
||||||
assets.Add(newAsset);
|
assets.Add(newAsset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (XmlException e)
|
catch (XmlException e)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("ASSETS", "Error loading {0} : {1}", assetSetPath, e);
|
m_log.ErrorFormat("[ASSETS]: Error loading {0} : {1}", assetSetPath, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Error("ASSETS", "Asset set file {0} does not exist!", assetSetPath);
|
m_log.ErrorFormat("[ASSETS]: Asset set file {0} does not exist!", assetSetPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,38 @@
|
||||||
using libsecondlife;
|
/*
|
||||||
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
namespace OpenSim.Framework
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
{
|
*
|
||||||
public struct AssetRequest
|
* Redistribution and use in source and binary forms, with or without
|
||||||
{
|
* modification, are permitted provided that the following conditions are met:
|
||||||
public LLUUID AssetID;
|
* * Redistributions of source code must retain the above copyright
|
||||||
public bool IsTexture;
|
* 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 OpenSim 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 libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public struct AssetRequest
|
||||||
|
{
|
||||||
|
public LLUUID AssetID;
|
||||||
|
public bool IsTexture;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,68 +1,73 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class BlockingQueue<T>
|
public class BlockingQueue<T>
|
||||||
{
|
{
|
||||||
private readonly Queue<T> m_queue = new Queue<T>();
|
private readonly Queue<T> m_queue = new Queue<T>();
|
||||||
private readonly object m_queueSync = new object();
|
private readonly object m_queueSync = new object();
|
||||||
|
|
||||||
public void Enqueue(T value)
|
public void Enqueue(T value)
|
||||||
{
|
{
|
||||||
lock (m_queueSync)
|
lock (m_queueSync)
|
||||||
{
|
{
|
||||||
m_queue.Enqueue(value);
|
m_queue.Enqueue(value);
|
||||||
Monitor.Pulse(m_queueSync);
|
Monitor.Pulse(m_queueSync);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public T Dequeue()
|
public T Dequeue()
|
||||||
{
|
{
|
||||||
lock (m_queueSync)
|
lock (m_queueSync)
|
||||||
{
|
{
|
||||||
if (m_queue.Count < 1)
|
if (m_queue.Count < 1)
|
||||||
{
|
{
|
||||||
Monitor.Wait(m_queueSync);
|
Monitor.Wait(m_queueSync);
|
||||||
}
|
}
|
||||||
|
|
||||||
return m_queue.Dequeue();
|
return m_queue.Dequeue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Contains(T item)
|
public bool Contains(T item)
|
||||||
{
|
{
|
||||||
lock (m_queueSync)
|
lock (m_queueSync)
|
||||||
{
|
{
|
||||||
return m_queue.Contains(item);
|
return m_queue.Contains(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
public int Count()
|
||||||
|
{
|
||||||
|
return m_queue.Count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,50 +1,53 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class ChildAgentDataUpdate
|
public class ChildAgentDataUpdate
|
||||||
{
|
{
|
||||||
public ChildAgentDataUpdate()
|
public ChildAgentDataUpdate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public sLLVector3 Position;
|
public sLLVector3 Position;
|
||||||
public ulong regionHandle;
|
public ulong regionHandle;
|
||||||
public float drawdistance;
|
public float drawdistance;
|
||||||
public sLLVector3 cameraPosition;
|
public sLLVector3 cameraPosition;
|
||||||
public sLLVector3 Velocity;
|
public sLLVector3 Velocity;
|
||||||
public float AVHeight;
|
public float AVHeight;
|
||||||
public Guid AgentID;
|
public Guid AgentID;
|
||||||
public float godlevel;
|
public float godlevel;
|
||||||
public byte[] throttles;
|
public byte[] throttles;
|
||||||
}
|
public bool alwaysrun;
|
||||||
}
|
public Guid ActiveGroupID;
|
||||||
|
public uint GroupAccess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,181 +1,197 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using libsecondlife;
|
using System.Collections.Generic;
|
||||||
using libsecondlife.Packets;
|
using libsecondlife;
|
||||||
|
using libsecondlife.Packets;
|
||||||
namespace OpenSim.Framework
|
|
||||||
{
|
namespace OpenSim.Framework
|
||||||
public delegate void ForEachClientDelegate(IClientAPI client);
|
{
|
||||||
|
public delegate void ForEachClientDelegate(IClientAPI client);
|
||||||
public class ClientManager
|
|
||||||
{
|
public class ClientManager
|
||||||
private Dictionary<uint, IClientAPI> m_clients;
|
{
|
||||||
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
public void ForEachClient(ForEachClientDelegate whatToDo)
|
|
||||||
{
|
private Dictionary<uint, IClientAPI> m_clients;
|
||||||
|
|
||||||
// Wasteful, I know
|
public void ForEachClient(ForEachClientDelegate whatToDo)
|
||||||
IClientAPI[] LocalClients = new IClientAPI[0];
|
{
|
||||||
lock (m_clients)
|
// Wasteful, I know
|
||||||
{
|
IClientAPI[] LocalClients = new IClientAPI[0];
|
||||||
LocalClients = new IClientAPI[m_clients.Count];
|
lock (m_clients)
|
||||||
m_clients.Values.CopyTo(LocalClients, 0);
|
{
|
||||||
}
|
LocalClients = new IClientAPI[m_clients.Count];
|
||||||
|
m_clients.Values.CopyTo(LocalClients, 0);
|
||||||
for (int i = 0; i < LocalClients.Length; i++)
|
}
|
||||||
{
|
|
||||||
try
|
for (int i = 0; i < LocalClients.Length; i++)
|
||||||
{
|
{
|
||||||
whatToDo(LocalClients[i]);
|
try
|
||||||
}
|
{
|
||||||
catch (System.Exception e)
|
whatToDo(LocalClients[i]);
|
||||||
{
|
}
|
||||||
OpenSim.Framework.Console.MainLog.Instance.Warn("CLIENT", "Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString());
|
catch (System.Exception e)
|
||||||
}
|
{
|
||||||
}
|
m_log.Warn("[CLIENT]: Unable to do ForEachClient for one of the clients" + "\n Reason: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public ClientManager()
|
}
|
||||||
{
|
|
||||||
m_clients = new Dictionary<uint, IClientAPI>();
|
public ClientManager()
|
||||||
}
|
{
|
||||||
|
m_clients = new Dictionary<uint, IClientAPI>();
|
||||||
private void Remove(uint id)
|
}
|
||||||
{
|
|
||||||
m_clients.Remove(id);
|
public void Remove(uint id)
|
||||||
}
|
{
|
||||||
|
//m_log.InfoFormat("[CLIENT]: Removing client with code {0}, current count {1}", id, m_clients.Count);
|
||||||
public void Add(uint id, IClientAPI client)
|
lock (m_clients)
|
||||||
{
|
{
|
||||||
m_clients.Add(id, client);
|
m_clients.Remove(id);
|
||||||
}
|
}
|
||||||
|
m_log.InfoFormat("[CLIENT]: Removed client with code {0}, new client count {1}", id, m_clients.Count);
|
||||||
public void InPacket(uint circuitCode, Packet packet)
|
}
|
||||||
{
|
|
||||||
IClientAPI client;
|
public void Add(uint id, IClientAPI client)
|
||||||
|
{
|
||||||
if (m_clients.TryGetValue(circuitCode, out client))
|
lock (m_clients)
|
||||||
{
|
{
|
||||||
client.InPacket(packet);
|
m_clients.Add(id, client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CloseAllAgents(uint circuitCode)
|
public void InPacket(uint circuitCode, Packet packet)
|
||||||
{
|
{
|
||||||
IClientAPI client;
|
IClientAPI client;
|
||||||
|
bool tryGetRet = false;
|
||||||
if (m_clients.TryGetValue(circuitCode, out client))
|
lock (m_clients)
|
||||||
{
|
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
|
||||||
CloseAllCircuits(client.AgentId);
|
if(tryGetRet)
|
||||||
}
|
{
|
||||||
}
|
client.InPacket(packet);
|
||||||
|
}
|
||||||
public void CloseAllCircuits(LLUUID agentId)
|
}
|
||||||
{
|
|
||||||
uint[] circuits = GetAllCircuits(agentId);
|
public void CloseAllAgents(uint circuitCode)
|
||||||
// We're using a for loop here so changes to the circuits don't cause it to completely fail.
|
{
|
||||||
|
IClientAPI client;
|
||||||
for (int i = 0; i < circuits.Length; i++)
|
bool tryGetRet = false;
|
||||||
{
|
lock (m_clients)
|
||||||
IClientAPI client;
|
tryGetRet = m_clients.TryGetValue(circuitCode, out client);
|
||||||
try
|
if (tryGetRet)
|
||||||
{
|
{
|
||||||
|
CloseAllCircuits(client.AgentId);
|
||||||
if (m_clients.TryGetValue(circuits[i], out client))
|
}
|
||||||
{
|
}
|
||||||
Remove(client.CircuitCode);
|
|
||||||
client.Close(false);
|
public void CloseAllCircuits(LLUUID agentId)
|
||||||
}
|
{
|
||||||
}
|
uint[] circuits = GetAllCircuits(agentId);
|
||||||
catch (System.Exception e)
|
// We're using a for loop here so changes to the circuits don't cause it to completely fail.
|
||||||
{
|
|
||||||
OpenSim.Framework.Console.MainLog.Instance.Error("CLIENT", string.Format("Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e));
|
for (int i = 0; i < circuits.Length; i++)
|
||||||
}
|
{
|
||||||
}
|
IClientAPI client;
|
||||||
|
try
|
||||||
|
{
|
||||||
}
|
bool tryGetRet = false;
|
||||||
|
lock (m_clients)
|
||||||
private uint[] GetAllCircuits(LLUUID agentId)
|
tryGetRet = m_clients.TryGetValue(circuits[i], out client);
|
||||||
{
|
if(tryGetRet)
|
||||||
List<uint> circuits = new List<uint>();
|
{
|
||||||
// Wasteful, I know
|
Remove(client.CircuitCode);
|
||||||
IClientAPI[] LocalClients = new IClientAPI[0];
|
client.Close(false);
|
||||||
lock (m_clients)
|
}
|
||||||
{
|
}
|
||||||
LocalClients = new IClientAPI[m_clients.Count];
|
catch (System.Exception e)
|
||||||
m_clients.Values.CopyTo(LocalClients, 0);
|
{
|
||||||
}
|
m_log.Error(string.Format("[CLIENT]: Unable to shutdown circuit for: {0}\n Reason: {1}", agentId, e));
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int i = 0; i < LocalClients.Length; i++ )
|
}
|
||||||
{
|
|
||||||
if (LocalClients[i].AgentId == agentId)
|
private uint[] GetAllCircuits(LLUUID agentId)
|
||||||
{
|
{
|
||||||
circuits.Add(LocalClients[i].CircuitCode);
|
List<uint> circuits = new List<uint>();
|
||||||
}
|
// Wasteful, I know
|
||||||
}
|
IClientAPI[] LocalClients = new IClientAPI[0];
|
||||||
return circuits.ToArray();
|
lock (m_clients)
|
||||||
}
|
{
|
||||||
|
LocalClients = new IClientAPI[m_clients.Count];
|
||||||
|
m_clients.Values.CopyTo(LocalClients, 0);
|
||||||
public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
|
}
|
||||||
{
|
|
||||||
ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
|
for (int i = 0; i < LocalClients.Length; i++ )
|
||||||
// TODO: don't create new blocks if recycling an old packet
|
{
|
||||||
packet.Effect = effectBlock;
|
if (LocalClients[i].AgentId == agentId)
|
||||||
|
{
|
||||||
// Wasteful, I know
|
circuits.Add(LocalClients[i].CircuitCode);
|
||||||
IClientAPI[] LocalClients = new IClientAPI[0];
|
}
|
||||||
lock (m_clients)
|
}
|
||||||
{
|
return circuits.ToArray();
|
||||||
LocalClients = new IClientAPI[m_clients.Count];
|
}
|
||||||
m_clients.Values.CopyTo(LocalClients, 0);
|
|
||||||
}
|
|
||||||
|
public void ViewerEffectHandler(IClientAPI sender, ViewerEffectPacket.EffectBlock[] effectBlock)
|
||||||
|
{
|
||||||
for (int i = 0; i < LocalClients.Length; i++)
|
ViewerEffectPacket packet = (ViewerEffectPacket) PacketPool.Instance.GetPacket(PacketType.ViewerEffect);
|
||||||
{
|
// TODO: don't create new blocks if recycling an old packet
|
||||||
if (LocalClients[i].AgentId != sender.AgentId)
|
packet.Effect = effectBlock;
|
||||||
{
|
|
||||||
packet.AgentData.AgentID = LocalClients[i].AgentId;
|
// Wasteful, I know
|
||||||
packet.AgentData.SessionID = LocalClients[i].SessionId;
|
IClientAPI[] LocalClients = new IClientAPI[0];
|
||||||
LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task);
|
lock (m_clients)
|
||||||
}
|
{
|
||||||
|
LocalClients = new IClientAPI[m_clients.Count];
|
||||||
}
|
m_clients.Values.CopyTo(LocalClients, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryGetClient(uint circuitId, out IClientAPI user)
|
for (int i = 0; i < LocalClients.Length; i++)
|
||||||
{
|
{
|
||||||
return m_clients.TryGetValue(circuitId, out user);
|
if (LocalClients[i].AgentId != sender.AgentId)
|
||||||
}
|
{
|
||||||
}
|
packet.AgentData.AgentID = LocalClients[i].AgentId;
|
||||||
}
|
packet.AgentData.SessionID = LocalClients[i].SessionId;
|
||||||
|
packet.Header.Reliable = false;
|
||||||
|
LocalClients[i].OutPacket(packet, ThrottleOutPacketType.Task);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TryGetClient(uint circuitId, out IClientAPI user)
|
||||||
|
{
|
||||||
|
lock (m_clients)
|
||||||
|
{
|
||||||
|
return m_clients.TryGetValue(circuitId, out user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,54 +1,54 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
public class CAPSService
|
public class CAPSService
|
||||||
{
|
{
|
||||||
private BaseHttpServer m_server;
|
private readonly BaseHttpServer m_server;
|
||||||
|
|
||||||
public CAPSService(BaseHttpServer httpServer)
|
public CAPSService(BaseHttpServer httpServer)
|
||||||
{
|
{
|
||||||
m_server = httpServer;
|
m_server = httpServer;
|
||||||
AddCapsSeedHandler("/CapsSeed/", CapsRequest);
|
AddCapsSeedHandler("/CapsSeed/", CapsRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddCapsSeedHandler(string path, RestMethod restMethod)
|
private void AddCapsSeedHandler(string path, RestMethod restMethod)
|
||||||
{
|
{
|
||||||
m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
|
m_server.AddStreamHandler(new RestStreamHandler("POST", path, restMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CapsRequest(string request, string path, string param)
|
public string CapsRequest(string request, string path, string param)
|
||||||
{
|
{
|
||||||
System.Console.WriteLine("new caps request " + request + " from path " + path);
|
System.Console.WriteLine("new caps request " + request + " from path " + path);
|
||||||
return "";
|
return System.String.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,206 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//moved to a module, left here until the module is found to have no problems
|
||||||
|
/*
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Provider handlers for processing asset transactions originating from the agent. This encompasses
|
||||||
|
/// clothing creation and update as well as asset uploads.
|
||||||
|
/// </summary>
|
||||||
|
public class AgentAssetTransactionsManager
|
||||||
|
{
|
||||||
|
private static readonly log4net.ILog m_log
|
||||||
|
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
|
// Fields
|
||||||
|
public CommunicationsManager CommsManager;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Each agent has its own singleton collection of transactions
|
||||||
|
/// </summary>
|
||||||
|
private Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
|
||||||
|
new Dictionary<LLUUID, AgentAssetTransactions>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should we dump uploaded assets to the filesystem?
|
||||||
|
/// </summary>
|
||||||
|
private bool m_dumpAssetsToFile;
|
||||||
|
|
||||||
|
public AgentAssetTransactionsManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
|
||||||
|
{
|
||||||
|
CommsManager = commsManager;
|
||||||
|
m_dumpAssetsToFile = dumpAssetsToFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the collection of asset transactions for the given user. If one does not already exist, it
|
||||||
|
/// is created.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private AgentAssetTransactions GetUserTransactions(LLUUID userID)
|
||||||
|
{
|
||||||
|
lock (AgentTransactions)
|
||||||
|
{
|
||||||
|
if (!AgentTransactions.ContainsKey(userID))
|
||||||
|
{
|
||||||
|
AgentAssetTransactions transactions
|
||||||
|
= new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
|
||||||
|
AgentTransactions.Add(userID, transactions);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AgentTransactions[userID];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Remove the given agent asset transactions. This should be called when a client is departing
|
||||||
|
/// from a scene (and hence won't be making any more transactions here).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
public void RemoveAgentAssetTransactions(LLUUID userID)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat("Removing agent asset transactions structure for agent {0}", userID);
|
||||||
|
|
||||||
|
lock (AgentTransactions)
|
||||||
|
{
|
||||||
|
AgentTransactions.Remove(userID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create an inventory item from data that has been received through a transaction.
|
||||||
|
///
|
||||||
|
/// This is called when new clothing or body parts are created. It may also be called in other
|
||||||
|
/// situations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="transactionID"></param>
|
||||||
|
/// <param name="folderID"></param>
|
||||||
|
/// <param name="callbackID"></param>
|
||||||
|
/// <param name="description"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="invType"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="wearableType"></param>
|
||||||
|
/// <param name="nextOwnerMask"></param>
|
||||||
|
public void HandleItemCreationFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
|
||||||
|
uint callbackID, string description, string name, sbyte invType,
|
||||||
|
sbyte type, byte wearableType, uint nextOwnerMask)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[TRANSACTIONS MANAGER] Called HandleItemCreationFromTransaction with item {0}", name);
|
||||||
|
|
||||||
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
transactions.RequestCreateInventoryItem(
|
||||||
|
remoteClient, transactionID, folderID, callbackID, description,
|
||||||
|
name, invType, type, wearableType, nextOwnerMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update an inventory item with data that has been received through a transaction.
|
||||||
|
///
|
||||||
|
/// This is called when clothing or body parts are updated (for instance, with new textures or
|
||||||
|
/// colours). It may also be called in other situations.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="transactionID"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
public void HandleItemUpdateFromTransaction(IClientAPI remoteClient, LLUUID transactionID,
|
||||||
|
InventoryItemBase item)
|
||||||
|
{
|
||||||
|
m_log.DebugFormat(
|
||||||
|
"[TRANSACTIONS MANAGER] Called HandleItemUpdateFromTransaction with item {0}",
|
||||||
|
item.inventoryName);
|
||||||
|
|
||||||
|
AgentAssetTransactions transactions
|
||||||
|
= CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
transactions.RequestUpdateInventoryItem(remoteClient, transactionID, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request that a client (agent) begin an asset transfer.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="assetID"></param>
|
||||||
|
/// <param name="transaction"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
|
/// <param name="data"></param></param>
|
||||||
|
/// <param name="tempFile"></param>
|
||||||
|
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
|
||||||
|
byte[] data, bool storeLocal, bool tempFile)
|
||||||
|
{
|
||||||
|
// Console.WriteLine("asset upload of " + assetID);
|
||||||
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
||||||
|
if (uploader != null)
|
||||||
|
{
|
||||||
|
// Upload has already compelted uploading...
|
||||||
|
|
||||||
|
if (uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile))
|
||||||
|
{
|
||||||
|
//[commenting out as this removal breaks uploads]
|
||||||
|
/*lock (transactions.XferUploaders)
|
||||||
|
{
|
||||||
|
|
||||||
|
// XXX Weak ass way of doing this by directly manipulating this public dictionary, purely temporary
|
||||||
|
transactions.XferUploaders.Remove(uploader.TransactionID);
|
||||||
|
|
||||||
|
//m_log.InfoFormat("[ASSET TRANSACTIONS] Current uploaders: {0}", transactions.XferUploaders.Count);
|
||||||
|
}*/
|
||||||
|
/* }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Handle asset transfer data packets received in response to the asset upload request in
|
||||||
|
/// HandleUDPUploadRequest()
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="remoteClient"></param>
|
||||||
|
/// <param name="xferID"></param>
|
||||||
|
/// <param name="packetID"></param>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
||||||
|
{
|
||||||
|
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
|
||||||
|
|
||||||
|
transactions.HandleXfer(xferID, packetID, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
File diff suppressed because it is too large
Load Diff
|
@ -1,234 +1,236 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Db4objects.Db4o;
|
using Db4objects.Db4o;
|
||||||
using Db4objects.Db4o.Query;
|
using Db4objects.Db4o.Query;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
public class LocalAssetServer : AssetServerBase
|
public class LocalAssetServer : AssetServerBase
|
||||||
{
|
{
|
||||||
private IObjectContainer db;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public LocalAssetServer()
|
private IObjectContainer db;
|
||||||
{
|
|
||||||
bool yapfile;
|
public LocalAssetServer()
|
||||||
yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
|
{
|
||||||
|
bool yapfile;
|
||||||
db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
|
yapfile = File.Exists(Path.Combine(Util.dataDir(), "regionassets.yap"));
|
||||||
MainLog.Instance.Verbose("ASSETS", "Db4 Asset database creation");
|
|
||||||
|
db = Db4oFactory.OpenFile(Path.Combine(Util.dataDir(), "regionassets.yap"));
|
||||||
if (!yapfile)
|
m_log.Info("[ASSETS]: Db4 Asset database creation");
|
||||||
{
|
|
||||||
SetUpAssetDatabase();
|
if (!yapfile)
|
||||||
}
|
{
|
||||||
}
|
SetUpAssetDatabase();
|
||||||
|
}
|
||||||
public void CreateAndCommitAsset(AssetBase asset)
|
}
|
||||||
{
|
|
||||||
AssetStorage store = new AssetStorage();
|
public void CreateAndCommitAsset(AssetBase asset)
|
||||||
store.Data = asset.Data;
|
{
|
||||||
store.Name = asset.Name;
|
AssetStorage store = new AssetStorage();
|
||||||
store.UUID = asset.FullID;
|
store.Data = asset.Data;
|
||||||
db.Set(store);
|
store.Name = asset.Name;
|
||||||
db.Commit();
|
store.UUID = asset.FullID;
|
||||||
}
|
db.Set(store);
|
||||||
|
db.Commit();
|
||||||
public override void Close()
|
}
|
||||||
{
|
|
||||||
base.Close();
|
public override void Close()
|
||||||
|
{
|
||||||
if (db != null)
|
base.Close();
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose("ASSETSERVER", "Closing local asset server database");
|
if (db != null)
|
||||||
db.Close();
|
{
|
||||||
}
|
m_log.Info("[ASSETSERVER]: Closing local asset server database");
|
||||||
}
|
db.Close();
|
||||||
|
}
|
||||||
// rex new function for "replace assets" functionality
|
}
|
||||||
public override LLUUID ExistsAsset(sbyte assetType, string name)
|
|
||||||
{
|
// rex new function for "replace assets" functionality
|
||||||
IObjectSet result = db.Query(new AssetTypeNameQuery(assetType, name));
|
public override LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
AssetStorage foundAsset = null;
|
{
|
||||||
if (result.Count > 0)
|
IObjectSet result = db.Query(new AssetTypeNameQuery(assetType, name));
|
||||||
{
|
AssetStorage foundAsset = null;
|
||||||
foundAsset = (AssetStorage)result.Next();
|
if (result.Count > 0)
|
||||||
return foundAsset.UUID;
|
{
|
||||||
}
|
foundAsset = (AssetStorage)result.Next();
|
||||||
return LLUUID.Zero;
|
return foundAsset.UUID;
|
||||||
}
|
}
|
||||||
|
return LLUUID.Zero;
|
||||||
// rex new function
|
}
|
||||||
public override bool ExistsAsset(LLUUID assetID)
|
|
||||||
{
|
// rex new function
|
||||||
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
public override bool ExistsAsset(LLUUID assetID)
|
||||||
if (result.Count > 0)
|
{
|
||||||
return true;
|
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
||||||
else
|
if (result.Count > 0)
|
||||||
return false;
|
return true;
|
||||||
}
|
else
|
||||||
|
return false;
|
||||||
// rex new function
|
}
|
||||||
public override AssetBase FetchAsset(LLUUID assetID)
|
|
||||||
{
|
// rex new function
|
||||||
byte[] idata = null;
|
public override AssetBase FetchAsset(LLUUID assetID)
|
||||||
bool found = false;
|
{
|
||||||
AssetStorage foundAsset = null;
|
byte[] idata = null;
|
||||||
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
bool found = false;
|
||||||
if (result.Count > 0)
|
AssetStorage foundAsset = null;
|
||||||
{
|
IObjectSet result = db.Query(new AssetUUIDQuery(assetID));
|
||||||
foundAsset = (AssetStorage)result.Next();
|
if (result.Count > 0)
|
||||||
found = true;
|
{
|
||||||
}
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
found = true;
|
||||||
AssetBase asset = new AssetBase();
|
}
|
||||||
if (found)
|
|
||||||
{
|
AssetBase asset = new AssetBase();
|
||||||
asset.FullID = foundAsset.UUID;
|
if (found)
|
||||||
asset.Type = foundAsset.Type;
|
{
|
||||||
asset.InvType = foundAsset.Type;
|
asset.FullID = foundAsset.UUID;
|
||||||
asset.Name = foundAsset.Name;
|
asset.Type = foundAsset.Type;
|
||||||
idata = foundAsset.Data;
|
asset.InvType = foundAsset.Type;
|
||||||
asset.Data = idata;
|
asset.Name = foundAsset.Name;
|
||||||
|
idata = foundAsset.Data;
|
||||||
return asset;
|
asset.Data = idata;
|
||||||
}
|
|
||||||
else
|
return asset;
|
||||||
{
|
}
|
||||||
return null;
|
else
|
||||||
}
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
protected override AssetBase GetAsset(AssetRequest req)
|
}
|
||||||
{
|
|
||||||
byte[] idata = null;
|
protected override AssetBase GetAsset(AssetRequest req)
|
||||||
bool found = false;
|
{
|
||||||
AssetStorage foundAsset = null;
|
byte[] idata = null;
|
||||||
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
|
bool found = false;
|
||||||
if (result.Count > 0)
|
AssetStorage foundAsset = null;
|
||||||
{
|
IObjectSet result = db.Query(new AssetUUIDQuery(req.AssetID));
|
||||||
foundAsset = (AssetStorage) result.Next();
|
if (result.Count > 0)
|
||||||
found = true;
|
{
|
||||||
}
|
foundAsset = (AssetStorage) result.Next();
|
||||||
|
found = true;
|
||||||
AssetBase asset = new AssetBase();
|
}
|
||||||
if (found)
|
|
||||||
{
|
AssetBase asset = new AssetBase();
|
||||||
asset.FullID = foundAsset.UUID;
|
if (found)
|
||||||
asset.Type = foundAsset.Type;
|
{
|
||||||
asset.InvType = foundAsset.Type;
|
asset.FullID = foundAsset.UUID;
|
||||||
asset.Name = foundAsset.Name;
|
asset.Type = foundAsset.Type;
|
||||||
idata = foundAsset.Data;
|
asset.InvType = foundAsset.Type;
|
||||||
asset.Data = idata;
|
asset.Name = foundAsset.Name;
|
||||||
|
idata = foundAsset.Data;
|
||||||
return asset;
|
asset.Data = idata;
|
||||||
}
|
|
||||||
else
|
return asset;
|
||||||
{
|
}
|
||||||
return null;
|
else
|
||||||
}
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
protected override void StoreAsset(AssetBase asset)
|
}
|
||||||
{
|
|
||||||
AssetStorage store = new AssetStorage();
|
protected override void StoreAsset(AssetBase asset)
|
||||||
store.Data = asset.Data;
|
{
|
||||||
store.Name = asset.Name;
|
AssetStorage store = new AssetStorage();
|
||||||
store.UUID = asset.FullID;
|
store.Data = asset.Data;
|
||||||
db.Set(store);
|
store.Name = asset.Name;
|
||||||
|
store.UUID = asset.FullID;
|
||||||
CommitAssets();
|
db.Set(store);
|
||||||
}
|
|
||||||
|
CommitAssets();
|
||||||
// rex overrided function for "replace assets" functionality to work with local assetserver
|
}
|
||||||
public override void UpdateAsset(AssetBase asset)
|
|
||||||
{
|
// rex overrided function for "replace assets" functionality to work with local assetserver
|
||||||
lock (m_syncLock)
|
public override void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
IObjectSet result = db.Query(new AssetUUIDQuery(asset.FullID));
|
lock (m_syncLock)
|
||||||
AssetStorage foundAsset = null;
|
{
|
||||||
|
IObjectSet result = db.Query(new AssetUUIDQuery(asset.FullID));
|
||||||
int i;
|
AssetStorage foundAsset = null;
|
||||||
for (i = 0; i < result.Count; i++)
|
|
||||||
{
|
int i;
|
||||||
foundAsset = (AssetStorage)result.Next();
|
for (i = 0; i < result.Count; i++)
|
||||||
db.Delete(foundAsset);
|
{
|
||||||
}
|
foundAsset = (AssetStorage)result.Next();
|
||||||
|
db.Delete(foundAsset);
|
||||||
StoreAsset(asset);
|
}
|
||||||
}
|
|
||||||
}
|
StoreAsset(asset);
|
||||||
|
}
|
||||||
protected override void CommitAssets()
|
}
|
||||||
{
|
|
||||||
db.Commit();
|
protected override void CommitAssets()
|
||||||
}
|
{
|
||||||
|
db.Commit();
|
||||||
protected virtual void SetUpAssetDatabase()
|
}
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose("LOCAL ASSET SERVER", "Setting up asset database");
|
protected virtual void SetUpAssetDatabase()
|
||||||
|
{
|
||||||
base.LoadDefaultAssets();
|
m_log.Info("[LOCAL ASSET SERVER]: Setting up asset database");
|
||||||
}
|
|
||||||
}
|
base.LoadDefaultAssets();
|
||||||
|
}
|
||||||
public class AssetUUIDQuery : Predicate
|
}
|
||||||
{
|
|
||||||
private LLUUID _findID;
|
public class AssetUUIDQuery : Predicate
|
||||||
|
{
|
||||||
public AssetUUIDQuery(LLUUID find)
|
private LLUUID _findID;
|
||||||
{
|
|
||||||
_findID = find;
|
public AssetUUIDQuery(LLUUID find)
|
||||||
}
|
{
|
||||||
|
_findID = find;
|
||||||
public bool Match(AssetStorage asset)
|
}
|
||||||
{
|
|
||||||
return (asset.UUID == _findID);
|
public bool Match(AssetStorage asset)
|
||||||
}
|
{
|
||||||
}
|
return (asset.UUID == _findID);
|
||||||
|
}
|
||||||
// rex new class for "replace assets" functionality
|
}
|
||||||
public class AssetTypeNameQuery : Predicate
|
|
||||||
{
|
// rex new class for "replace assets" functionality
|
||||||
private sbyte _findType;
|
public class AssetTypeNameQuery : Predicate
|
||||||
private string _findName;
|
{
|
||||||
|
private sbyte _findType;
|
||||||
public AssetTypeNameQuery(sbyte type, string name)
|
private string _findName;
|
||||||
{
|
|
||||||
_findType = type;
|
public AssetTypeNameQuery(sbyte type, string name)
|
||||||
_findName = name;
|
{
|
||||||
}
|
_findType = type;
|
||||||
|
_findName = name;
|
||||||
public bool Match(AssetStorage asset)
|
}
|
||||||
{
|
|
||||||
return ((asset.Type == _findType) && (asset.Name == _findName));
|
public bool Match(AssetStorage asset)
|
||||||
}
|
{
|
||||||
}
|
return ((asset.Type == _findType) && (asset.Name == _findName));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,193 +1,201 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.AssetLoader.Filesystem;
|
using OpenSim.Framework.AssetLoader.Filesystem;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
public abstract class AssetServerBase : IAssetServer
|
public abstract class AssetServerBase : IAssetServer
|
||||||
{
|
{
|
||||||
protected IAssetReceiver m_receiver;
|
private static readonly log4net.ILog m_log
|
||||||
protected BlockingQueue<AssetRequest> m_assetRequests;
|
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
protected Thread m_localAssetServerThread;
|
|
||||||
protected IAssetProvider m_assetProvider;
|
protected IAssetReceiver m_receiver;
|
||||||
protected object m_syncLock = new object();
|
protected BlockingQueue<AssetRequest> m_assetRequests;
|
||||||
|
protected Thread m_localAssetServerThread;
|
||||||
// Temporarily hardcoded - should be a plugin
|
protected IAssetProvider m_assetProvider;
|
||||||
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
|
protected object m_syncLock = new object();
|
||||||
|
|
||||||
protected abstract void StoreAsset(AssetBase asset);
|
// Temporarily hardcoded - should be a plugin
|
||||||
protected abstract void CommitAssets();
|
protected IAssetLoader assetLoader = new AssetLoaderFileSystem();
|
||||||
|
|
||||||
public abstract LLUUID ExistsAsset(sbyte assetType, string name); // rex new function for "replace assets" functionality
|
protected abstract void StoreAsset(AssetBase asset);
|
||||||
|
protected abstract void CommitAssets();
|
||||||
/// <summary>
|
|
||||||
/// This method must be implemented by a subclass to retrieve the asset named in the
|
public abstract LLUUID ExistsAsset(sbyte assetType, string name); // rex new function for "replace assets" functionality
|
||||||
/// AssetRequest. If the asset is not found, null should be returned.
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="req"></param>
|
/// This method must be implemented by a subclass to retrieve the asset named in the
|
||||||
/// <returns></returns>
|
/// AssetRequest. If the asset is not found, null should be returned.
|
||||||
protected abstract AssetBase GetAsset(AssetRequest req);
|
/// </summary>
|
||||||
|
/// <param name="req"></param>
|
||||||
/// <summary>
|
/// <returns></returns>
|
||||||
/// Process an asset request. This method will call GetAsset(AssetRequest req)
|
protected abstract AssetBase GetAsset(AssetRequest req);
|
||||||
/// on the subclass.
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="req"></param>
|
/// Process an asset request. This method will call GetAsset(AssetRequest req)
|
||||||
protected virtual void ProcessRequest(AssetRequest req)
|
/// on the subclass.
|
||||||
{
|
/// </summary>
|
||||||
AssetBase asset = GetAsset(req);
|
/// <param name="req"></param>
|
||||||
|
protected virtual void ProcessRequest(AssetRequest req)
|
||||||
if (asset != null)
|
{
|
||||||
{
|
AssetBase asset = GetAsset(req);
|
||||||
MainLog.Instance.Verbose(
|
|
||||||
"ASSET", "Asset {0} received from asset server", req.AssetID);
|
if (asset != null)
|
||||||
|
{
|
||||||
m_receiver.AssetReceived(asset, req.IsTexture);
|
//m_log.InfoFormat("[ASSETSERVER]: Asset {0} received from asset server", req.AssetID);
|
||||||
}
|
|
||||||
else
|
m_receiver.AssetReceived(asset, req.IsTexture);
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(
|
else
|
||||||
"ASSET", "Asset {0} not found by asset server", req.AssetID);
|
{
|
||||||
|
m_log.ErrorFormat("[ASSET SERVER]: Asset {0} not found by asset server", req.AssetID);
|
||||||
m_receiver.AssetNotFound(req.AssetID);
|
|
||||||
}
|
m_receiver.AssetNotFound(req.AssetID);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public virtual void LoadDefaultAssets()
|
|
||||||
{
|
public virtual void LoadDefaultAssets()
|
||||||
MainLog.Instance.Verbose("ASSETSERVER", "Setting up asset database");
|
{
|
||||||
|
m_log.Info("[ASSET SERVER]: Setting up asset database");
|
||||||
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
|
||||||
|
assetLoader.ForEachDefaultXmlAsset(StoreAsset);
|
||||||
CommitAssets();
|
|
||||||
}
|
CommitAssets();
|
||||||
|
}
|
||||||
|
|
||||||
public AssetServerBase()
|
public AssetServerBase()
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("ASSETSERVER", "Starting asset storage system");
|
m_log.Info("[ASSET SERVER]: Starting asset storage system");
|
||||||
m_assetRequests = new BlockingQueue<AssetRequest>();
|
m_assetRequests = new BlockingQueue<AssetRequest>();
|
||||||
|
|
||||||
m_localAssetServerThread = new Thread(RunRequests);
|
m_localAssetServerThread = new Thread(RunRequests);
|
||||||
m_localAssetServerThread.IsBackground = true;
|
m_localAssetServerThread.Name = "LocalAssetServerThread";
|
||||||
m_localAssetServerThread.Start();
|
m_localAssetServerThread.IsBackground = true;
|
||||||
}
|
m_localAssetServerThread.Start();
|
||||||
|
OpenSim.Framework.ThreadTracker.Add(m_localAssetServerThread);
|
||||||
private void RunRequests()
|
}
|
||||||
{
|
|
||||||
while (true) // Since it's a 'blocking queue'
|
private void RunRequests()
|
||||||
{
|
{
|
||||||
try
|
while (true) // Since it's a 'blocking queue'
|
||||||
{
|
{
|
||||||
AssetRequest req = m_assetRequests.Dequeue();
|
try
|
||||||
|
{
|
||||||
ProcessRequest(req);
|
AssetRequest req = m_assetRequests.Dequeue();
|
||||||
}
|
|
||||||
catch (Exception e)
|
ProcessRequest(req);
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error("ASSETSERVER", e.Message);
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
}
|
m_log.Error("[ASSET SERVER]: " + e.ToString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void SetReceiver(IAssetReceiver receiver)
|
}
|
||||||
{
|
|
||||||
m_receiver = receiver;
|
/// <summary>
|
||||||
}
|
/// The receiver will be called back with asset data once it comes in.
|
||||||
|
/// </summary>
|
||||||
public void RequestAsset(LLUUID assetID, bool isTexture)
|
/// <param name="receiver"></param>
|
||||||
{
|
public void SetReceiver(IAssetReceiver receiver)
|
||||||
AssetRequest req = new AssetRequest();
|
{
|
||||||
req.AssetID = assetID;
|
m_receiver = receiver;
|
||||||
req.IsTexture = isTexture;
|
}
|
||||||
m_assetRequests.Enqueue(req);
|
|
||||||
|
public void RequestAsset(LLUUID assetID, bool isTexture)
|
||||||
MainLog.Instance.Verbose("ASSET", "Added {0} to request queue", assetID);
|
{
|
||||||
}
|
AssetRequest req = new AssetRequest();
|
||||||
|
req.AssetID = assetID;
|
||||||
public virtual void UpdateAsset(AssetBase asset)
|
req.IsTexture = isTexture;
|
||||||
{
|
m_assetRequests.Enqueue(req);
|
||||||
lock (m_syncLock)
|
|
||||||
{
|
#if DEBUG
|
||||||
m_assetProvider.UpdateAsset(asset);
|
m_log.InfoFormat("[ASSET SERVER]: Added {0} to request queue", assetID);
|
||||||
m_assetProvider.CommitAssets();
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public virtual void UpdateAsset(AssetBase asset)
|
||||||
public void StoreAndCommitAsset(AssetBase asset)
|
{
|
||||||
{
|
lock (m_syncLock)
|
||||||
lock (m_syncLock)
|
{
|
||||||
{
|
m_assetProvider.UpdateAsset(asset);
|
||||||
StoreAsset(asset);
|
m_assetProvider.CommitAssets();
|
||||||
CommitAssets();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
public void StoreAndCommitAsset(AssetBase asset)
|
||||||
// rex, new function
|
{
|
||||||
public List<AssetBase> GetAssetList(int vAssetType)
|
lock (m_syncLock)
|
||||||
{
|
{
|
||||||
lock (m_syncLock)
|
StoreAsset(asset);
|
||||||
{
|
CommitAssets();
|
||||||
return m_assetProvider.GetAssetList(vAssetType);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// rex, new function
|
||||||
// rex, new function
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
public virtual AssetBase FetchAsset(LLUUID assetID)
|
{
|
||||||
{
|
lock (m_syncLock)
|
||||||
lock (m_syncLock)
|
{
|
||||||
{
|
return m_assetProvider.GetAssetList(vAssetType);
|
||||||
return m_assetProvider.FetchAsset(assetID);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// rex, new function
|
||||||
// rex, new function
|
public virtual AssetBase FetchAsset(LLUUID assetID)
|
||||||
public virtual bool ExistsAsset(LLUUID assetID)
|
{
|
||||||
{
|
lock (m_syncLock)
|
||||||
lock (m_syncLock)
|
{
|
||||||
{
|
return m_assetProvider.FetchAsset(assetID);
|
||||||
return m_assetProvider.ExistsAsset(assetID);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// rex, new function
|
||||||
public virtual void Close()
|
public virtual bool ExistsAsset(LLUUID assetID)
|
||||||
{
|
{
|
||||||
m_localAssetServerThread.Abort();
|
lock (m_syncLock)
|
||||||
}
|
{
|
||||||
|
return m_assetProvider.ExistsAsset(assetID);
|
||||||
public void SetServerInfo(string ServerUrl, string ServerKey)
|
}
|
||||||
{
|
}
|
||||||
}
|
|
||||||
}
|
public virtual void Close()
|
||||||
}
|
{
|
||||||
|
m_localAssetServerThread.Abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetServerInfo(string ServerUrl, string ServerKey)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,109 +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 OpenSim 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 libsecondlife;
|
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
|
||||||
{
|
|
||||||
public class AssetTransactionManager
|
|
||||||
{
|
|
||||||
// Fields
|
|
||||||
public CommunicationsManager CommsManager;
|
|
||||||
|
|
||||||
public Dictionary<LLUUID, AgentAssetTransactions> AgentTransactions =
|
|
||||||
new Dictionary<LLUUID, AgentAssetTransactions>();
|
|
||||||
|
|
||||||
private bool m_dumpAssetsToFile;
|
|
||||||
|
|
||||||
public AssetTransactionManager(CommunicationsManager commsManager, bool dumpAssetsToFile)
|
|
||||||
{
|
|
||||||
CommsManager = commsManager;
|
|
||||||
m_dumpAssetsToFile = dumpAssetsToFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods
|
|
||||||
public AgentAssetTransactions AddUser(LLUUID userID)
|
|
||||||
{
|
|
||||||
lock (AgentTransactions)
|
|
||||||
{
|
|
||||||
if (!AgentTransactions.ContainsKey(userID))
|
|
||||||
{
|
|
||||||
AgentAssetTransactions transactions = new AgentAssetTransactions(userID, this, m_dumpAssetsToFile);
|
|
||||||
AgentTransactions.Add(userID, transactions);
|
|
||||||
return transactions;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AgentAssetTransactions GetUserTransActions(LLUUID userID)
|
|
||||||
{
|
|
||||||
if (AgentTransactions.ContainsKey(userID))
|
|
||||||
{
|
|
||||||
return AgentTransactions[userID];
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
|
|
||||||
uint callbackID, string description, string name, sbyte invType,
|
|
||||||
sbyte type, byte wearableType, uint nextOwnerMask)
|
|
||||||
{
|
|
||||||
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
|
|
||||||
if (transactions != null)
|
|
||||||
{
|
|
||||||
transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
|
|
||||||
name, invType, type, wearableType, nextOwnerMask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
|
|
||||||
byte[] data, bool storeLocal, bool tempFile)
|
|
||||||
{
|
|
||||||
// Console.WriteLine("asset upload of " + assetID);
|
|
||||||
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
|
|
||||||
if (transactions != null)
|
|
||||||
{
|
|
||||||
AgentAssetTransactions.AssetXferUploader uploader = transactions.RequestXferUploader(transaction);
|
|
||||||
if (uploader != null)
|
|
||||||
{
|
|
||||||
uploader.Initialise(remoteClient, assetID, transaction, type, data, storeLocal, tempFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleXfer(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
|
|
||||||
{
|
|
||||||
AgentAssetTransactions transactions = GetUserTransActions(remoteClient.AgentId);
|
|
||||||
if (transactions != null)
|
|
||||||
{
|
|
||||||
transactions.HandleXfer(xferID, packetID, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,128 +1,134 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
public class GridAssetClient : AssetServerBase
|
public class GridAssetClient : AssetServerBase
|
||||||
{
|
{
|
||||||
private string _assetServerUrl;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public GridAssetClient(string serverUrl)
|
private string _assetServerUrl;
|
||||||
{
|
|
||||||
_assetServerUrl = serverUrl;
|
public GridAssetClient(string serverUrl)
|
||||||
}
|
{
|
||||||
|
_assetServerUrl = serverUrl;
|
||||||
#region IAssetServer Members
|
}
|
||||||
|
|
||||||
protected override AssetBase GetAsset(AssetRequest req)
|
#region IAssetServer Members
|
||||||
{
|
|
||||||
Stream s = null;
|
protected override AssetBase GetAsset(AssetRequest req)
|
||||||
try
|
{
|
||||||
{
|
Stream s = null;
|
||||||
MainLog.Instance.Debug("ASSETCACHE", "Querying for {0}", req.AssetID.ToString());
|
try
|
||||||
|
{
|
||||||
RestClient rc = new RestClient(_assetServerUrl);
|
#if DEBUG
|
||||||
rc.AddResourcePath("assets");
|
//m_log.DebugFormat("[GRID ASSET CLIENT]: Querying for {0}", req.AssetID.ToString());
|
||||||
rc.AddResourcePath(req.AssetID.ToString());
|
#endif
|
||||||
if (req.IsTexture)
|
|
||||||
rc.AddQueryParameter("texture");
|
RestClient rc = new RestClient(_assetServerUrl);
|
||||||
|
rc.AddResourcePath("assets");
|
||||||
rc.RequestMethod = "GET";
|
rc.AddResourcePath(req.AssetID.ToString());
|
||||||
s = rc.Request();
|
if (req.IsTexture)
|
||||||
|
rc.AddQueryParameter("texture");
|
||||||
if (s.Length > 0)
|
|
||||||
{
|
rc.RequestMethod = "GET";
|
||||||
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
s = rc.Request();
|
||||||
|
|
||||||
return (AssetBase) xs.Deserialize(s);
|
if (s.Length > 0)
|
||||||
}
|
{
|
||||||
}
|
XmlSerializer xs = new XmlSerializer(typeof (AssetBase));
|
||||||
catch (Exception e)
|
|
||||||
{
|
return (AssetBase) xs.Deserialize(s);
|
||||||
MainLog.Instance.Error("ASSETCACHE", e.Message);
|
}
|
||||||
MainLog.Instance.Debug("ASSETCACHE", "Getting asset {0}", req.AssetID.ToString());
|
}
|
||||||
MainLog.Instance.Error("ASSETCACHE", e.StackTrace);
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
|
m_log.Error("[GRID ASSET CLIENT]: " + e.Message);
|
||||||
return null;
|
m_log.DebugFormat("[GRID ASSET CLIENT]: Getting asset {0}", req.AssetID.ToString());
|
||||||
}
|
m_log.Error("[GRID ASSET CLIENT]: " + e.StackTrace);
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateAsset(AssetBase asset)
|
return null;
|
||||||
{
|
}
|
||||||
throw new Exception("The method or operation is not implemented.");
|
|
||||||
}
|
|
||||||
|
public override void UpdateAsset(AssetBase asset)
|
||||||
protected override void StoreAsset(AssetBase asset)
|
{
|
||||||
{
|
throw new Exception("The method or operation is not implemented.");
|
||||||
try
|
}
|
||||||
{
|
|
||||||
// MemoryStream s = new MemoryStream();
|
protected override void StoreAsset(AssetBase asset)
|
||||||
|
{
|
||||||
// XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
try
|
||||||
// xs.Serialize(s, asset);
|
{
|
||||||
// RestClient rc = new RestClient(_assetServerUrl);
|
// MemoryStream s = new MemoryStream();
|
||||||
MainLog.Instance.Verbose("ASSET", "Storing asset");
|
|
||||||
//rc.AddResourcePath("assets");
|
// XmlSerializer xs = new XmlSerializer(typeof(AssetBase));
|
||||||
// rc.RequestMethod = "POST";
|
// xs.Serialize(s, asset);
|
||||||
// rc.Request(s);
|
// RestClient rc = new RestClient(_assetServerUrl);
|
||||||
//MainLog.Instance.Verbose("ASSET", "Stored {0}", rc);
|
m_log.Info("[GRID ASSET CLIENT]: Storing asset");
|
||||||
MainLog.Instance.Verbose("ASSET", "Sending to " + _assetServerUrl + "/assets/");
|
//rc.AddResourcePath("assets");
|
||||||
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
|
||||||
}
|
// rc.RequestMethod = "POST";
|
||||||
catch (Exception e)
|
// rc.Request(s);
|
||||||
{
|
//m_log.InfoFormat("[ASSET]: Stored {0}", rc);
|
||||||
MainLog.Instance.Error("ASSETS", e.Message);
|
m_log.Info("[GRID ASSET CLIENT]: Sending to " + _assetServerUrl + "/assets/");
|
||||||
}
|
RestObjectPoster.BeginPostObject<AssetBase>(_assetServerUrl + "/assets/", asset);
|
||||||
}
|
|
||||||
|
}
|
||||||
protected override void CommitAssets()
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
}
|
m_log.Error("[GRID ASSET CLIENT]: " + e.Message);
|
||||||
|
}
|
||||||
public override void Close()
|
}
|
||||||
{
|
|
||||||
throw new Exception("The method or operation is not implemented.");
|
protected override void CommitAssets()
|
||||||
}
|
{
|
||||||
|
}
|
||||||
// rex new function for "replace assets" functionality
|
|
||||||
// TODO: implementation by someone
|
public override void Close()
|
||||||
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
{
|
||||||
{
|
throw new Exception("The method or operation is not implemented.");
|
||||||
throw new Exception("The method or operation is not implemented.");
|
}
|
||||||
}
|
|
||||||
|
// rex new function for "replace assets" functionality
|
||||||
#endregion
|
// TODO: implementation by someone
|
||||||
}
|
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
}
|
{
|
||||||
|
throw new Exception("The method or operation is not implemented.");
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,281 +1,278 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using System.IO;
|
using System.Collections.Generic;
|
||||||
using System.Xml;
|
using System.IO;
|
||||||
using libsecondlife;
|
using System.Xml;
|
||||||
using Nini.Config;
|
using libsecondlife;
|
||||||
|
using Nini.Config;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Basically a hack to give us a Inventory library while we don't have a inventory server
|
/// Basically a hack to give us a Inventory library while we don't have a inventory server
|
||||||
/// once the server is fully implemented then should read the data from that
|
/// once the server is fully implemented then should read the data from that
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class LibraryRootFolder : InventoryFolderImpl
|
public class LibraryRootFolder : InventoryFolderImpl
|
||||||
{
|
{
|
||||||
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
private LLUUID libOwner = new LLUUID("11111111-1111-0000-0000-000100bba000");
|
||||||
/// Holds the root library folder and all its descendents. This is really only used during inventory
|
|
||||||
/// setup so that we don't have to repeatedly search the tree of library folders.
|
/// <summary>
|
||||||
/// </summary>
|
/// Holds the root library folder and all its descendents. This is really only used during inventory
|
||||||
protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders
|
/// setup so that we don't have to repeatedly search the tree of library folders.
|
||||||
= new Dictionary<LLUUID, InventoryFolderImpl>();
|
/// </summary>
|
||||||
|
protected Dictionary<LLUUID, InventoryFolderImpl> libraryFolders
|
||||||
public LibraryRootFolder()
|
= new Dictionary<LLUUID, InventoryFolderImpl>();
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose("LIBRARYINVENTORY", "Loading library inventory");
|
public LibraryRootFolder()
|
||||||
|
{
|
||||||
agentID = libOwner;
|
m_log.Info("[LIBRARY INVENTORY]: Loading library inventory");
|
||||||
folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
|
|
||||||
name = "OpenSim Library";
|
agentID = libOwner;
|
||||||
parentID = LLUUID.Zero;
|
folderID = new LLUUID("00000112-000f-0000-0000-000100bba000");
|
||||||
type = (short) 8;
|
name = "OpenSim Library";
|
||||||
version = (ushort) 1;
|
parentID = LLUUID.Zero;
|
||||||
|
type = (short) 8;
|
||||||
libraryFolders.Add(folderID, this);
|
version = (ushort) 1;
|
||||||
|
|
||||||
LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml"));
|
libraryFolders.Add(folderID, this);
|
||||||
|
|
||||||
// CreateLibraryItems();
|
LoadLibraries(Path.Combine(Util.inventoryDir(), "Libraries.xml"));
|
||||||
}
|
|
||||||
|
// CreateLibraryItems();
|
||||||
/// <summary>
|
}
|
||||||
/// Hardcoded item creation. Please don't add any more items here - future items should be created
|
|
||||||
/// in the xml in the bin/inventory folder.
|
/// <summary>
|
||||||
/// </summary>
|
/// Hardcoded item creation. Please don't add any more items here - future items should be created
|
||||||
///
|
/// in the xml in the bin/inventory folder.
|
||||||
/// Commented the following out due to sending it all through xml, remove this section once this is provin to work stable.
|
/// </summary>
|
||||||
///
|
///
|
||||||
//private void CreateLibraryItems()
|
/// Commented the following out due to sending it all through xml, remove this section once this is provin to work stable.
|
||||||
//{
|
///
|
||||||
// InventoryItemBase item =
|
//private void CreateLibraryItems()
|
||||||
// CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"),
|
//{
|
||||||
// new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape",
|
// InventoryItemBase item =
|
||||||
// (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
|
// CreateItem(new LLUUID("66c41e39-38f9-f75a-024e-585989bfaba9"),
|
||||||
// item.inventoryCurrentPermissions = 0;
|
// new LLUUID("66c41e39-38f9-f75a-024e-585989bfab73"), "Default Shape", "Default Shape",
|
||||||
// item.inventoryNextPermissions = 0;
|
// (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
|
||||||
// Items.Add(item.inventoryID, item);
|
// item.inventoryCurrentPermissions = 0;
|
||||||
|
// item.inventoryNextPermissions = 0;
|
||||||
// item =
|
// Items.Add(item.inventoryID, item);
|
||||||
// CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"),
|
|
||||||
// new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin",
|
// item =
|
||||||
// (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
|
// CreateItem(new LLUUID("77c41e39-38f9-f75a-024e-585989bfabc9"),
|
||||||
// item.inventoryCurrentPermissions = 0;
|
// new LLUUID("77c41e39-38f9-f75a-024e-585989bbabbb"), "Default Skin", "Default Skin",
|
||||||
// item.inventoryNextPermissions = 0;
|
// (int) AssetType.Bodypart, (int) InventoryType.Wearable, folderID);
|
||||||
// Items.Add(item.inventoryID, item);
|
// item.inventoryCurrentPermissions = 0;
|
||||||
|
// item.inventoryNextPermissions = 0;
|
||||||
// item =
|
// Items.Add(item.inventoryID, item);
|
||||||
// CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"),
|
|
||||||
// new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt",
|
// item =
|
||||||
// (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
|
// CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-585989bf0000"),
|
||||||
// item.inventoryCurrentPermissions = 0;
|
// new LLUUID("00000000-38f9-1111-024e-222222111110"), "Default Shirt", "Default Shirt",
|
||||||
// item.inventoryNextPermissions = 0;
|
// (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
|
||||||
// Items.Add(item.inventoryID, item);
|
// item.inventoryCurrentPermissions = 0;
|
||||||
|
// item.inventoryNextPermissions = 0;
|
||||||
// item =
|
// Items.Add(item.inventoryID, item);
|
||||||
// CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"),
|
|
||||||
// new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants",
|
// item =
|
||||||
// (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
|
// CreateItem(new LLUUID("77c41e39-38f9-f75a-0000-5859892f1111"),
|
||||||
// item.inventoryCurrentPermissions = 0;
|
// new LLUUID("00000000-38f9-1111-024e-222222111120"), "Default Pants", "Default Pants",
|
||||||
// item.inventoryNextPermissions = 0;
|
// (int) AssetType.Clothing, (int) InventoryType.Wearable, folderID);
|
||||||
// Items.Add(item.inventoryID, item);
|
// item.inventoryCurrentPermissions = 0;
|
||||||
//}
|
// item.inventoryNextPermissions = 0;
|
||||||
|
// Items.Add(item.inventoryID, item);
|
||||||
public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description,
|
//}
|
||||||
int assetType, int invType, LLUUID parentFolderID)
|
|
||||||
{
|
public InventoryItemBase CreateItem(LLUUID inventoryID, LLUUID assetID, string name, string description,
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
int assetType, int invType, LLUUID parentFolderID)
|
||||||
item.avatarID = libOwner;
|
{
|
||||||
item.creatorsID = libOwner;
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
item.inventoryID = inventoryID;
|
item.avatarID = libOwner;
|
||||||
item.assetID = assetID;
|
item.creatorsID = libOwner;
|
||||||
item.inventoryDescription = description;
|
item.inventoryID = inventoryID;
|
||||||
item.inventoryName = name;
|
item.assetID = assetID;
|
||||||
item.assetType = assetType;
|
item.inventoryDescription = description;
|
||||||
item.invType = invType;
|
item.inventoryName = name;
|
||||||
item.parentFolderID = parentFolderID;
|
item.assetType = assetType;
|
||||||
item.inventoryBasePermissions = 0x7FFFFFFF;
|
item.invType = invType;
|
||||||
item.inventoryEveryOnePermissions = 0x7FFFFFFF;
|
item.parentFolderID = parentFolderID;
|
||||||
item.inventoryCurrentPermissions = 0x7FFFFFFF;
|
item.inventoryBasePermissions = 0x7FFFFFFF;
|
||||||
item.inventoryNextPermissions = 0x7FFFFFFF;
|
item.inventoryEveryOnePermissions = 0x7FFFFFFF;
|
||||||
return item;
|
item.inventoryCurrentPermissions = 0x7FFFFFFF;
|
||||||
}
|
item.inventoryNextPermissions = 0x7FFFFFFF;
|
||||||
|
return item;
|
||||||
/// <summary>
|
}
|
||||||
/// Use the asset set information at path to load assets
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="path"></param>
|
/// Use the asset set information at path to load assets
|
||||||
/// <param name="assets"></param>
|
/// </summary>
|
||||||
protected void LoadLibraries(string librariesControlPath)
|
/// <param name="path"></param>
|
||||||
{
|
/// <param name="assets"></param>
|
||||||
MainLog.Instance.Verbose(
|
protected void LoadLibraries(string librariesControlPath)
|
||||||
"LIBRARYINVENTORY", "Loading libraries control file {0}", librariesControlPath);
|
{
|
||||||
|
m_log.InfoFormat(
|
||||||
LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig);
|
"[LIBRARY INVENTORY]: Loading libraries control file {0}", librariesControlPath);
|
||||||
}
|
|
||||||
|
LoadFromFile(librariesControlPath, "Libraries control", ReadLibraryFromConfig);
|
||||||
/// <summary>
|
}
|
||||||
/// Read a library set from config
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="config"></param>
|
/// Read a library set from config
|
||||||
protected void ReadLibraryFromConfig(IConfig config)
|
/// </summary>
|
||||||
{
|
/// <param name="config"></param>
|
||||||
string foldersPath
|
protected void ReadLibraryFromConfig(IConfig config)
|
||||||
= Path.Combine(
|
{
|
||||||
Util.inventoryDir(), config.GetString("foldersFile", ""));
|
string foldersPath
|
||||||
|
= Path.Combine(
|
||||||
LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig);
|
Util.inventoryDir(), config.GetString("foldersFile", System.String.Empty));
|
||||||
|
|
||||||
string itemsPath
|
LoadFromFile(foldersPath, "Library folders", ReadFolderFromConfig);
|
||||||
= Path.Combine(
|
|
||||||
Util.inventoryDir(), config.GetString("itemsFile", ""));
|
string itemsPath
|
||||||
|
= Path.Combine(
|
||||||
LoadFromFile(itemsPath, "Library items", ReadItemFromConfig);
|
Util.inventoryDir(), config.GetString("itemsFile", System.String.Empty));
|
||||||
}
|
|
||||||
|
LoadFromFile(itemsPath, "Library items", ReadItemFromConfig);
|
||||||
/// <summary>
|
}
|
||||||
/// Read a library inventory folder from a loaded configuration
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="source"></param>
|
/// Read a library inventory folder from a loaded configuration
|
||||||
private void ReadFolderFromConfig(IConfig config)
|
/// </summary>
|
||||||
{
|
/// <param name="source"></param>
|
||||||
InventoryFolderImpl folderInfo = new InventoryFolderImpl();
|
private void ReadFolderFromConfig(IConfig config)
|
||||||
|
{
|
||||||
folderInfo.folderID = new LLUUID(config.GetString("folderID", folderID.ToString()));
|
InventoryFolderImpl folderInfo = new InventoryFolderImpl();
|
||||||
folderInfo.name = config.GetString("name", "unknown");
|
|
||||||
folderInfo.parentID = new LLUUID(config.GetString("parentFolderID", folderID.ToString()));
|
folderInfo.folderID = new LLUUID(config.GetString("folderID", folderID.ToString()));
|
||||||
folderInfo.type = (short)config.GetInt("type", 8);
|
folderInfo.name = config.GetString("name", "unknown");
|
||||||
|
folderInfo.parentID = new LLUUID(config.GetString("parentFolderID", folderID.ToString()));
|
||||||
folderInfo.agentID = libOwner;
|
folderInfo.type = (short)config.GetInt("type", 8);
|
||||||
folderInfo.version = 1;
|
|
||||||
|
folderInfo.agentID = libOwner;
|
||||||
if (libraryFolders.ContainsKey(folderInfo.parentID))
|
folderInfo.version = 1;
|
||||||
{
|
|
||||||
InventoryFolderImpl parentFolder = libraryFolders[folderInfo.parentID];
|
if (libraryFolders.ContainsKey(folderInfo.parentID))
|
||||||
|
{
|
||||||
libraryFolders.Add(folderInfo.folderID, folderInfo);
|
InventoryFolderImpl parentFolder = libraryFolders[folderInfo.parentID];
|
||||||
parentFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
|
|
||||||
|
libraryFolders.Add(folderInfo.folderID, folderInfo);
|
||||||
// MainLog.Instance.Verbose(
|
parentFolder.SubFolders.Add(folderInfo.folderID, folderInfo);
|
||||||
// "LIBRARYINVENTORY", "Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
|
|
||||||
}
|
// m_log.InfoFormat("[LIBRARY INVENTORY]: Adding folder {0} ({1})", folderInfo.name, folderInfo.folderID);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
MainLog.Instance.Warn(
|
{
|
||||||
"LIBRARYINVENTORY",
|
m_log.WarnFormat(
|
||||||
"Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!",
|
"[LIBRARY INVENTORY]: Couldn't add folder {0} ({1}) since parent folder with ID {2} does not exist!",
|
||||||
folderInfo.name, folderInfo.folderID, folderInfo.parentID);
|
folderInfo.name, folderInfo.folderID, folderInfo.parentID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read a library inventory item metadata from a loaded configuration
|
/// Read a library inventory item metadata from a loaded configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source"></param>
|
/// <param name="source"></param>
|
||||||
private void ReadItemFromConfig(IConfig config)
|
private void ReadItemFromConfig(IConfig config)
|
||||||
{
|
{
|
||||||
InventoryItemBase item = new InventoryItemBase();
|
InventoryItemBase item = new InventoryItemBase();
|
||||||
item.avatarID = libOwner;
|
item.avatarID = libOwner;
|
||||||
item.creatorsID = libOwner;
|
item.creatorsID = libOwner;
|
||||||
item.inventoryID = new LLUUID(config.GetString("inventoryID", folderID.ToString()));
|
item.inventoryID = new LLUUID(config.GetString("inventoryID", folderID.ToString()));
|
||||||
item.assetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString()));
|
item.assetID = new LLUUID(config.GetString("assetID", LLUUID.Random().ToString()));
|
||||||
item.parentFolderID = new LLUUID(config.GetString("folderID", folderID.ToString()));
|
item.parentFolderID = new LLUUID(config.GetString("folderID", folderID.ToString()));
|
||||||
item.inventoryDescription = config.GetString("description", "");
|
item.inventoryDescription = config.GetString("description", System.String.Empty);
|
||||||
item.inventoryName = config.GetString("name", "");
|
item.inventoryName = config.GetString("name", System.String.Empty);
|
||||||
item.assetType = config.GetInt("assetType", 0);
|
item.assetType = config.GetInt("assetType", 0);
|
||||||
item.invType = config.GetInt("inventoryType", 0);
|
item.invType = config.GetInt("inventoryType", 0);
|
||||||
item.inventoryCurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF);
|
item.inventoryCurrentPermissions = (uint)config.GetLong("currentPermissions", 0x7FFFFFFF);
|
||||||
item.inventoryNextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF);
|
item.inventoryNextPermissions = (uint)config.GetLong("nextPermissions", 0x7FFFFFFF);
|
||||||
item.inventoryEveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF);
|
item.inventoryEveryOnePermissions = (uint)config.GetLong("everyonePermissions", 0x7FFFFFFF);
|
||||||
item.inventoryBasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF);
|
item.inventoryBasePermissions = (uint)config.GetLong("basePermissions", 0x7FFFFFFF);
|
||||||
|
|
||||||
if (libraryFolders.ContainsKey(item.parentFolderID))
|
if (libraryFolders.ContainsKey(item.parentFolderID))
|
||||||
{
|
{
|
||||||
InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID];
|
InventoryFolderImpl parentFolder = libraryFolders[item.parentFolderID];
|
||||||
|
|
||||||
parentFolder.Items.Add(item.inventoryID, item);
|
parentFolder.Items.Add(item.inventoryID, item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn(
|
m_log.WarnFormat(
|
||||||
"LIBRARYINVENTORY",
|
"[LIBRARY INVENTORY]: Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!",
|
||||||
"Couldn't add item {0} ({1}) since parent folder with ID {2} does not exist!",
|
item.inventoryName, item.inventoryID, item.parentFolderID);
|
||||||
item.inventoryName, item.inventoryID, item.parentFolderID);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private delegate void ConfigAction(IConfig config);
|
||||||
private delegate void ConfigAction(IConfig config);
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Load the given configuration at a path and perform an action on each Config contained within it
|
||||||
/// Load the given configuration at a path and perform an action on each Config contained within it
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="path"></param>
|
||||||
/// <param name="path"></param>
|
/// <param name="fileDescription"></param>
|
||||||
/// <param name="fileDescription"></param>
|
/// <param name="action"></param>
|
||||||
/// <param name="action"></param>
|
private void LoadFromFile(string path, string fileDescription, ConfigAction action)
|
||||||
private void LoadFromFile(string path, string fileDescription, ConfigAction action)
|
{
|
||||||
{
|
if (File.Exists(path))
|
||||||
if (File.Exists(path))
|
{
|
||||||
{
|
try
|
||||||
try
|
{
|
||||||
{
|
XmlConfigSource source = new XmlConfigSource(path);
|
||||||
XmlConfigSource source = new XmlConfigSource(path);
|
|
||||||
|
for (int i = 0; i < source.Configs.Count; i++)
|
||||||
for (int i = 0; i < source.Configs.Count; i++)
|
{
|
||||||
{
|
action(source.Configs[i]);
|
||||||
action(source.Configs[i]);
|
}
|
||||||
}
|
}
|
||||||
}
|
catch (XmlException e)
|
||||||
catch (XmlException e)
|
{
|
||||||
{
|
m_log.ErrorFormat("[LIBRARY INVENTORY]: Error loading {0} : {1}", path, e);
|
||||||
MainLog.Instance.Error(
|
}
|
||||||
"LIBRARYINVENTORY", "Error loading {0} : {1}", path, e);
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
else
|
m_log.ErrorFormat("[LIBRARY INVENTORY]: {0} file {1} does not exist!", fileDescription, path);
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(
|
}
|
||||||
"LIBRARYINVENTORY", "{0} file {1} does not exist!", fileDescription, path);
|
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Looks like a simple getter, but is written like this for some consistency with the other Request
|
||||||
|
/// methods in the superclass
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Looks like a simple getter, but is written like this for some consistency with the other Request
|
/// <returns></returns>
|
||||||
/// methods in the superclass
|
public Dictionary<LLUUID, InventoryFolderImpl> RequestSelfAndDescendentFolders()
|
||||||
/// </summary>
|
{
|
||||||
/// <returns></returns>
|
return libraryFolders;
|
||||||
public Dictionary<LLUUID, InventoryFolderImpl> RequestSelfAndDescendentFolders()
|
}
|
||||||
{
|
}
|
||||||
return libraryFolders;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,107 +1,108 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
* Copyright (c) Contributors, http://www.openmetaverse.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
public class SQLAssetServer : AssetServerBase
|
public class SQLAssetServer : AssetServerBase
|
||||||
{
|
{
|
||||||
public SQLAssetServer(string pluginName)
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
{
|
|
||||||
AddPlugin(pluginName);
|
public SQLAssetServer(string pluginName)
|
||||||
}
|
{
|
||||||
|
AddPlugin(pluginName);
|
||||||
public SQLAssetServer(IAssetProvider assetProvider)
|
}
|
||||||
{
|
|
||||||
m_assetProvider = assetProvider;
|
public SQLAssetServer(IAssetProvider assetProvider)
|
||||||
}
|
{
|
||||||
|
m_assetProvider = assetProvider;
|
||||||
public void AddPlugin(string FileName)
|
}
|
||||||
{
|
|
||||||
MainLog.Instance.Verbose("SQLAssetServer", "AssetStorage: Attempting to load " + FileName);
|
public void AddPlugin(string FileName)
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
{
|
||||||
|
m_log.Info("[SQLAssetServer]: AssetStorage: Attempting to load " + FileName);
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
{
|
|
||||||
if (!pluginType.IsAbstract)
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
{
|
{
|
||||||
Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
|
if (!pluginType.IsAbstract)
|
||||||
|
{
|
||||||
if (typeInterface != null)
|
Type typeInterface = pluginType.GetInterface("IAssetProvider", true);
|
||||||
{
|
|
||||||
IAssetProvider plug =
|
if (typeInterface != null)
|
||||||
(IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
{
|
||||||
m_assetProvider = plug;
|
IAssetProvider plug =
|
||||||
m_assetProvider.Initialise();
|
(IAssetProvider) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
|
m_assetProvider = plug;
|
||||||
MainLog.Instance.Verbose("AssetStorage",
|
m_assetProvider.Initialise();
|
||||||
"Added " + m_assetProvider.Name + " " +
|
|
||||||
m_assetProvider.Version);
|
m_log.Info("[AssetStorage]: " +
|
||||||
}
|
"Added " + m_assetProvider.Name + " " +
|
||||||
}
|
m_assetProvider.Version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
public override void Close()
|
|
||||||
{
|
public override void Close()
|
||||||
base.Close();
|
{
|
||||||
|
base.Close();
|
||||||
m_assetProvider.CommitAssets();
|
|
||||||
}
|
m_assetProvider.CommitAssets();
|
||||||
|
}
|
||||||
// rex new function for "replace assets" functionality
|
|
||||||
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
// rex new function for "replace assets" functionality
|
||||||
{
|
public override libsecondlife.LLUUID ExistsAsset(sbyte assetType, string name)
|
||||||
return m_assetProvider.ExistsAsset(assetType, name);
|
{
|
||||||
}
|
return m_assetProvider.ExistsAsset(assetType, name);
|
||||||
|
}
|
||||||
protected override AssetBase GetAsset(AssetRequest req)
|
|
||||||
{
|
protected override AssetBase GetAsset(AssetRequest req)
|
||||||
AssetBase asset;
|
{
|
||||||
lock (m_syncLock)
|
AssetBase asset;
|
||||||
{
|
lock (m_syncLock)
|
||||||
asset = m_assetProvider.FetchAsset(req.AssetID);
|
{
|
||||||
}
|
asset = m_assetProvider.FetchAsset(req.AssetID);
|
||||||
|
}
|
||||||
return asset;
|
|
||||||
}
|
return asset;
|
||||||
|
}
|
||||||
protected override void StoreAsset(AssetBase asset)
|
|
||||||
{
|
protected override void StoreAsset(AssetBase asset)
|
||||||
m_assetProvider.CreateAsset(asset);
|
{
|
||||||
}
|
m_assetProvider.CreateAsset(asset);
|
||||||
|
}
|
||||||
protected override void CommitAssets()
|
|
||||||
{
|
protected override void CommitAssets()
|
||||||
m_assetProvider.CommitAssets();
|
{
|
||||||
}
|
m_assetProvider.CommitAssets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,368 +1,372 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
|
||||||
using libsecondlife;
|
using System;
|
||||||
using OpenSim.Framework.Console;
|
using System.Collections.Generic;
|
||||||
|
using libsecondlife;
|
||||||
namespace OpenSim.Framework.Communications.Cache
|
using OpenSim.Framework.Console;
|
||||||
{
|
|
||||||
public class UserProfileCacheService
|
namespace OpenSim.Framework.Communications.Cache
|
||||||
{
|
{
|
||||||
// Fields
|
public class UserProfileCacheService
|
||||||
private readonly CommunicationsManager m_parent;
|
{
|
||||||
private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public LibraryRootFolder libraryRoot = new LibraryRootFolder();
|
// Fields
|
||||||
public RexWorldAssetsFolder worldlibraryRoot = null; // rex added
|
private readonly CommunicationsManager m_parent;
|
||||||
|
private readonly Dictionary<LLUUID, CachedUserInfo> m_userProfiles = new Dictionary<LLUUID, CachedUserInfo>();
|
||||||
// Methods
|
|
||||||
public UserProfileCacheService(CommunicationsManager parent)
|
public LibraryRootFolder libraryRoot = new LibraryRootFolder();
|
||||||
{
|
public RexWorldAssetsFolder worldlibraryRoot = null; // rex added
|
||||||
m_parent = parent;
|
|
||||||
// rex, added worldlibrary
|
// Methods
|
||||||
if (GlobalSettings.Instance.ConfigSource.Configs["Startup"].GetBoolean("worldlibraryfolder", true))
|
public UserProfileCacheService(CommunicationsManager parent)
|
||||||
{
|
{
|
||||||
worldlibraryRoot = new RexWorldAssetsFolder(m_parent.AssetCache);
|
m_parent = parent;
|
||||||
libraryRoot.CreateNewSubFolder(new LLUUID("00000112-000f-0000-0000-000100bba005"), "World Library", (ushort)8);
|
// rex, added worldlibrary
|
||||||
}
|
if (GlobalSettings.Instance.ConfigSource.Configs["Startup"].GetBoolean("worldlibraryfolder", true))
|
||||||
// rexend
|
{
|
||||||
}
|
worldlibraryRoot = new RexWorldAssetsFolder(m_parent.AssetCache);
|
||||||
|
libraryRoot.CreateNewSubFolder(new LLUUID("00000112-000f-0000-0000-000100bba005"), "World Library", (ushort)8);
|
||||||
/// <summary>
|
}
|
||||||
/// A new user has moved into a region in this instance
|
// rexend
|
||||||
/// so get info from servers
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
/// <summary>
|
||||||
public void AddNewUser(LLUUID userID)
|
/// A new user has moved into a region in this instance
|
||||||
{
|
/// so get info from servers
|
||||||
// Potential fix - Multithreading issue.
|
/// </summary>
|
||||||
lock (m_userProfiles)
|
/// <param name="userID"></param>
|
||||||
{
|
public void AddNewUser(LLUUID userID)
|
||||||
if (!m_userProfiles.ContainsKey(userID))
|
{
|
||||||
{
|
// Potential fix - Multithreading issue.
|
||||||
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
lock (m_userProfiles)
|
||||||
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, "");
|
{
|
||||||
|
if (!m_userProfiles.ContainsKey(userID))
|
||||||
if (userInfo.UserProfile != null)
|
{
|
||||||
{
|
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
||||||
// The request itself will occur when the agent finishes logging on to the region
|
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, "");
|
||||||
// so there's no need to do it here.
|
|
||||||
//RequestInventoryForUser(userID, userInfo);
|
if (userInfo.UserProfile != null)
|
||||||
m_userProfiles.Add(userID, userInfo);
|
{
|
||||||
}
|
// The request itself will occur when the agent finishes logging on to the region
|
||||||
else
|
// so there's no need to do it here.
|
||||||
{
|
//RequestInventoryForUser(userID, userInfo);
|
||||||
MainLog.Instance.Error("USERCACHE", "User profile for user {0} not found", userID);
|
m_userProfiles.Add(userID, userInfo);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
m_log.ErrorFormat("[USERCACHE]: User profile for user {0} not found", userID);
|
||||||
|
}
|
||||||
//Rex mode
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// A new user has moved into a region in this instance
|
}
|
||||||
/// so get info from servers
|
|
||||||
/// </summary>
|
//Rex mode
|
||||||
/// <param name="userID"></param>
|
/// <summary>
|
||||||
public void AddNewUser(LLUUID userID, string authAddr)
|
/// A new user has moved into a region in this instance
|
||||||
{
|
/// so get info from servers
|
||||||
// Potential fix - Multithreading issue.
|
/// </summary>
|
||||||
lock (m_userProfiles)
|
/// <param name="userID"></param>
|
||||||
{
|
public void AddNewUser(LLUUID userID, string authAddr)
|
||||||
if (!m_userProfiles.ContainsKey(userID))
|
{
|
||||||
{
|
// Potential fix - Multithreading issue.
|
||||||
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
lock (m_userProfiles)
|
||||||
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, authAddr);
|
{
|
||||||
|
if (!m_userProfiles.ContainsKey(userID))
|
||||||
if (userInfo.UserProfile != null)
|
{
|
||||||
{
|
CachedUserInfo userInfo = new CachedUserInfo(m_parent);
|
||||||
//RequestInventoryForUser(userID, userInfo);
|
userInfo.UserProfile = m_parent.UserService.GetUserProfile(userID, authAddr);
|
||||||
// The request itself will occur when the agent finishes logging on to the region
|
|
||||||
// so there's no need to do it here.
|
if (userInfo.UserProfile != null)
|
||||||
//RequestInventoryForUser(userID, userInfo);
|
{
|
||||||
m_userProfiles.Add(userID, userInfo);
|
//RequestInventoryForUser(userID, userInfo);
|
||||||
}
|
// The request itself will occur when the agent finishes logging on to the region
|
||||||
else
|
// so there's no need to do it here.
|
||||||
{
|
//RequestInventoryForUser(userID, userInfo);
|
||||||
System.Console.WriteLine("CACHE", "User profile for user not found");
|
m_userProfiles.Add(userID, userInfo);
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
}
|
System.Console.WriteLine("CACHE", "User profile for user not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
public void UpdateUserInventory(LLUUID userID)
|
}
|
||||||
{
|
}
|
||||||
CachedUserInfo userInfo = GetUserDetails(userID);
|
|
||||||
if (userInfo != null)
|
|
||||||
{
|
public void UpdateUserInventory(LLUUID userID)
|
||||||
RequestInventoryForUser(userID, userInfo);
|
{
|
||||||
}
|
CachedUserInfo userInfo = GetUserDetails(userID);
|
||||||
}
|
if (userInfo != null)
|
||||||
|
{
|
||||||
public CachedUserInfo GetUserDetails(LLUUID userID)
|
RequestInventoryForUser(userID, userInfo);
|
||||||
{
|
}
|
||||||
if (m_userProfiles.ContainsKey(userID))
|
}
|
||||||
return m_userProfiles[userID];
|
|
||||||
else
|
public CachedUserInfo GetUserDetails(LLUUID userID)
|
||||||
return null;
|
{
|
||||||
}
|
if (m_userProfiles.ContainsKey(userID))
|
||||||
|
return m_userProfiles[userID];
|
||||||
public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
|
else
|
||||||
string folderName, LLUUID parentID)
|
return null;
|
||||||
{
|
}
|
||||||
CachedUserInfo userProfile;
|
|
||||||
|
public void HandleCreateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort folderType,
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
string folderName, LLUUID parentID)
|
||||||
{
|
{
|
||||||
if (userProfile.RootFolder != null)
|
CachedUserInfo userProfile;
|
||||||
{
|
|
||||||
if (userProfile.RootFolder.folderID == parentID)
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
{
|
{
|
||||||
InventoryFolderImpl createdFolder =
|
if (userProfile.RootFolder != null)
|
||||||
userProfile.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
|
{
|
||||||
|
if (userProfile.RootFolder.folderID == parentID)
|
||||||
if (createdFolder != null)
|
{
|
||||||
{
|
InventoryFolderImpl createdFolder =
|
||||||
InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
|
userProfile.RootFolder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||||
createdBaseFolder.agentID = createdFolder.agentID;
|
|
||||||
createdBaseFolder.folderID = createdFolder.folderID;
|
if (createdFolder != null)
|
||||||
createdBaseFolder.name = createdFolder.name;
|
{
|
||||||
createdBaseFolder.parentID = createdFolder.parentID;
|
InventoryFolderBase createdBaseFolder = new InventoryFolderBase();
|
||||||
createdBaseFolder.type = createdFolder.type;
|
createdBaseFolder.agentID = createdFolder.agentID;
|
||||||
createdBaseFolder.version = createdFolder.version;
|
createdBaseFolder.folderID = createdFolder.folderID;
|
||||||
m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
|
createdBaseFolder.name = createdFolder.name;
|
||||||
}
|
createdBaseFolder.parentID = createdFolder.parentID;
|
||||||
}
|
createdBaseFolder.type = createdFolder.type;
|
||||||
else
|
createdBaseFolder.version = createdFolder.version;
|
||||||
{
|
m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, createdBaseFolder);
|
||||||
InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(parentID);
|
}
|
||||||
if (folder != null)
|
}
|
||||||
{
|
else
|
||||||
folder.CreateNewSubFolder(folderID, folderName, folderType);
|
{
|
||||||
}
|
InventoryFolderImpl folder = userProfile.RootFolder.HasSubFolder(parentID);
|
||||||
}
|
if (folder != null)
|
||||||
}
|
{
|
||||||
}
|
folder.CreateNewSubFolder(folderID, folderName, folderType);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name,
|
}
|
||||||
LLUUID parentID)
|
}
|
||||||
{
|
}
|
||||||
CachedUserInfo userProfile;
|
|
||||||
|
public void HandleUpdateInventoryFolder(IClientAPI remoteClient, LLUUID folderID, ushort type, string name,
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
LLUUID parentID)
|
||||||
{
|
{
|
||||||
if (userProfile.RootFolder != null)
|
CachedUserInfo userProfile;
|
||||||
{
|
|
||||||
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
baseFolder.agentID = remoteClient.AgentId;
|
{
|
||||||
baseFolder.folderID = folderID;
|
if (userProfile.RootFolder != null)
|
||||||
baseFolder.name = name;
|
{
|
||||||
baseFolder.parentID = parentID;
|
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
||||||
baseFolder.type = (short) type;
|
baseFolder.agentID = remoteClient.AgentId;
|
||||||
baseFolder.version = userProfile.RootFolder.version;
|
baseFolder.folderID = folderID;
|
||||||
m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
|
baseFolder.name = name;
|
||||||
}
|
baseFolder.parentID = parentID;
|
||||||
}
|
baseFolder.type = (short) type;
|
||||||
}
|
baseFolder.version = userProfile.RootFolder.version;
|
||||||
|
m_parent.InventoryService.AddNewInventoryFolder(remoteClient.AgentId, baseFolder);
|
||||||
public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
|
}
|
||||||
{
|
}
|
||||||
CachedUserInfo userProfile;
|
}
|
||||||
|
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
public void HandleMoveInventoryFolder(IClientAPI remoteClient, LLUUID folderID, LLUUID parentID)
|
||||||
{
|
{
|
||||||
if (userProfile.RootFolder != null)
|
CachedUserInfo userProfile;
|
||||||
{
|
|
||||||
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
baseFolder.agentID = remoteClient.AgentId;
|
{
|
||||||
baseFolder.folderID = folderID;
|
if (userProfile.RootFolder != null)
|
||||||
baseFolder.parentID = parentID;
|
{
|
||||||
m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
|
InventoryFolderBase baseFolder = new InventoryFolderBase();
|
||||||
}
|
baseFolder.agentID = remoteClient.AgentId;
|
||||||
}
|
baseFolder.folderID = folderID;
|
||||||
}
|
baseFolder.parentID = parentID;
|
||||||
|
m_parent.InventoryService.MoveInventoryFolder(remoteClient.AgentId, baseFolder);
|
||||||
/// <summary>
|
}
|
||||||
/// Tell the client about the various child items and folders contained in the requested folder.
|
}
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="remoteClient"></param>
|
|
||||||
/// <param name="folderID"></param>
|
/// <summary>
|
||||||
/// <param name="ownerID"></param>
|
/// Tell the client about the various child items and folders contained in the requested folder.
|
||||||
/// <param name="fetchFolders"></param>
|
/// </summary>
|
||||||
/// <param name="fetchItems"></param>
|
/// <param name="remoteClient"></param>
|
||||||
/// <param name="sortOrder"></param>
|
/// <param name="folderID"></param>
|
||||||
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
|
/// <param name="ownerID"></param>
|
||||||
bool fetchFolders, bool fetchItems, int sortOrder)
|
/// <param name="fetchFolders"></param>
|
||||||
{
|
/// <param name="fetchItems"></param>
|
||||||
// XXX We're not handling sortOrder yet!
|
/// <param name="sortOrder"></param>
|
||||||
|
public void HandleFetchInventoryDescendents(IClientAPI remoteClient, LLUUID folderID, LLUUID ownerID,
|
||||||
InventoryFolderImpl fold = null;
|
bool fetchFolders, bool fetchItems, int sortOrder)
|
||||||
|
{
|
||||||
// rex, added worldassetfolder
|
// XXX We're not handling sortOrder yet!
|
||||||
if (worldlibraryRoot != null)
|
|
||||||
{
|
InventoryFolderImpl fold = null;
|
||||||
if (folderID == worldlibraryRoot.folderID)
|
|
||||||
{
|
// rex, added worldassetfolder
|
||||||
remoteClient.SendInventoryFolderDetails(
|
if (worldlibraryRoot != null)
|
||||||
worldlibraryRoot.agentID, worldlibraryRoot.folderID, worldlibraryRoot.RequestListOfItems(),
|
{
|
||||||
worldlibraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
|
if (folderID == worldlibraryRoot.folderID)
|
||||||
return;
|
{
|
||||||
}
|
remoteClient.SendInventoryFolderDetails(
|
||||||
if ((fold = worldlibraryRoot.HasSubFolder(folderID)) != null)
|
worldlibraryRoot.agentID, worldlibraryRoot.folderID, worldlibraryRoot.RequestListOfItems(),
|
||||||
{
|
worldlibraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
worldlibraryRoot.UpdateWorldAssetFolders();
|
return;
|
||||||
remoteClient.SendInventoryFolderDetails(
|
}
|
||||||
worldlibraryRoot.agentID, folderID, fold.RequestListOfItems(),
|
if ((fold = worldlibraryRoot.HasSubFolder(folderID)) != null)
|
||||||
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
{
|
||||||
|
worldlibraryRoot.UpdateWorldAssetFolders();
|
||||||
return;
|
remoteClient.SendInventoryFolderDetails(
|
||||||
}
|
worldlibraryRoot.agentID, folderID, fold.RequestListOfItems(),
|
||||||
}
|
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
// rex-end
|
|
||||||
|
return;
|
||||||
if (folderID == libraryRoot.folderID)
|
}
|
||||||
{
|
}
|
||||||
remoteClient.SendInventoryFolderDetails(
|
// rex-end
|
||||||
libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(),
|
|
||||||
libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
|
if (folderID == libraryRoot.folderID)
|
||||||
|
{
|
||||||
return;
|
remoteClient.SendInventoryFolderDetails(
|
||||||
}
|
libraryRoot.agentID, libraryRoot.folderID, libraryRoot.RequestListOfItems(),
|
||||||
|
libraryRoot.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
|
|
||||||
{
|
return;
|
||||||
remoteClient.SendInventoryFolderDetails(
|
}
|
||||||
libraryRoot.agentID, folderID, fold.RequestListOfItems(),
|
|
||||||
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
|
||||||
|
{
|
||||||
return;
|
remoteClient.SendInventoryFolderDetails(
|
||||||
}
|
libraryRoot.agentID, folderID, fold.RequestListOfItems(),
|
||||||
|
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
CachedUserInfo userProfile;
|
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
return;
|
||||||
{
|
}
|
||||||
if (userProfile.RootFolder != null)
|
|
||||||
{
|
CachedUserInfo userProfile;
|
||||||
if (userProfile.RootFolder.folderID == folderID)
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
{
|
{
|
||||||
remoteClient.SendInventoryFolderDetails(
|
if (userProfile.RootFolder != null)
|
||||||
remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
|
{
|
||||||
userProfile.RootFolder.RequestListOfFolders(),
|
if (userProfile.RootFolder.folderID == folderID)
|
||||||
fetchFolders, fetchItems);
|
{
|
||||||
|
remoteClient.SendInventoryFolderDetails(
|
||||||
return;
|
remoteClient.AgentId, folderID, userProfile.RootFolder.RequestListOfItems(),
|
||||||
}
|
userProfile.RootFolder.RequestListOfFolders(),
|
||||||
else
|
fetchFolders, fetchItems);
|
||||||
{
|
|
||||||
if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
|
return;
|
||||||
{
|
}
|
||||||
remoteClient.SendInventoryFolderDetails(
|
else
|
||||||
remoteClient.AgentId, folderID, fold.RequestListOfItems(),
|
{
|
||||||
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
|
||||||
|
{
|
||||||
return;
|
remoteClient.SendInventoryFolderDetails(
|
||||||
}
|
remoteClient.AgentId, folderID, fold.RequestListOfItems(),
|
||||||
}
|
fold.RequestListOfFolders(), fetchFolders, fetchItems);
|
||||||
}
|
|
||||||
else
|
return;
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(
|
}
|
||||||
"INVENTORYCACHE", "Could not find root folder for user {0}", remoteClient.Name);
|
}
|
||||||
|
else
|
||||||
return;
|
{
|
||||||
}
|
m_log.ErrorFormat("[INVENTORYCACHE]: Could not find root folder for user {0}", remoteClient.Name);
|
||||||
}
|
|
||||||
else
|
return;
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(
|
}
|
||||||
"INVENTORYCACHE",
|
else
|
||||||
"Could not find user profile for {0} for folder {1}",
|
{
|
||||||
remoteClient.Name, folderID);
|
m_log.ErrorFormat("[INVENTORYCACHE]: " +
|
||||||
|
"Could not find user profile for {0} for folder {1}",
|
||||||
return;
|
remoteClient.Name, folderID);
|
||||||
}
|
|
||||||
|
return;
|
||||||
// If we've reached this point then we couldn't find the folder, even though the client thinks
|
}
|
||||||
// it exists
|
|
||||||
MainLog.Instance.Error(
|
// If we've reached this point then we couldn't find the folder, even though the client thinks
|
||||||
"INVENTORYCACHE",
|
// it exists
|
||||||
"Could not find folder {0} for user {1}",
|
m_log.ErrorFormat("[INVENTORYCACHE]: " +
|
||||||
folderID, remoteClient.Name);
|
"Could not find folder {0} for user {1}",
|
||||||
}
|
folderID, remoteClient.Name);
|
||||||
|
}
|
||||||
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
|
|
||||||
{
|
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
|
||||||
CachedUserInfo userProfile;
|
{
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
// m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}",
|
||||||
{
|
// folderID, remoteClient.Name, remoteClient.AgentId);
|
||||||
if (userProfile.RootFolder != null)
|
|
||||||
{
|
CachedUserInfo userProfile;
|
||||||
InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
if (subFolder != null)
|
{
|
||||||
{
|
if (userProfile.RootFolder != null)
|
||||||
List<InventoryItemBase> items = subFolder.RequestListOfItems();
|
{
|
||||||
foreach (InventoryItemBase item in items)
|
InventoryFolderImpl subFolder = userProfile.RootFolder.HasSubFolder(folderID);
|
||||||
{
|
if (subFolder != null)
|
||||||
userProfile.DeleteItem(remoteClient.AgentId, item);
|
{
|
||||||
}
|
List<InventoryItemBase> items = subFolder.RequestListOfItems();
|
||||||
}
|
foreach (InventoryItemBase item in items)
|
||||||
}
|
{
|
||||||
}
|
userProfile.DeleteItem(remoteClient.AgentId, item);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
|
}
|
||||||
{
|
}
|
||||||
if (ownerID == libraryRoot.agentID)
|
}
|
||||||
{
|
|
||||||
//Console.WriteLine("request info for library item");
|
public void HandleFetchInventory(IClientAPI remoteClient, LLUUID itemID, LLUUID ownerID)
|
||||||
|
{
|
||||||
return;
|
if (ownerID == libraryRoot.agentID)
|
||||||
}
|
{
|
||||||
|
//Console.WriteLine("request info for library item");
|
||||||
CachedUserInfo userProfile;
|
|
||||||
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
return;
|
||||||
{
|
}
|
||||||
if (userProfile.RootFolder != null)
|
|
||||||
{
|
CachedUserInfo userProfile;
|
||||||
InventoryItemBase item = userProfile.RootFolder.HasItem(itemID);
|
if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile))
|
||||||
if (item != null)
|
{
|
||||||
{
|
if (userProfile.RootFolder != null)
|
||||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
{
|
||||||
}
|
InventoryItemBase item = userProfile.RootFolder.HasItem(itemID);
|
||||||
}
|
if (item != null)
|
||||||
}
|
{
|
||||||
}
|
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||||
|
}
|
||||||
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
|
}
|
||||||
{
|
}
|
||||||
m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
|
}
|
||||||
}
|
|
||||||
}
|
private void RequestInventoryForUser(LLUUID userID, CachedUserInfo userInfo)
|
||||||
}
|
{
|
||||||
|
m_parent.InventoryService.RequestInventoryForUser(userID, userInfo.FolderReceive, userInfo.ItemReceive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,44 +1,45 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
using System;
|
||||||
namespace OpenSim.Region.Capabilities
|
|
||||||
{
|
namespace OpenSim.Region.Capabilities
|
||||||
[LLSDType("MAP")]
|
{
|
||||||
public class LLSDAssetUploadComplete
|
[LLSDType("MAP")]
|
||||||
{
|
public class LLSDAssetUploadComplete
|
||||||
public string new_asset = "";
|
{
|
||||||
public LLUUID new_inventory_item = LLUUID.Zero;
|
public string new_asset = String.Empty;
|
||||||
public string state = "";
|
public LLUUID new_inventory_item = LLUUID.Zero;
|
||||||
//public bool success = false;
|
public string state = String.Empty;
|
||||||
|
//public bool success = false;
|
||||||
public LLSDAssetUploadComplete()
|
|
||||||
{
|
public LLSDAssetUploadComplete()
|
||||||
}
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDAssetUploadRequest
|
public class LLSDAssetUploadRequest
|
||||||
{
|
{
|
||||||
public string asset_type = "";
|
public string asset_type = System.String.Empty;
|
||||||
public string description = "";
|
public string description = System.String.Empty;
|
||||||
public LLUUID folder_id = LLUUID.Zero;
|
public LLUUID folder_id = LLUUID.Zero;
|
||||||
public string inventory_type = "";
|
public string inventory_type = System.String.Empty;
|
||||||
public string name = "";
|
public string name = System.String.Empty;
|
||||||
|
|
||||||
public LLSDAssetUploadRequest()
|
public LLSDAssetUploadRequest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDAssetUploadResponse
|
public class LLSDAssetUploadResponse
|
||||||
{
|
{
|
||||||
public string uploader = "";
|
public string uploader = System.String.Empty;
|
||||||
public string state = "";
|
public string state = System.String.Empty;
|
||||||
|
|
||||||
public LLSDAssetUploadResponse()
|
public LLSDAssetUploadResponse()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,50 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
using System;
|
||||||
{
|
|
||||||
[LLSDType("MAP")]
|
namespace OpenSim.Region.Capabilities
|
||||||
public class LLSDCapsDetails
|
{
|
||||||
{
|
[LLSDType("MAP")]
|
||||||
public string MapLayer = "";
|
public class LLSDCapsDetails
|
||||||
public string NewFileAgentInventory = "";
|
{
|
||||||
//public string EventQueueGet = "";
|
public string MapLayer = String.Empty;
|
||||||
// public string RequestTextureDownload = "";
|
public string NewFileAgentInventory = String.Empty;
|
||||||
// public string ChatSessionRequest = "";
|
//public string EventQueueGet = String.Empty;
|
||||||
public string UpdateNotecardAgentInventory = "";
|
// public string RequestTextureDownload = String.Empty;
|
||||||
public string UpdateScriptAgentInventory = "";
|
// public string ChatSessionRequest = String.Empty;
|
||||||
public string UpdateScriptTaskInventory = "";
|
public string UpdateNotecardAgentInventory = String.Empty;
|
||||||
// public string ParcelVoiceInfoRequest = "";
|
public string UpdateScriptAgentInventory = String.Empty;
|
||||||
|
public string UpdateScriptTaskInventory = String.Empty;
|
||||||
public LLSDCapsDetails()
|
// public string ParcelVoiceInfoRequest = String.Empty;
|
||||||
{
|
|
||||||
}
|
public LLSDCapsDetails()
|
||||||
}
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,42 +1,42 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDItemUpdate
|
public class LLSDItemUpdate
|
||||||
{
|
{
|
||||||
public LLUUID item_id;
|
public LLUUID item_id;
|
||||||
|
|
||||||
public LLSDItemUpdate()
|
public LLSDItemUpdate()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,40 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
[LLSDType("MAP")]
|
[LLSDType("MAP")]
|
||||||
public class LLSDMapRequest
|
public class LLSDMapRequest
|
||||||
{
|
{
|
||||||
public int Flags = 0;
|
public int Flags = 0;
|
||||||
|
|
||||||
public LLSDMapRequest()
|
public LLSDMapRequest()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
|
public delegate TResponse LLSDMethod<TRequest, TResponse>(TRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +1,69 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
|
public class LLSDStreamhandler<TRequest, TResponse> : BaseStreamHandler
|
||||||
where TRequest : new()
|
where TRequest : new()
|
||||||
{
|
{
|
||||||
private LLSDMethod<TRequest, TResponse> m_method;
|
private LLSDMethod<TRequest, TResponse> m_method;
|
||||||
|
|
||||||
public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
|
public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method)
|
||||||
: base(httpMethod, path)
|
: base(httpMethod, path)
|
||||||
{
|
{
|
||||||
m_method = method;
|
m_method = method;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override byte[] Handle(string path, Stream request)
|
public override byte[] Handle(string path, Stream request)
|
||||||
{
|
{
|
||||||
//Encoding encoding = Encoding.UTF8;
|
//Encoding encoding = Encoding.UTF8;
|
||||||
//StreamReader streamReader = new StreamReader(request, false);
|
//StreamReader streamReader = new StreamReader(request, false);
|
||||||
|
|
||||||
//string requestBody = streamReader.ReadToEnd();
|
//string requestBody = streamReader.ReadToEnd();
|
||||||
//streamReader.Close();
|
//streamReader.Close();
|
||||||
|
|
||||||
// libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
|
// libsecondlife.StructuredData.LLSDMap hash = (libsecondlife.StructuredData.LLSDMap)
|
||||||
// libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
// libsecondlife.StructuredData.LLSDParser.DeserializeXml(new XmlTextReader(request));
|
||||||
|
|
||||||
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
|
||||||
TRequest llsdRequest = new TRequest();
|
TRequest llsdRequest = new TRequest();
|
||||||
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
|
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
|
||||||
|
|
||||||
TResponse response = m_method(llsdRequest);
|
TResponse response = m_method(llsdRequest);
|
||||||
|
|
||||||
Encoding encoding = new UTF8Encoding(false);
|
Encoding encoding = new UTF8Encoding(false);
|
||||||
|
|
||||||
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
|
return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,51 +1,51 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Region.Capabilities
|
namespace OpenSim.Region.Capabilities
|
||||||
{
|
{
|
||||||
[LLSDMap]
|
[LLSDMap]
|
||||||
public class LLSDTaskScriptUpdate
|
public class LLSDTaskScriptUpdate
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The item containing the script to update
|
/// The item containing the script to update
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LLUUID item_id;
|
public LLUUID item_id;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The task containing the script
|
/// The task containing the script
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LLUUID task_id;
|
public LLUUID task_id;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Signals whether the script is currently active
|
/// Signals whether the script is currently active
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int is_script_running;
|
public int is_script_running;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,228 +1,260 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
public class CommunicationsManager
|
public class CommunicationsManager
|
||||||
{
|
{
|
||||||
protected IUserService m_userService;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public IUserService UserService
|
protected IUserService m_userService;
|
||||||
{
|
|
||||||
get { return m_userService; }
|
public IUserService UserService
|
||||||
}
|
{
|
||||||
|
get { return m_userService; }
|
||||||
protected IGridServices m_gridService;
|
}
|
||||||
|
|
||||||
public IGridServices GridService
|
protected IGridServices m_gridService;
|
||||||
{
|
|
||||||
get { return m_gridService; }
|
public IGridServices GridService
|
||||||
}
|
{
|
||||||
|
get { return m_gridService; }
|
||||||
protected IInventoryServices m_inventoryService;
|
}
|
||||||
|
|
||||||
public IInventoryServices InventoryService
|
protected IInventoryServices m_inventoryService;
|
||||||
{
|
|
||||||
get { return m_inventoryService; }
|
public IInventoryServices InventoryService
|
||||||
}
|
{
|
||||||
|
get { return m_inventoryService; }
|
||||||
protected IInterRegionCommunications m_interRegion;
|
}
|
||||||
|
|
||||||
public IInterRegionCommunications InterRegion
|
protected IInterRegionCommunications m_interRegion;
|
||||||
{
|
|
||||||
get { return m_interRegion; }
|
public IInterRegionCommunications InterRegion
|
||||||
}
|
{
|
||||||
|
get { return m_interRegion; }
|
||||||
protected UserProfileCacheService m_userProfileCacheService;
|
}
|
||||||
|
|
||||||
public UserProfileCacheService UserProfileCacheService
|
protected UserProfileCacheService m_userProfileCacheService;
|
||||||
{
|
|
||||||
get { return m_userProfileCacheService; }
|
public UserProfileCacheService UserProfileCacheService
|
||||||
}
|
{
|
||||||
|
get { return m_userProfileCacheService; }
|
||||||
protected AssetTransactionManager m_transactionsManager;
|
}
|
||||||
|
|
||||||
public AssetTransactionManager TransactionsManager
|
// protected AgentAssetTransactionsManager m_transactionsManager;
|
||||||
{
|
|
||||||
get { return m_transactionsManager; }
|
// public AgentAssetTransactionsManager TransactionsManager
|
||||||
}
|
// {
|
||||||
|
// get { return m_transactionsManager; }
|
||||||
protected AssetCache m_assetCache;
|
// }
|
||||||
|
|
||||||
public AssetCache AssetCache
|
protected AssetCache m_assetCache;
|
||||||
{
|
|
||||||
get { return m_assetCache; }
|
public AssetCache AssetCache
|
||||||
}
|
{
|
||||||
|
get { return m_assetCache; }
|
||||||
protected NetworkServersInfo m_networkServersInfo;
|
}
|
||||||
|
|
||||||
public NetworkServersInfo NetworkServersInfo
|
protected NetworkServersInfo m_networkServersInfo;
|
||||||
{
|
|
||||||
get { return m_networkServersInfo; }
|
public NetworkServersInfo NetworkServersInfo
|
||||||
}
|
{
|
||||||
|
get { return m_networkServersInfo; }
|
||||||
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
|
}
|
||||||
bool dumpAssetsToFile)
|
|
||||||
{
|
public CommunicationsManager(NetworkServersInfo serversInfo, BaseHttpServer httpServer, AssetCache assetCache,
|
||||||
m_networkServersInfo = serversInfo;
|
bool dumpAssetsToFile)
|
||||||
m_assetCache = assetCache;
|
{
|
||||||
m_userProfileCacheService = new UserProfileCacheService(this);
|
m_networkServersInfo = serversInfo;
|
||||||
m_transactionsManager = new AssetTransactionManager(this, dumpAssetsToFile);
|
m_assetCache = assetCache;
|
||||||
}
|
m_userProfileCacheService = new UserProfileCacheService(this);
|
||||||
|
// m_transactionsManager = new AgentAssetTransactionsManager(this, dumpAssetsToFile);
|
||||||
public void doCreate(string[] cmmdParams)
|
}
|
||||||
{
|
|
||||||
switch (cmmdParams[0])
|
public void doCreate(string[] cmmdParams)
|
||||||
{
|
{
|
||||||
case "user":
|
switch (cmmdParams[0])
|
||||||
string firstName;
|
{
|
||||||
string lastName;
|
case "user":
|
||||||
string password;
|
string firstName;
|
||||||
uint regX = 1000;
|
string lastName;
|
||||||
uint regY = 1000;
|
string password;
|
||||||
|
uint regX = 1000;
|
||||||
if (cmmdParams.Length < 2)
|
uint regY = 1000;
|
||||||
{
|
|
||||||
firstName = MainLog.Instance.CmdPrompt("First name", "Default");
|
if (cmmdParams.Length < 2)
|
||||||
lastName = MainLog.Instance.CmdPrompt("Last name", "User");
|
{
|
||||||
password = MainLog.Instance.PasswdPrompt("Password");
|
firstName = MainConsole.Instance.CmdPrompt("First name", "Default");
|
||||||
regX = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region X", "1000"));
|
lastName = MainConsole.Instance.CmdPrompt("Last name", "User");
|
||||||
regY = Convert.ToUInt32(MainLog.Instance.CmdPrompt("Start Region Y", "1000"));
|
password = MainConsole.Instance.PasswdPrompt("Password");
|
||||||
}
|
regX = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region X", "1000"));
|
||||||
else
|
regY = Convert.ToUInt32(MainConsole.Instance.CmdPrompt("Start Region Y", "1000"));
|
||||||
{
|
}
|
||||||
firstName = cmmdParams[1];
|
else
|
||||||
lastName = cmmdParams[2];
|
{
|
||||||
password = cmmdParams[3];
|
firstName = cmmdParams[1];
|
||||||
regX = Convert.ToUInt32(cmmdParams[4]);
|
lastName = cmmdParams[2];
|
||||||
regY = Convert.ToUInt32(cmmdParams[5]);
|
password = cmmdParams[3];
|
||||||
}
|
regX = Convert.ToUInt32(cmmdParams[4]);
|
||||||
|
regY = Convert.ToUInt32(cmmdParams[5]);
|
||||||
AddUser(firstName, lastName, password, regX, regY);
|
}
|
||||||
break;
|
|
||||||
}
|
if (null == m_userService.GetUserProfile(firstName, lastName))
|
||||||
}
|
{
|
||||||
|
AddUser(firstName, lastName, password, regX, regY);
|
||||||
public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY)
|
}
|
||||||
{
|
else
|
||||||
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + "");
|
{
|
||||||
|
m_log.ErrorFormat("[USERS]: A user with the name {0} {1} already exists!", firstName, lastName);
|
||||||
m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY);
|
}
|
||||||
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName, "");
|
break;
|
||||||
if (userProf == null)
|
}
|
||||||
{
|
}
|
||||||
return LLUUID.Zero;
|
|
||||||
}
|
/// <summary>
|
||||||
else
|
/// Persistently adds a user to OpenSim.
|
||||||
{
|
/// </summary>
|
||||||
m_inventoryService.CreateNewUserInventory(userProf.UUID);
|
/// <param name="firstName"></param>
|
||||||
System.Console.WriteLine("Created new inventory set for " + firstName + " " + lastName);
|
/// <param name="lastName"></param>
|
||||||
return userProf.UUID;
|
/// <param name="password"></param>
|
||||||
}
|
/// <param name="regX"></param>
|
||||||
}
|
/// <param name="regY"></param>
|
||||||
|
/// <returns>The UUID of the added user. Returns null if the add was unsuccessful</returns>
|
||||||
#region Friend Methods
|
public LLUUID AddUser(string firstName, string lastName, string password, uint regX, uint regY)
|
||||||
/// <summary>
|
{
|
||||||
/// Adds a new friend to the database for XUser
|
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + String.Empty);
|
||||||
/// </summary>
|
|
||||||
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
|
m_userService.AddUserProfile(firstName, lastName, md5PasswdHash, regX, regY);
|
||||||
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
|
UserProfileData userProf = UserService.GetUserProfile(firstName, lastName, "");
|
||||||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
if (userProf == null)
|
||||||
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
{
|
||||||
{
|
return LLUUID.Zero;
|
||||||
m_userService.AddNewUserFriend(friendlistowner, friend, perms);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
/// <summary>
|
m_inventoryService.CreateNewUserInventory(userProf.UUID);
|
||||||
/// Delete friend on friendlistowner's friendlist.
|
System.Console.WriteLine("[USERS]: Created new inventory set for " + firstName + " " + lastName);
|
||||||
/// </summary>
|
return userProf.UUID;
|
||||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
}
|
||||||
/// <param name="friend">The Ex-friend agent</param>
|
}
|
||||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
|
||||||
{
|
#region Friend Methods
|
||||||
m_userService.RemoveUserFriend(friendlistowner, friend);
|
/// <summary>
|
||||||
}
|
/// Adds a new friend to the database for XUser
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="friendlistowner">The agent that who's friends list is being added to</param>
|
||||||
/// Update permissions for friend on friendlistowner's friendlist.
|
/// <param name="friend">The agent that being added to the friends list of the friends list owner</param>
|
||||||
/// </summary>
|
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||||
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||||
/// <param name="friend">The agent that is getting or loosing permissions</param>
|
{
|
||||||
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
m_userService.AddNewUserFriend(friendlistowner, friend, perms);
|
||||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
}
|
||||||
{
|
/// <summary>
|
||||||
m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms);
|
/// Logs off a user and does the appropriate communications
|
||||||
}
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="userid"></param>
|
||||||
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
/// <param name="regionid"></param>
|
||||||
/// </summary>
|
/// <param name="regionhandle"></param>
|
||||||
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
/// <param name="posx"></param>
|
||||||
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
/// <param name="posy"></param>
|
||||||
{
|
/// <param name="posz"></param>
|
||||||
return m_userService.GetUserFriendList(friendlistowner);
|
public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
|
||||||
}
|
{
|
||||||
|
m_userService.LogOffUser(userid, regionid, regionhandle, posx, posy, posz);
|
||||||
#endregion
|
|
||||||
|
}
|
||||||
#region Packet Handlers
|
|
||||||
|
/// <summary>
|
||||||
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
/// Delete friend on friendlistowner's friendlist.
|
||||||
{
|
/// </summary>
|
||||||
if (uuid == m_userProfileCacheService.libraryRoot.agentID)
|
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||||
{
|
/// <param name="friend">The Ex-friend agent</param>
|
||||||
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
|
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||||
}
|
{
|
||||||
else
|
m_userService.RemoveUserFriend(friendlistowner, friend);
|
||||||
{
|
}
|
||||||
UserProfileData profileData = m_userService.GetUserProfile(uuid, "");
|
|
||||||
if (profileData != null)
|
/// <summary>
|
||||||
{
|
/// Update permissions for friend on friendlistowner's friendlist.
|
||||||
LLUUID profileId = profileData.UUID;
|
/// </summary>
|
||||||
string firstname = profileData.username;
|
/// <param name="friendlistowner">The agent that who's friends list is being updated</param>
|
||||||
string lastname = profileData.surname;
|
/// <param name="friend">The agent that is getting or loosing permissions</param>
|
||||||
|
/// <param name="perms">A uint bit vector for set perms that the friend being added has; 0 = none, 1=This friend can see when they sign on, 2 = map, 4 edit objects </param>
|
||||||
remote_client.SendNameReply(profileId, firstname, lastname);
|
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||||
}
|
{
|
||||||
}
|
m_userService.UpdateUserFriendPerms(friendlistowner, friend, perms);
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
/// Returns a list of FriendsListItems that describe the friends and permissions in the friend relationship for LLUUID friendslistowner
|
||||||
{
|
/// </summary>
|
||||||
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
/// <param name="friendlistowner">The agent that we're retreiving the friends Data.</param>
|
||||||
return pickerlist;
|
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
||||||
}
|
{
|
||||||
|
return m_userService.GetUserFriendList(friendlistowner);
|
||||||
#endregion
|
}
|
||||||
}
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
|
#region Packet Handlers
|
||||||
|
|
||||||
|
public void HandleUUIDNameRequest(LLUUID uuid, IClientAPI remote_client)
|
||||||
|
{
|
||||||
|
if (uuid == m_userProfileCacheService.libraryRoot.agentID)
|
||||||
|
{
|
||||||
|
remote_client.SendNameReply(uuid, "Mr", "OpenSim");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UserProfileData profileData = m_userService.GetUserProfile(uuid, "");
|
||||||
|
if (profileData != null)
|
||||||
|
{
|
||||||
|
LLUUID profileId = profileData.UUID;
|
||||||
|
string firstname = profileData.username;
|
||||||
|
string lastname = profileData.surname;
|
||||||
|
|
||||||
|
remote_client.SendNameReply(profileId, firstname, lastname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AvatarPickerAvatar> GenerateAgentPickerRequestResponse(LLUUID queryID, string query)
|
||||||
|
{
|
||||||
|
List<AvatarPickerAvatar> pickerlist = m_userService.GenerateAgentPickerRequestResponse(queryID, query);
|
||||||
|
return pickerlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,48 +1,50 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
public interface IInterRegionCommunications
|
public interface IInterRegionCommunications
|
||||||
{
|
{
|
||||||
string rdebugRegionName { get; set; }
|
string rdebugRegionName { get; set; }
|
||||||
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
|
bool Available { get; }
|
||||||
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
|
void CheckRegion(string address, uint port);
|
||||||
bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
|
bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData);
|
||||||
bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
|
bool InformRegionOfPrimCrossing(ulong regionHandle, LLUUID primID, string objData);
|
||||||
|
bool RegionUp(SearializableRegionInfo region, ulong regionhandle);
|
||||||
bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
|
bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
|
||||||
bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);
|
|
||||||
|
bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
|
||||||
bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId);
|
bool ExpectPrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isFlying);
|
||||||
bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID);
|
|
||||||
|
bool AcknowledgeAgentCrossed(ulong regionHandle, LLUUID agentId);
|
||||||
void TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
|
bool AcknowledgePrimCrossed(ulong regionHandle, LLUUID primID);
|
||||||
}
|
|
||||||
}
|
bool TellRegionToCloseChildConnection(ulong regionHandle, LLUUID agentID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,55 +1,100 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Communications.Cache;
|
using OpenSim.Framework.Communications.Cache;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
|
public delegate void InventoryFolderInfo(LLUUID userID, InventoryFolderImpl folderInfo);
|
||||||
|
|
||||||
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
|
public delegate void InventoryItemInfo(LLUUID userID, InventoryItemBase itemInfo);
|
||||||
|
|
||||||
public interface IInventoryServices
|
/// <summary>
|
||||||
{
|
/// Defines all the operations one can perform on a user's inventory.
|
||||||
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
|
/// </summary>
|
||||||
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
public interface IInventoryServices
|
||||||
void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
{
|
||||||
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, InventoryItemInfo itemCallBack);
|
||||||
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
|
||||||
void CreateNewUserInventory(LLUUID user);
|
/// <summary>
|
||||||
|
/// Add a new folder to the given user's inventory
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
|
/// <param name="userID"></param>
|
||||||
/// </summary>
|
/// <param name="folder"></param>
|
||||||
/// <param name="userID"></param>
|
void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
/// <returns></returns>
|
|
||||||
List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
|
void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
}
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Add a new item to the given user's inventory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Delete an item from the given user's inventory
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new inventory for the given user
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
void CreateNewUserInventory(LLUUID user);
|
||||||
|
|
||||||
|
bool HasInventoryForUser(LLUUID userID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the root inventory folder for the given user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <returns>null if no root folder was found</returns>
|
||||||
|
InventoryFolderBase RequestRootFolder(LLUUID userID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
|
||||||
|
/// for the given user.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the named folder in that users inventory, returns null if folder is not found.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userID"></param>
|
||||||
|
/// <param name="folderName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,390 +1,389 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
public abstract class InventoryServiceBase : IInventoryServices
|
public abstract class InventoryServiceBase : IInventoryServices
|
||||||
{
|
{
|
||||||
protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
|
private static readonly log4net.ILog m_log
|
||||||
//protected IAssetServer m_assetServer;
|
= log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public InventoryServiceBase()
|
protected Dictionary<string, IInventoryData> m_plugins = new Dictionary<string, IInventoryData>();
|
||||||
{
|
|
||||||
//m_assetServer = assetServer;
|
#region Plugin methods
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Adds a new user server plugin - plugins will be requested in the order they were loaded.
|
||||||
/// Adds a new user server plugin - plugins will be requested in the order they were loaded.
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="FileName">The filename to the user server plugin DLL</param>
|
||||||
/// <param name="FileName">The filename to the user server plugin DLL</param>
|
public void AddPlugin(string FileName)
|
||||||
public void AddPlugin(string FileName)
|
{
|
||||||
{
|
if (!String.IsNullOrEmpty(FileName))
|
||||||
if (!String.IsNullOrEmpty(FileName))
|
{
|
||||||
{
|
m_log.Info("[AGENTINVENTORY]: Inventorystorage: Attempting to load " + FileName);
|
||||||
MainLog.Instance.Verbose("AGENTINVENTORY", "Inventorystorage: Attempting to load " + FileName);
|
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
||||||
Assembly pluginAssembly = Assembly.LoadFrom(FileName);
|
|
||||||
|
foreach (Type pluginType in pluginAssembly.GetTypes())
|
||||||
foreach (Type pluginType in pluginAssembly.GetTypes())
|
{
|
||||||
{
|
if (!pluginType.IsAbstract)
|
||||||
if (!pluginType.IsAbstract)
|
{
|
||||||
{
|
Type typeInterface = pluginType.GetInterface("IInventoryData", true);
|
||||||
Type typeInterface = pluginType.GetInterface("IInventoryData", true);
|
|
||||||
|
if (typeInterface != null)
|
||||||
if (typeInterface != null)
|
{
|
||||||
{
|
IInventoryData plug =
|
||||||
IInventoryData plug =
|
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
||||||
(IInventoryData) Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString()));
|
plug.Initialise();
|
||||||
plug.Initialise();
|
m_plugins.Add(plug.getName(), plug);
|
||||||
m_plugins.Add(plug.getName(), plug);
|
m_log.Info("[AGENTINVENTORY]: Added IInventoryData Interface");
|
||||||
MainLog.Instance.Verbose("AGENTINVENTORY", "Added IInventoryData Interface");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#endregion
|
||||||
public List<InventoryFolderBase> RequestFirstLevelFolders(Guid rawUserID)
|
|
||||||
{
|
#region IInventoryServices methods
|
||||||
LLUUID userID = new LLUUID(rawUserID);
|
|
||||||
return RequestFirstLevelFolders(userID);
|
// See IInventoryServices
|
||||||
}
|
public List<InventoryFolderBase> RequestFirstLevelFolders(Guid rawUserID)
|
||||||
|
{
|
||||||
/// <summary>
|
LLUUID userID = new LLUUID(rawUserID);
|
||||||
/// Returns the root folder plus any folders in root (so down one level in the Inventory folders tree)
|
return RequestFirstLevelFolders(userID);
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns></returns>
|
// See IInventoryServices
|
||||||
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
|
public List<InventoryFolderBase> RequestFirstLevelFolders(LLUUID userID)
|
||||||
{
|
{
|
||||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||||
InventoryFolderBase rootFolder = null;
|
InventoryFolderBase rootFolder = null;
|
||||||
|
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
{
|
{
|
||||||
rootFolder = plugin.Value.getUserRootFolder(userID);
|
rootFolder = plugin.Value.getUserRootFolder(userID);
|
||||||
if (rootFolder != null)
|
if (rootFolder != null)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose(
|
m_log.Info(
|
||||||
"INVENTORY",
|
"[INVENTORY]: Found root folder for user with ID " + userID + ". Retrieving inventory contents.");
|
||||||
"Found root folder for user with ID " + userID + ". Retrieving inventory contents.");
|
|
||||||
|
inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
|
||||||
inventoryList = plugin.Value.getInventoryFolders(rootFolder.folderID);
|
inventoryList.Insert(0, rootFolder);
|
||||||
inventoryList.Insert(0, rootFolder);
|
return inventoryList;
|
||||||
return inventoryList;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
m_log.Warn(
|
||||||
MainLog.Instance.Warn(
|
"[INVENTORY]: Could not find a root folder belonging to user with ID " + userID);
|
||||||
"INVENTORY", "Could not find a root folder belonging to user with ID " + userID);
|
|
||||||
|
return inventoryList;
|
||||||
return inventoryList;
|
}
|
||||||
}
|
|
||||||
|
// See IInventoryServices
|
||||||
/// <summary>
|
public InventoryFolderBase RequestUsersRoot(LLUUID userID)
|
||||||
/// Get the root folder for a user
|
{
|
||||||
/// </summary>
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
/// <param name="userID"></param>
|
{
|
||||||
/// <returns>null if no root folder was found</returns>
|
return plugin.Value.getUserRootFolder(userID);
|
||||||
public InventoryFolderBase RequestUsersRoot(LLUUID userID)
|
}
|
||||||
{
|
return null;
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
}
|
||||||
{
|
|
||||||
return plugin.Value.getUserRootFolder(userID);
|
// See IInventoryServices
|
||||||
}
|
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
||||||
return null;
|
{
|
||||||
}
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
|
{
|
||||||
/// <summary>
|
plugin.Value.moveInventoryFolder(folder);
|
||||||
///
|
}
|
||||||
/// </summary>
|
}
|
||||||
public void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder)
|
|
||||||
{
|
public virtual bool HasInventoryForUser(LLUUID userID)
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
{
|
||||||
{
|
return false;
|
||||||
plugin.Value.moveInventoryFolder(folder);
|
}
|
||||||
}
|
|
||||||
}
|
// See IInventoryServices
|
||||||
|
public InventoryFolderBase RequestRootFolder(LLUUID userID)
|
||||||
/// <summary>
|
{
|
||||||
///
|
return RequestUsersRoot(userID);
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="parentFolderID"></param>
|
|
||||||
/// <returns></returns>
|
// See IInventoryServices
|
||||||
public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
|
public virtual InventoryFolderBase RequestNamedFolder(LLUUID userID, string folderName)
|
||||||
{
|
{
|
||||||
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
return null;
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
}
|
||||||
{
|
|
||||||
return plugin.Value.getInventoryFolders(parentFolderID);
|
// See IInventoryServices
|
||||||
}
|
public void CreateNewUserInventory(LLUUID user)
|
||||||
return inventoryList;
|
{
|
||||||
}
|
InventoryFolderBase existingRootFolder = RequestUsersRoot(user);
|
||||||
|
|
||||||
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
|
if (null != existingRootFolder)
|
||||||
{
|
{
|
||||||
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
m_log.ErrorFormat("[AGENTINVENTORY]: " +
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
"Did not create a new inventory for user {0} since they already have "
|
||||||
{
|
+ "a root inventory folder with id {1}", user, existingRootFolder);
|
||||||
itemsList = plugin.Value.getInventoryInFolder(folderID);
|
}
|
||||||
return itemsList;
|
else
|
||||||
}
|
{
|
||||||
return itemsList;
|
UsersInventory inven = new UsersInventory();
|
||||||
}
|
inven.CreateNewInventorySet(user);
|
||||||
|
AddNewInventorySet(inven);
|
||||||
public void AddFolder(InventoryFolderBase folder)
|
}
|
||||||
{
|
}
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
|
||||||
{
|
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
||||||
plugin.Value.addInventoryFolder(folder);
|
InventoryItemInfo itemCallBack);
|
||||||
}
|
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
||||||
}
|
public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
|
||||||
|
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
public void MoveFolder(InventoryFolderBase folder)
|
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
||||||
{
|
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
#endregion
|
||||||
{
|
|
||||||
plugin.Value.moveInventoryFolder(folder);
|
#region Methods used by GridInventoryService
|
||||||
}
|
|
||||||
}
|
public List<InventoryFolderBase> RequestSubFolders(LLUUID parentFolderID)
|
||||||
|
{
|
||||||
public void AddItem(InventoryItemBase item)
|
List<InventoryFolderBase> inventoryList = new List<InventoryFolderBase>();
|
||||||
{
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
{
|
||||||
{
|
return plugin.Value.getInventoryFolders(parentFolderID);
|
||||||
plugin.Value.addInventoryItem(item);
|
}
|
||||||
}
|
return inventoryList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteItem(InventoryItemBase item)
|
public List<InventoryItemBase> RequestFolderItems(LLUUID folderID)
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
List<InventoryItemBase> itemsList = new List<InventoryItemBase>();
|
||||||
{
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
plugin.Value.deleteInventoryItem(item.inventoryID);
|
{
|
||||||
}
|
itemsList = plugin.Value.getInventoryInFolder(folderID);
|
||||||
}
|
return itemsList;
|
||||||
|
}
|
||||||
/// <summary>
|
return itemsList;
|
||||||
///
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="inventory"></param>
|
#endregion
|
||||||
public void AddNewInventorySet(UsersInventory inventory)
|
|
||||||
{
|
protected void AddFolder(InventoryFolderBase folder)
|
||||||
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
{
|
||||||
{
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
AddFolder(folder);
|
{
|
||||||
}
|
plugin.Value.addInventoryFolder(folder);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Create a new set of inventory folders for the given user.
|
protected void MoveFolder(InventoryFolderBase folder)
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="user"></param>
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
public void CreateNewUserInventory(LLUUID user)
|
{
|
||||||
{
|
plugin.Value.moveInventoryFolder(folder);
|
||||||
InventoryFolderBase existingRootFolder = RequestUsersRoot(user);
|
}
|
||||||
|
}
|
||||||
if (null != existingRootFolder)
|
|
||||||
{
|
protected void AddItem(InventoryItemBase item)
|
||||||
MainLog.Instance.Error(
|
{
|
||||||
"AGENTINVENTORY",
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
"Did not create a new inventory for user {0} since they already have "
|
{
|
||||||
+ "a root inventory folder with id {1}", user, existingRootFolder);
|
plugin.Value.addInventoryItem(item);
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
UsersInventory inven = new UsersInventory();
|
protected void DeleteItem(InventoryItemBase item)
|
||||||
inven.CreateNewInventorySet(user);
|
{
|
||||||
AddNewInventorySet(inven);
|
foreach (KeyValuePair<string, IInventoryData> plugin in m_plugins)
|
||||||
}
|
{
|
||||||
}
|
plugin.Value.deleteInventoryItem(item.inventoryID);
|
||||||
|
}
|
||||||
public class UsersInventory
|
}
|
||||||
{
|
|
||||||
public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
|
private void AddNewInventorySet(UsersInventory inventory)
|
||||||
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
|
{
|
||||||
|
foreach (InventoryFolderBase folder in inventory.Folders.Values)
|
||||||
public UsersInventory()
|
{
|
||||||
{
|
AddFolder(folder);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public virtual void CreateNewInventorySet(LLUUID user)
|
|
||||||
{
|
private class UsersInventory
|
||||||
InventoryFolderBase folder = new InventoryFolderBase();
|
{
|
||||||
folder.parentID = LLUUID.Zero;
|
public Dictionary<LLUUID, InventoryFolderBase> Folders = new Dictionary<LLUUID, InventoryFolderBase>();
|
||||||
folder.agentID = user;
|
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
|
||||||
folder.folderID = LLUUID.Random();
|
|
||||||
folder.name = "My Inventory";
|
public virtual void CreateNewInventorySet(LLUUID user)
|
||||||
folder.type = 8;
|
{
|
||||||
folder.version = 1;
|
InventoryFolderBase folder = new InventoryFolderBase();
|
||||||
Folders.Add(folder.folderID, folder);
|
|
||||||
|
folder.parentID = LLUUID.Zero;
|
||||||
LLUUID rootFolder = folder.folderID;
|
folder.agentID = user;
|
||||||
|
folder.folderID = LLUUID.Random();
|
||||||
folder = new InventoryFolderBase();
|
folder.name = "My Inventory";
|
||||||
folder.parentID = rootFolder;
|
folder.type = 8;
|
||||||
folder.agentID = user;
|
folder.version = 1;
|
||||||
folder.folderID = LLUUID.Random();
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.name = "Accessories";
|
|
||||||
folder.type = 8;
|
LLUUID rootFolder = folder.folderID;
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Accessories";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 8;
|
||||||
folder.name = "Animations";
|
folder.version = 1;
|
||||||
folder.type = 20;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Animations";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 20;
|
||||||
folder.name = "BodyParts";
|
folder.version = 1;
|
||||||
folder.type = 13;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "BodyParts";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 13;
|
||||||
folder.name = "Clothing";
|
folder.version = 1;
|
||||||
folder.type = 5;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Clothing";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 5;
|
||||||
folder.name = "Gestures";
|
folder.version = 1;
|
||||||
folder.type = 21;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Gestures";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 21;
|
||||||
folder.name = "Landmarks";
|
folder.version = 1;
|
||||||
folder.type = 3;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Landmarks";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 3;
|
||||||
folder.name = "Lost And Found";
|
folder.version = 1;
|
||||||
folder.type = 3;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Lost And Found";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 3;
|
||||||
folder.name = "Notecards";
|
folder.version = 1;
|
||||||
folder.type = 7;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Notecards";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 7;
|
||||||
folder.name = "Objects";
|
folder.version = 1;
|
||||||
folder.type = 6;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Objects";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 6;
|
||||||
folder.name = "Photo Album";
|
folder.version = 1;
|
||||||
folder.type = 15;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Photo Album";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 15;
|
||||||
folder.name = "Scripts";
|
folder.version = 1;
|
||||||
folder.type = 10;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Scripts";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 10;
|
||||||
folder.name = "Sounds";
|
folder.version = 1;
|
||||||
folder.type = 1;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Sounds";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 1;
|
||||||
folder.name = "Textures";
|
folder.version = 1;
|
||||||
folder.type = 0;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
|
folder.parentID = rootFolder;
|
||||||
folder = new InventoryFolderBase();
|
folder.agentID = user;
|
||||||
folder.parentID = rootFolder;
|
folder.folderID = LLUUID.Random();
|
||||||
folder.agentID = user;
|
folder.name = "Textures";
|
||||||
folder.folderID = LLUUID.Random();
|
folder.type = 0;
|
||||||
folder.name = "Trash";
|
folder.version = 1;
|
||||||
folder.type = 14;
|
Folders.Add(folder.folderID, folder);
|
||||||
folder.version = 1;
|
|
||||||
Folders.Add(folder.folderID, folder);
|
folder = new InventoryFolderBase();
|
||||||
}
|
folder.parentID = rootFolder;
|
||||||
}
|
folder.agentID = user;
|
||||||
|
folder.folderID = LLUUID.Random();
|
||||||
public abstract void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
|
folder.name = "Trash";
|
||||||
InventoryItemInfo itemCallBack);
|
folder.type = 14;
|
||||||
|
folder.version = 1;
|
||||||
public abstract void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
|
Folders.Add(folder.folderID, folder);
|
||||||
public abstract void MoveExistingInventoryFolder(InventoryFolderBase folder);
|
}
|
||||||
public abstract void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
|
}
|
||||||
public abstract void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,65 +1,65 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// General Information about an assembly is controlled through the following
|
// General Information about an assembly is controlled through the following
|
||||||
// set of attributes. Change these attribute values to modify the information
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// associated with an assembly.
|
// associated with an assembly.
|
||||||
|
|
||||||
[assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
|
[assembly : AssemblyTitle("OpenGrid.Framework.Communications")]
|
||||||
[assembly : AssemblyDescription("")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyConfiguration("")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
[assembly : AssemblyCompany("")]
|
[assembly : AssemblyCompany("")]
|
||||||
[assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
|
[assembly : AssemblyProduct("OpenGrid.Framework.Communications")]
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
[assembly : AssemblyTrademark("")]
|
[assembly : AssemblyTrademark("")]
|
||||||
[assembly : AssemblyCulture("")]
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
[assembly : ComVisible(false)]
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
|
[assembly : Guid("13e7c396-78a9-4a5c-baf2-6f980ea75d95")]
|
||||||
|
|
||||||
// Version information for an assembly consists of the following four values:
|
// Version information for an assembly consists of the following four values:
|
||||||
//
|
//
|
||||||
// Major Version
|
// Major Version
|
||||||
// Minor Version
|
// Minor Version
|
||||||
// Build Number
|
// Build Number
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -1,443 +1,446 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Communications
|
namespace OpenSim.Framework.Communications
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Implementation of a generic REST client
|
/// Implementation of a generic REST client
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This class is a generic implementation of a REST (Representational State Transfer) web service. This
|
/// This class is a generic implementation of a REST (Representational State Transfer) web service. This
|
||||||
/// class is designed to execute both synchroneously and asynchroneously.
|
/// class is designed to execute both synchroneously and asynchroneously.
|
||||||
///
|
///
|
||||||
/// Internally the implementation works as a two stage asynchroneous web-client.
|
/// Internally the implementation works as a two stage asynchroneous web-client.
|
||||||
/// When the request is initiated, RestClient will query asynchroneously for for a web-response,
|
/// When the request is initiated, RestClient will query asynchroneously for for a web-response,
|
||||||
/// sleeping until the initial response is returned by the server. Once the initial response is retrieved
|
/// sleeping until the initial response is returned by the server. Once the initial response is retrieved
|
||||||
/// the second stage of asynchroneous requests will be triggered, in an attempt to read of the response
|
/// the second stage of asynchroneous requests will be triggered, in an attempt to read of the response
|
||||||
/// object into a memorystream as a sequence of asynchroneous reads.
|
/// object into a memorystream as a sequence of asynchroneous reads.
|
||||||
///
|
///
|
||||||
/// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing
|
/// The asynchronisity of RestClient is designed to move as much processing into the back-ground, allowing
|
||||||
/// other threads to execute, while it waits for a response from the web-service. RestClient it self, can be
|
/// other threads to execute, while it waits for a response from the web-service. RestClient it self, can be
|
||||||
/// invoked by the caller in either synchroneous mode or asynchroneous mode.
|
/// invoked by the caller in either synchroneous mode or asynchroneous mode.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public class RestClient
|
public class RestClient
|
||||||
{
|
{
|
||||||
private string realuri;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
#region member variables
|
private string realuri;
|
||||||
|
|
||||||
/// <summary>
|
#region member variables
|
||||||
/// The base Uri of the web-service e.g. http://www.google.com
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private string _url;
|
/// The base Uri of the web-service e.g. http://www.google.com
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private string _url;
|
||||||
/// Path elements of the query
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private List<string> _pathElements = new List<string>();
|
/// Path elements of the query
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private List<string> _pathElements = new List<string>();
|
||||||
/// Parameter elements of the query, e.g. min=34
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private Dictionary<string, string> _parameterElements = new Dictionary<string, string>();
|
/// Parameter elements of the query, e.g. min=34
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private Dictionary<string, string> _parameterElements = new Dictionary<string, string>();
|
||||||
/// Request method. E.g. GET, POST, PUT or DELETE
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private string _method;
|
/// Request method. E.g. GET, POST, PUT or DELETE
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private string _method;
|
||||||
/// Temporary buffer used to store bytes temporarily as they come in from the server
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private byte[] _readbuf;
|
/// Temporary buffer used to store bytes temporarily as they come in from the server
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private byte[] _readbuf;
|
||||||
/// MemoryStream representing the resultiong resource
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private Stream _resource;
|
/// MemoryStream representing the resultiong resource
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private Stream _resource;
|
||||||
/// WebRequest object, held as a member variable
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private HttpWebRequest _request;
|
/// WebRequest object, held as a member variable
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private HttpWebRequest _request;
|
||||||
/// WebResponse object, held as a member variable, so we can close it
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private HttpWebResponse _response;
|
/// WebResponse object, held as a member variable, so we can close it
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private HttpWebResponse _response;
|
||||||
/// This flag will help block the main synchroneous method, in case we run in synchroneous mode
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public static ManualResetEvent _allDone = new ManualResetEvent(false);
|
/// This flag will help block the main synchroneous method, in case we run in synchroneous mode
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
public static ManualResetEvent _allDone = new ManualResetEvent(false);
|
||||||
/// Default time out period
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private const int DefaultTimeout = 10*1000; // 10 seconds timeout
|
/// Default time out period
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private const int DefaultTimeout = 10*1000; // 10 seconds timeout
|
||||||
/// Default Buffer size of a block requested from the web-server
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private const int BufferSize = 4096; // Read blocks of 4 KB.
|
/// Default Buffer size of a block requested from the web-server
|
||||||
|
/// </summary>
|
||||||
|
private const int BufferSize = 4096; // Read blocks of 4 KB.
|
||||||
/// <summary>
|
|
||||||
/// if an exception occours during async processing, we need to save it, so it can be
|
|
||||||
/// rethrown on the primary thread;
|
/// <summary>
|
||||||
/// </summary>
|
/// if an exception occours during async processing, we need to save it, so it can be
|
||||||
private Exception _asyncException;
|
/// rethrown on the primary thread;
|
||||||
|
/// </summary>
|
||||||
#endregion member variables
|
private Exception _asyncException;
|
||||||
|
|
||||||
#region constructors
|
#endregion member variables
|
||||||
|
|
||||||
/// <summary>
|
#region constructors
|
||||||
/// Instantiate a new RestClient
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="url">Web-service to query, e.g. http://osgrid.org:8003</param>
|
/// Instantiate a new RestClient
|
||||||
public RestClient(string url)
|
/// </summary>
|
||||||
{
|
/// <param name="url">Web-service to query, e.g. http://osgrid.org:8003</param>
|
||||||
_url = url;
|
public RestClient(string url)
|
||||||
_readbuf = new byte[BufferSize];
|
{
|
||||||
_resource = new MemoryStream();
|
_url = url;
|
||||||
_request = null;
|
_readbuf = new byte[BufferSize];
|
||||||
_response = null;
|
_resource = new MemoryStream();
|
||||||
_lock = new object();
|
_request = null;
|
||||||
}
|
_response = null;
|
||||||
|
_lock = new object();
|
||||||
private object _lock;
|
}
|
||||||
|
|
||||||
#endregion constructors
|
private object _lock;
|
||||||
|
|
||||||
/// <summary>
|
#endregion constructors
|
||||||
/// Add a path element to the query, e.g. assets
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="element">path entry</param>
|
/// Add a path element to the query, e.g. assets
|
||||||
public void AddResourcePath(string element)
|
/// </summary>
|
||||||
{
|
/// <param name="element">path entry</param>
|
||||||
if (isSlashed(element))
|
public void AddResourcePath(string element)
|
||||||
_pathElements.Add(element.Substring(0, element.Length - 1));
|
{
|
||||||
else
|
if (isSlashed(element))
|
||||||
_pathElements.Add(element);
|
_pathElements.Add(element.Substring(0, element.Length - 1));
|
||||||
}
|
else
|
||||||
|
_pathElements.Add(element);
|
||||||
/// <summary>
|
}
|
||||||
/// Add a query parameter to the Url
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="name">Name of the parameter, e.g. min</param>
|
/// Add a query parameter to the Url
|
||||||
/// <param name="value">Value of the parameter, e.g. 42</param>
|
/// </summary>
|
||||||
public void AddQueryParameter(string name, string value)
|
/// <param name="name">Name of the parameter, e.g. min</param>
|
||||||
{
|
/// <param name="value">Value of the parameter, e.g. 42</param>
|
||||||
_parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
|
public void AddQueryParameter(string name, string value)
|
||||||
}
|
{
|
||||||
|
_parameterElements.Add(HttpUtility.UrlEncode(name), HttpUtility.UrlEncode(value));
|
||||||
/// <summary>
|
}
|
||||||
/// Add a query parameter to the Url
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="name">Name of the parameter, e.g. min</param>
|
/// Add a query parameter to the Url
|
||||||
public void AddQueryParameter(string name)
|
/// </summary>
|
||||||
{
|
/// <param name="name">Name of the parameter, e.g. min</param>
|
||||||
_parameterElements.Add(HttpUtility.UrlEncode(name), null);
|
public void AddQueryParameter(string name)
|
||||||
}
|
{
|
||||||
|
_parameterElements.Add(HttpUtility.UrlEncode(name), null);
|
||||||
/// <summary>
|
}
|
||||||
/// Web-Request method, e.g. GET, PUT, POST, DELETE
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public string RequestMethod
|
/// Web-Request method, e.g. GET, PUT, POST, DELETE
|
||||||
{
|
/// </summary>
|
||||||
get { return _method; }
|
public string RequestMethod
|
||||||
set { _method = value; }
|
{
|
||||||
}
|
get { return _method; }
|
||||||
|
set { _method = value; }
|
||||||
/// <summary>
|
}
|
||||||
/// True if string contains a trailing slash '/'
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="s">string to be examined</param>
|
/// True if string contains a trailing slash '/'
|
||||||
/// <returns>true if slash is present</returns>
|
/// </summary>
|
||||||
private bool isSlashed(string s)
|
/// <param name="s">string to be examined</param>
|
||||||
{
|
/// <returns>true if slash is present</returns>
|
||||||
return s.Substring(s.Length - 1, 1) == "/";
|
private bool isSlashed(string s)
|
||||||
}
|
{
|
||||||
|
return s.Substring(s.Length - 1, 1) == "/";
|
||||||
/// <summary>
|
}
|
||||||
/// return a slash or blank. A slash will be returned if the string does not contain one
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="s">stromg to be examined</param>
|
/// return a slash or blank. A slash will be returned if the string does not contain one
|
||||||
/// <returns>slash '/' if not already present</returns>
|
/// </summary>
|
||||||
private string slash(string s)
|
/// <param name="s">stromg to be examined</param>
|
||||||
{
|
/// <returns>slash '/' if not already present</returns>
|
||||||
return isSlashed(s) ? "" : "/";
|
private string slash(string s)
|
||||||
}
|
{
|
||||||
|
return isSlashed(s) ? String.Empty : "/";
|
||||||
/// <summary>
|
}
|
||||||
/// Build a Uri based on the initial Url, path elements and parameters
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <returns>fully constructed Uri</returns>
|
/// Build a Uri based on the initial Url, path elements and parameters
|
||||||
private Uri buildUri()
|
/// </summary>
|
||||||
{
|
/// <returns>fully constructed Uri</returns>
|
||||||
StringBuilder sb = new StringBuilder();
|
private Uri buildUri()
|
||||||
sb.Append(_url);
|
{
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
foreach (string e in _pathElements)
|
sb.Append(_url);
|
||||||
{
|
|
||||||
sb.Append("/");
|
foreach (string e in _pathElements)
|
||||||
sb.Append(e);
|
{
|
||||||
}
|
sb.Append("/");
|
||||||
|
sb.Append(e);
|
||||||
bool firstElement = true;
|
}
|
||||||
foreach (KeyValuePair<string, string> kv in _parameterElements)
|
|
||||||
{
|
bool firstElement = true;
|
||||||
if (firstElement)
|
foreach (KeyValuePair<string, string> kv in _parameterElements)
|
||||||
{
|
{
|
||||||
sb.Append("?");
|
if (firstElement)
|
||||||
firstElement = false;
|
{
|
||||||
}
|
sb.Append("?");
|
||||||
else
|
firstElement = false;
|
||||||
sb.Append("&");
|
}
|
||||||
|
else
|
||||||
sb.Append(kv.Key);
|
sb.Append("&");
|
||||||
if (kv.Value != null && kv.Value.Length != 0)
|
|
||||||
{
|
sb.Append(kv.Key);
|
||||||
sb.Append("=");
|
if (kv.Value != null && kv.Value.Length != 0)
|
||||||
sb.Append(kv.Value);
|
{
|
||||||
}
|
sb.Append("=");
|
||||||
}
|
sb.Append(kv.Value);
|
||||||
realuri = sb.ToString();
|
}
|
||||||
MainLog.Instance.Verbose("REST", "RestURL: {0}", realuri);
|
}
|
||||||
return new Uri(sb.ToString());
|
realuri = sb.ToString();
|
||||||
}
|
m_log.InfoFormat("[REST]: RestURL: {0}", realuri);
|
||||||
|
return new Uri(sb.ToString());
|
||||||
#region Async communications with server
|
}
|
||||||
|
|
||||||
/// <summary>
|
#region Async communications with server
|
||||||
/// Async method, invoked when a block of data has been received from the service
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="ar"></param>
|
/// Async method, invoked when a block of data has been received from the service
|
||||||
private void StreamIsReadyDelegate(IAsyncResult ar)
|
/// </summary>
|
||||||
{
|
/// <param name="ar"></param>
|
||||||
try
|
private void StreamIsReadyDelegate(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
Stream s = (Stream) ar.AsyncState;
|
try
|
||||||
int read = s.EndRead(ar);
|
{
|
||||||
|
Stream s = (Stream) ar.AsyncState;
|
||||||
if (read > 0)
|
int read = s.EndRead(ar);
|
||||||
{
|
|
||||||
_resource.Write(_readbuf, 0, read);
|
if (read > 0)
|
||||||
IAsyncResult asynchronousResult =
|
{
|
||||||
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
|
_resource.Write(_readbuf, 0, read);
|
||||||
|
IAsyncResult asynchronousResult =
|
||||||
// TODO! Implement timeout, without killing the server
|
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
|
||||||
//ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
|
||||||
}
|
// TODO! Implement timeout, without killing the server
|
||||||
else
|
//ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||||
{
|
}
|
||||||
s.Close();
|
else
|
||||||
_allDone.Set();
|
{
|
||||||
}
|
s.Close();
|
||||||
}
|
_allDone.Set();
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
}
|
||||||
_allDone.Set();
|
catch (Exception e)
|
||||||
_asyncException = e;
|
{
|
||||||
}
|
_allDone.Set();
|
||||||
}
|
_asyncException = e;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Async method, invoked when the initial response if received from the server
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="ar"></param>
|
/// Async method, invoked when the initial response if received from the server
|
||||||
private void ResponseIsReadyDelegate(IAsyncResult ar)
|
/// </summary>
|
||||||
{
|
/// <param name="ar"></param>
|
||||||
try
|
private void ResponseIsReadyDelegate(IAsyncResult ar)
|
||||||
{
|
{
|
||||||
// grab response
|
try
|
||||||
WebRequest wr = (WebRequest) ar.AsyncState;
|
{
|
||||||
_response = (HttpWebResponse) wr.EndGetResponse(ar);
|
// grab response
|
||||||
|
WebRequest wr = (WebRequest) ar.AsyncState;
|
||||||
// get response stream, and setup async reading
|
_response = (HttpWebResponse) wr.EndGetResponse(ar);
|
||||||
Stream s = _response.GetResponseStream();
|
|
||||||
IAsyncResult asynchronousResult =
|
// get response stream, and setup async reading
|
||||||
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
|
Stream s = _response.GetResponseStream();
|
||||||
|
IAsyncResult asynchronousResult =
|
||||||
// TODO! Implement timeout, without killing the server
|
s.BeginRead(_readbuf, 0, BufferSize, new AsyncCallback(StreamIsReadyDelegate), s);
|
||||||
// wait until completed, or we timed out
|
|
||||||
// ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
// TODO! Implement timeout, without killing the server
|
||||||
}
|
// wait until completed, or we timed out
|
||||||
catch (Exception e)
|
// ThreadPool.RegisterWaitForSingleObject(asynchronousResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||||
{
|
}
|
||||||
_allDone.Set();
|
catch (Exception e)
|
||||||
_asyncException = e;
|
{
|
||||||
}
|
_allDone.Set();
|
||||||
}
|
_asyncException = e;
|
||||||
|
}
|
||||||
// Abort the request if the timer fires.
|
}
|
||||||
private static void TimeoutCallback(object state, bool timedOut)
|
|
||||||
{
|
// Abort the request if the timer fires.
|
||||||
if (timedOut)
|
private static void TimeoutCallback(object state, bool timedOut)
|
||||||
{
|
{
|
||||||
HttpWebRequest request = state as HttpWebRequest;
|
if (timedOut)
|
||||||
if (request != null)
|
{
|
||||||
{
|
HttpWebRequest request = state as HttpWebRequest;
|
||||||
request.Abort();
|
if (request != null)
|
||||||
}
|
{
|
||||||
}
|
request.Abort();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endregion Async communications with server
|
}
|
||||||
|
|
||||||
/// <summary>
|
#endregion Async communications with server
|
||||||
/// Perform synchroneous request
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public Stream Request()
|
/// Perform synchroneous request
|
||||||
{
|
/// </summary>
|
||||||
lock (_lock)
|
public Stream Request()
|
||||||
{
|
{
|
||||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
lock (_lock)
|
||||||
_request.KeepAlive = false;
|
{
|
||||||
_request.ContentType = "application/xml";
|
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||||
_request.Timeout = 200000;
|
_request.KeepAlive = false;
|
||||||
_asyncException = null;
|
_request.ContentType = "application/xml";
|
||||||
|
_request.Timeout = 200000;
|
||||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
_asyncException = null;
|
||||||
_response = (HttpWebResponse) _request.GetResponse();
|
|
||||||
Stream src = _response.GetResponseStream();
|
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||||
int length = src.Read(_readbuf, 0, BufferSize);
|
_response = (HttpWebResponse) _request.GetResponse();
|
||||||
while (length > 0)
|
Stream src = _response.GetResponseStream();
|
||||||
{
|
int length = src.Read(_readbuf, 0, BufferSize);
|
||||||
_resource.Write(_readbuf, 0, length);
|
while (length > 0)
|
||||||
length = src.Read(_readbuf, 0, BufferSize);
|
{
|
||||||
}
|
_resource.Write(_readbuf, 0, length);
|
||||||
|
length = src.Read(_readbuf, 0, BufferSize);
|
||||||
|
}
|
||||||
// TODO! Implement timeout, without killing the server
|
|
||||||
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
|
||||||
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
// TODO! Implement timeout, without killing the server
|
||||||
|
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
||||||
// _allDone.WaitOne();
|
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||||
if (_response != null)
|
|
||||||
_response.Close();
|
// _allDone.WaitOne();
|
||||||
if (_asyncException != null)
|
if (_response != null)
|
||||||
throw _asyncException;
|
_response.Close();
|
||||||
|
if (_asyncException != null)
|
||||||
if (_resource != null)
|
throw _asyncException;
|
||||||
{
|
|
||||||
_resource.Flush();
|
if (_resource != null)
|
||||||
_resource.Seek(0, SeekOrigin.Begin);
|
{
|
||||||
}
|
_resource.Flush();
|
||||||
|
_resource.Seek(0, SeekOrigin.Begin);
|
||||||
return _resource;
|
}
|
||||||
}
|
|
||||||
}
|
return _resource;
|
||||||
|
}
|
||||||
public Stream Request(Stream src)
|
}
|
||||||
{
|
|
||||||
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
public Stream Request(Stream src)
|
||||||
_request.KeepAlive = false;
|
{
|
||||||
_request.ContentType = "application/xml";
|
_request = (HttpWebRequest) WebRequest.Create(buildUri());
|
||||||
_request.Timeout = 900000;
|
_request.KeepAlive = false;
|
||||||
_request.Method = RequestMethod;
|
_request.ContentType = "application/xml";
|
||||||
_asyncException = null;
|
_request.Timeout = 900000;
|
||||||
_request.ContentLength = src.Length;
|
_request.Method = RequestMethod;
|
||||||
|
_asyncException = null;
|
||||||
MainLog.Instance.Verbose("REST", "Request Length {0}", _request.ContentLength);
|
_request.ContentLength = src.Length;
|
||||||
MainLog.Instance.Verbose("REST", "Sending Web Request {0}", buildUri());
|
|
||||||
src.Seek(0, SeekOrigin.Begin);
|
m_log.InfoFormat("[REST]: Request Length {0}", _request.ContentLength);
|
||||||
MainLog.Instance.Verbose("REST", "Seek is ok");
|
m_log.InfoFormat("[REST]: Sending Web Request {0}", buildUri());
|
||||||
Stream dst = _request.GetRequestStream();
|
src.Seek(0, SeekOrigin.Begin);
|
||||||
MainLog.Instance.Verbose("REST", "GetRequestStream is ok");
|
m_log.Info("[REST]: Seek is ok");
|
||||||
|
Stream dst = _request.GetRequestStream();
|
||||||
byte[] buf = new byte[1024];
|
m_log.Info("[REST]: GetRequestStream is ok");
|
||||||
int length = src.Read(buf, 0, 1024);
|
|
||||||
MainLog.Instance.Verbose("REST", "First Read is ok");
|
byte[] buf = new byte[1024];
|
||||||
while (length > 0)
|
int length = src.Read(buf, 0, 1024);
|
||||||
{
|
m_log.Info("[REST]: First Read is ok");
|
||||||
dst.Write(buf, 0, length);
|
while (length > 0)
|
||||||
length = src.Read(buf, 0, 1024);
|
{
|
||||||
}
|
dst.Write(buf, 0, length);
|
||||||
_response = (HttpWebResponse) _request.GetResponse();
|
length = src.Read(buf, 0, 1024);
|
||||||
|
}
|
||||||
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
|
||||||
|
_response = (HttpWebResponse) _request.GetResponse();
|
||||||
// TODO! Implement timeout, without killing the server
|
|
||||||
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
// IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request);
|
||||||
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
|
||||||
|
// TODO! Implement timeout, without killing the server
|
||||||
return null;
|
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
|
||||||
}
|
//ThreadPool.RegisterWaitForSingleObject(responseAsyncResult.AsyncWaitHandle, new WaitOrTimerCallback(TimeoutCallback), _request, DefaultTimeout, true);
|
||||||
|
|
||||||
#region Async Invocation
|
return null;
|
||||||
|
}
|
||||||
public IAsyncResult BeginRequest(AsyncCallback callback, object state)
|
|
||||||
{
|
#region Async Invocation
|
||||||
/// <summary>
|
|
||||||
/// In case, we are invoked asynchroneously this object will keep track of the state
|
public IAsyncResult BeginRequest(AsyncCallback callback, object state)
|
||||||
/// </summary>
|
{
|
||||||
AsyncResult<Stream> ar = new AsyncResult<Stream>(callback, state);
|
/// <summary>
|
||||||
ThreadPool.QueueUserWorkItem(RequestHelper, ar);
|
/// In case, we are invoked asynchroneously this object will keep track of the state
|
||||||
return ar;
|
/// </summary>
|
||||||
}
|
AsyncResult<Stream> ar = new AsyncResult<Stream>(callback, state);
|
||||||
|
ThreadPool.QueueUserWorkItem(RequestHelper, ar);
|
||||||
public Stream EndRequest(IAsyncResult asyncResult)
|
return ar;
|
||||||
{
|
}
|
||||||
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
|
||||||
|
public Stream EndRequest(IAsyncResult asyncResult)
|
||||||
// Wait for operation to complete, then return result or
|
{
|
||||||
// throw exception
|
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
||||||
return ar.EndInvoke();
|
|
||||||
}
|
// Wait for operation to complete, then return result or
|
||||||
|
// throw exception
|
||||||
private void RequestHelper(Object asyncResult)
|
return ar.EndInvoke();
|
||||||
{
|
}
|
||||||
// We know that it's really an AsyncResult<DateTime> object
|
|
||||||
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
private void RequestHelper(Object asyncResult)
|
||||||
try
|
{
|
||||||
{
|
// We know that it's really an AsyncResult<DateTime> object
|
||||||
// Perform the operation; if sucessful set the result
|
AsyncResult<Stream> ar = (AsyncResult<Stream>) asyncResult;
|
||||||
Stream s = Request();
|
try
|
||||||
ar.SetAsCompleted(s, false);
|
{
|
||||||
}
|
// Perform the operation; if sucessful set the result
|
||||||
catch (Exception e)
|
Stream s = Request();
|
||||||
{
|
ar.SetAsCompleted(s, false);
|
||||||
// If operation fails, set the exception
|
}
|
||||||
ar.HandleException(e, false);
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
}
|
// If operation fails, set the exception
|
||||||
|
ar.HandleException(e, false);
|
||||||
#endregion Async Invocation
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#endregion Async Invocation
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,115 +1,117 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Configuration.HTTP
|
namespace OpenSim.Framework.Configuration.HTTP
|
||||||
{
|
{
|
||||||
public class HTTPConfiguration : IGenericConfig
|
public class HTTPConfiguration : IGenericConfig
|
||||||
{
|
{
|
||||||
private RemoteConfigSettings remoteConfigSettings;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
private XmlConfiguration xmlConfig;
|
private RemoteConfigSettings remoteConfigSettings;
|
||||||
|
|
||||||
private string configFileName = "";
|
private XmlConfiguration xmlConfig;
|
||||||
|
|
||||||
public HTTPConfiguration()
|
private string configFileName = System.String.Empty;
|
||||||
{
|
|
||||||
remoteConfigSettings = new RemoteConfigSettings("remoteconfig.xml");
|
public HTTPConfiguration()
|
||||||
xmlConfig = new XmlConfiguration();
|
{
|
||||||
}
|
remoteConfigSettings = new RemoteConfigSettings("remoteconfig.xml");
|
||||||
|
xmlConfig = new XmlConfiguration();
|
||||||
public void SetFileName(string fileName)
|
}
|
||||||
{
|
|
||||||
configFileName = fileName;
|
public void SetFileName(string fileName)
|
||||||
}
|
{
|
||||||
|
configFileName = fileName;
|
||||||
public void LoadData()
|
}
|
||||||
{
|
|
||||||
try
|
public void LoadData()
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
try
|
||||||
|
{
|
||||||
byte[] buf = new byte[8192];
|
StringBuilder sb = new StringBuilder();
|
||||||
HttpWebRequest request =
|
|
||||||
(HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
|
byte[] buf = new byte[8192];
|
||||||
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
|
HttpWebRequest request =
|
||||||
|
(HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName);
|
||||||
Stream resStream = response.GetResponseStream();
|
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
|
||||||
|
|
||||||
string tempString = null;
|
Stream resStream = response.GetResponseStream();
|
||||||
int count = 0;
|
|
||||||
|
string tempString = null;
|
||||||
do
|
int count = 0;
|
||||||
{
|
|
||||||
count = resStream.Read(buf, 0, buf.Length);
|
do
|
||||||
if (count != 0)
|
{
|
||||||
{
|
count = resStream.Read(buf, 0, buf.Length);
|
||||||
tempString = Encoding.ASCII.GetString(buf, 0, count);
|
if (count != 0)
|
||||||
sb.Append(tempString);
|
{
|
||||||
}
|
tempString = Encoding.ASCII.GetString(buf, 0, count);
|
||||||
} while (count > 0);
|
sb.Append(tempString);
|
||||||
LoadDataFromString(sb.ToString());
|
}
|
||||||
}
|
} while (count > 0);
|
||||||
catch (WebException)
|
LoadDataFromString(sb.ToString());
|
||||||
{
|
}
|
||||||
MainLog.Instance.Warn("Unable to connect to remote configuration file (" +
|
catch (WebException)
|
||||||
remoteConfigSettings.baseConfigURL + configFileName +
|
{
|
||||||
"). Creating local file instead.");
|
m_log.Warn("Unable to connect to remote configuration file (" +
|
||||||
xmlConfig.SetFileName(configFileName);
|
remoteConfigSettings.baseConfigURL + configFileName +
|
||||||
xmlConfig.LoadData();
|
"). Creating local file instead.");
|
||||||
}
|
xmlConfig.SetFileName(configFileName);
|
||||||
}
|
xmlConfig.LoadData();
|
||||||
|
}
|
||||||
public void LoadDataFromString(string data)
|
}
|
||||||
{
|
|
||||||
xmlConfig.LoadDataFromString(data);
|
public void LoadDataFromString(string data)
|
||||||
}
|
{
|
||||||
|
xmlConfig.LoadDataFromString(data);
|
||||||
public string GetAttribute(string attributeName)
|
}
|
||||||
{
|
|
||||||
return xmlConfig.GetAttribute(attributeName);
|
public string GetAttribute(string attributeName)
|
||||||
}
|
{
|
||||||
|
return xmlConfig.GetAttribute(attributeName);
|
||||||
public bool SetAttribute(string attributeName, string attributeValue)
|
}
|
||||||
{
|
|
||||||
return true;
|
public bool SetAttribute(string attributeName, string attributeValue)
|
||||||
}
|
{
|
||||||
|
return true;
|
||||||
public void Commit()
|
}
|
||||||
{
|
|
||||||
}
|
public void Commit()
|
||||||
|
{
|
||||||
public void Close()
|
}
|
||||||
{
|
|
||||||
}
|
public void Close()
|
||||||
}
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,62 +1,62 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Framework.Configuration.HTTP
|
namespace OpenSim.Framework.Configuration.HTTP
|
||||||
{
|
{
|
||||||
public class RemoteConfigSettings
|
public class RemoteConfigSettings
|
||||||
{
|
{
|
||||||
private ConfigurationMember configMember;
|
private ConfigurationMember configMember;
|
||||||
|
|
||||||
public string baseConfigURL = "";
|
public string baseConfigURL = System.String.Empty;
|
||||||
|
|
||||||
public RemoteConfigSettings(string filename)
|
public RemoteConfigSettings(string filename)
|
||||||
{
|
{
|
||||||
configMember =
|
configMember =
|
||||||
new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
|
new ConfigurationMember(filename, "REMOTE CONFIG SETTINGS", loadConfigurationOptions,
|
||||||
handleIncomingConfiguration,true);
|
handleIncomingConfiguration,true);
|
||||||
configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
|
configMember.forceConfigurationPluginLibrary("OpenSim.Framework.Configuration.XML.dll");
|
||||||
configMember.performConfigurationRetrieve();
|
configMember.performConfigurationRetrieve();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfigurationOptions()
|
public void loadConfigurationOptions()
|
||||||
{
|
{
|
||||||
configMember.addConfigurationOption("base_config_url",
|
configMember.addConfigurationOption("base_config_url",
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
"URL Containing Configuration Files", "http://localhost/", false);
|
"URL Containing Configuration Files", "http://localhost/", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
{
|
{
|
||||||
if (configuration_key == "base_config_url")
|
if (configuration_key == "base_config_url")
|
||||||
{
|
{
|
||||||
baseConfigURL = (string) configuration_result;
|
baseConfigURL = (string) configuration_result;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,139 +1,139 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Configuration
|
namespace OpenSim.Framework.Configuration
|
||||||
{
|
{
|
||||||
public class XmlConfiguration : IGenericConfig
|
public class XmlConfiguration : IGenericConfig
|
||||||
{
|
{
|
||||||
private XmlDocument doc;
|
private XmlDocument doc;
|
||||||
private XmlNode rootNode;
|
private XmlNode rootNode;
|
||||||
private XmlNode configNode;
|
private XmlNode configNode;
|
||||||
private string fileName;
|
private string fileName;
|
||||||
private bool createdFile = false;
|
private bool createdFile = false;
|
||||||
|
|
||||||
public void SetFileName(string file)
|
public void SetFileName(string file)
|
||||||
{
|
{
|
||||||
fileName = file;
|
fileName = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadDataToClass()
|
private void LoadDataToClass()
|
||||||
{
|
{
|
||||||
rootNode = doc.FirstChild;
|
rootNode = doc.FirstChild;
|
||||||
if (rootNode.Name != "Root")
|
if (rootNode.Name != "Root")
|
||||||
throw new Exception("Error: Invalid .xml File. Missing <Root>");
|
throw new Exception("Error: Invalid .xml File. Missing <Root>");
|
||||||
|
|
||||||
configNode = rootNode.FirstChild;
|
configNode = rootNode.FirstChild;
|
||||||
if (configNode.Name != "Config")
|
if (configNode.Name != "Config")
|
||||||
throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
|
throw new Exception("Error: Invalid .xml File. <Root> first child should be <Config>");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadData()
|
public void LoadData()
|
||||||
{
|
{
|
||||||
lock (this)
|
lock (this)
|
||||||
{
|
{
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
XmlTextReader reader = new XmlTextReader(fileName);
|
XmlTextReader reader = new XmlTextReader(fileName);
|
||||||
reader.WhitespaceHandling = WhitespaceHandling.None;
|
reader.WhitespaceHandling = WhitespaceHandling.None;
|
||||||
doc.Load(reader);
|
doc.Load(reader);
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
createdFile = true;
|
createdFile = true;
|
||||||
rootNode = doc.CreateNode(XmlNodeType.Element, "Root", "");
|
rootNode = doc.CreateNode(XmlNodeType.Element, "Root", String.Empty);
|
||||||
doc.AppendChild(rootNode);
|
doc.AppendChild(rootNode);
|
||||||
configNode = doc.CreateNode(XmlNodeType.Element, "Config", "");
|
configNode = doc.CreateNode(XmlNodeType.Element, "Config", String.Empty);
|
||||||
rootNode.AppendChild(configNode);
|
rootNode.AppendChild(configNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadDataToClass();
|
LoadDataToClass();
|
||||||
|
|
||||||
if (createdFile)
|
if (createdFile)
|
||||||
{
|
{
|
||||||
Commit();
|
Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadDataFromString(string data)
|
public void LoadDataFromString(string data)
|
||||||
{
|
{
|
||||||
doc = new XmlDocument();
|
doc = new XmlDocument();
|
||||||
doc.LoadXml(data);
|
doc.LoadXml(data);
|
||||||
|
|
||||||
LoadDataToClass();
|
LoadDataToClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAttribute(string attributeName)
|
public string GetAttribute(string attributeName)
|
||||||
{
|
{
|
||||||
string result = null;
|
string result = null;
|
||||||
if (configNode.Attributes[attributeName] != null)
|
if (configNode.Attributes[attributeName] != null)
|
||||||
{
|
{
|
||||||
result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value;
|
result = ((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SetAttribute(string attributeName, string attributeValue)
|
public bool SetAttribute(string attributeName, string attributeValue)
|
||||||
{
|
{
|
||||||
if (configNode.Attributes[attributeName] != null)
|
if (configNode.Attributes[attributeName] != null)
|
||||||
{
|
{
|
||||||
((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
|
((XmlAttribute) configNode.Attributes.GetNamedItem(attributeName)).Value = attributeValue;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XmlAttribute attri;
|
XmlAttribute attri;
|
||||||
attri = doc.CreateAttribute(attributeName);
|
attri = doc.CreateAttribute(attributeName);
|
||||||
attri.Value = attributeValue;
|
attri.Value = attributeValue;
|
||||||
configNode.Attributes.Append(attri);
|
configNode.Attributes.Append(attri);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Commit()
|
public void Commit()
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(Util.configDir()))
|
if (!Directory.Exists(Util.configDir()))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(Util.configDir());
|
Directory.CreateDirectory(Util.configDir());
|
||||||
}
|
}
|
||||||
doc.Save(fileName);
|
doc.Save(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
configNode = null;
|
configNode = null;
|
||||||
rootNode = null;
|
rootNode = null;
|
||||||
doc = null;
|
doc = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +1,65 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
using System;
|
||||||
{
|
|
||||||
public class ConfigurationOption
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key);
|
public class ConfigurationOption
|
||||||
|
{
|
||||||
public enum ConfigurationTypes
|
public delegate bool ConfigurationOptionShouldBeAsked(string configuration_key);
|
||||||
{
|
|
||||||
TYPE_STRING,
|
public enum ConfigurationTypes
|
||||||
TYPE_STRING_NOT_EMPTY,
|
{
|
||||||
TYPE_UINT16,
|
TYPE_STRING,
|
||||||
TYPE_UINT32,
|
TYPE_STRING_NOT_EMPTY,
|
||||||
TYPE_UINT64,
|
TYPE_UINT16,
|
||||||
TYPE_INT16,
|
TYPE_UINT32,
|
||||||
TYPE_INT32,
|
TYPE_UINT64,
|
||||||
TYPE_INT64,
|
TYPE_INT16,
|
||||||
TYPE_IP_ADDRESS,
|
TYPE_INT32,
|
||||||
TYPE_CHARACTER,
|
TYPE_INT64,
|
||||||
TYPE_BOOLEAN,
|
TYPE_IP_ADDRESS,
|
||||||
TYPE_BYTE,
|
TYPE_CHARACTER,
|
||||||
TYPE_LLUUID,
|
TYPE_BOOLEAN,
|
||||||
TYPE_LLVECTOR3,
|
TYPE_BYTE,
|
||||||
TYPE_FLOAT,
|
TYPE_LLUUID,
|
||||||
TYPE_DOUBLE
|
TYPE_LLVECTOR3,
|
||||||
} ;
|
TYPE_FLOAT,
|
||||||
|
TYPE_DOUBLE
|
||||||
public string configurationKey = "";
|
} ;
|
||||||
public string configurationQuestion = "";
|
|
||||||
public string configurationDefault = "";
|
public string configurationKey = String.Empty;
|
||||||
|
public string configurationQuestion = String.Empty;
|
||||||
public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING;
|
public string configurationDefault = String.Empty;
|
||||||
public bool configurationUseDefaultNoPrompt = false;
|
|
||||||
public ConfigurationOptionShouldBeAsked shouldIBeAsked; //Should I be asked now? Based on previous answers
|
public ConfigurationTypes configurationType = ConfigurationTypes.TYPE_STRING;
|
||||||
}
|
public bool configurationUseDefaultNoPrompt = false;
|
||||||
}
|
public ConfigurationOptionShouldBeAsked shouldIBeAsked; //Should I be asked now? Based on previous answers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
// Information about this assembly is defined by the following
|
// Information about this assembly is defined by the following
|
||||||
// attributes.
|
// attributes.
|
||||||
//
|
//
|
||||||
// change them to the information which is associated with the assembly
|
// change them to the information which is associated with the assembly
|
||||||
// you compile.
|
// you compile.
|
||||||
|
|
||||||
[assembly : AssemblyTitle("ServerConsole")]
|
[assembly : AssemblyTitle("ServerConsole")]
|
||||||
[assembly : AssemblyDescription("")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly : AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly : AssemblyProduct("ServerConsole")]
|
[assembly : AssemblyProduct("ServerConsole")]
|
||||||
[assembly : AssemblyCopyright("")]
|
[assembly: AssemblyCopyright("")]
|
||||||
[assembly : AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly : AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
// This sets the default COM visibility of types in the assembly to invisible.
|
// This sets the default COM visibility of types in the assembly to invisible.
|
||||||
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
|
||||||
|
|
||||||
[assembly : ComVisible(false)]
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
// The assembly version has following format :
|
// The assembly version has following format :
|
||||||
//
|
//
|
||||||
// Major.Minor.Build.Revision
|
// Major.Minor.Build.Revision
|
||||||
//
|
//
|
||||||
// You can specify all values by your own or you can build default build and revision
|
// You can specify all values by your own or you can build default build and revision
|
||||||
// numbers with the '*' character (the default):
|
// numbers with the '*' character (the default):
|
||||||
|
|
||||||
[assembly : AssemblyVersion("1.0.*")]
|
[assembly : AssemblyVersion("1.0.*")]
|
||||||
|
|
|
@ -1,482 +1,424 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Console
|
namespace OpenSim.Framework.Console
|
||||||
{
|
{
|
||||||
public enum LogPriority : int
|
public class ConsoleBase
|
||||||
{
|
{
|
||||||
CRITICAL,
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
HIGH,
|
|
||||||
MEDIUM,
|
private readonly object m_syncRoot = new object();
|
||||||
NORMAL,
|
|
||||||
LOW,
|
public conscmd_callback m_cmdParser;
|
||||||
VERBOSE,
|
public string m_componentName;
|
||||||
EXTRAVERBOSE
|
|
||||||
}
|
public ConsoleBase(string componentname, conscmd_callback cmdparser)
|
||||||
|
{
|
||||||
public class LogBase
|
m_componentName = componentname;
|
||||||
{
|
m_cmdParser = cmdparser;
|
||||||
private object m_syncRoot = new object();
|
|
||||||
|
System.Console.WriteLine("Creating new local console");
|
||||||
private StreamWriter Log;
|
|
||||||
public conscmd_callback cmdparser;
|
m_log.Info("[" + m_componentName + "]: Started at " + DateTime.Now.ToString());
|
||||||
public string componentname;
|
}
|
||||||
private bool m_verbose;
|
|
||||||
|
public void Close()
|
||||||
public LogBase(string LogFile, string componentname, conscmd_callback cmdparser, bool verbose)
|
{
|
||||||
{
|
m_log.Info("[" + m_componentName + "]: Shutdown at " + DateTime.Now.ToString());
|
||||||
this.componentname = componentname;
|
}
|
||||||
this.cmdparser = cmdparser;
|
|
||||||
m_verbose = verbose;
|
/// <summary>
|
||||||
System.Console.WriteLine("Creating new local console");
|
/// derive an ansi color from a string, ignoring the darker colors.
|
||||||
|
/// This is used to help automatically bin component tags with colors
|
||||||
if (String.IsNullOrEmpty(LogFile))
|
/// in various print functions.
|
||||||
{
|
/// </summary>
|
||||||
LogFile = componentname + ".log";
|
/// <param name="input">arbitrary string for input</param>
|
||||||
}
|
/// <returns>an ansii color</returns>
|
||||||
|
private ConsoleColor DeriveColor(string input)
|
||||||
System.Console.WriteLine("Logs will be saved to current directory in " + LogFile);
|
{
|
||||||
|
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9;
|
||||||
Log = File.AppendText(LogFile);
|
return (ConsoleColor) colIdx;
|
||||||
Log.WriteLine("========================================================================");
|
}
|
||||||
Log.WriteLine(componentname + " Started at " + DateTime.Now.ToString());
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Sends a warning to the current console output
|
||||||
public void Close()
|
/// </summary>
|
||||||
{
|
/// <param name="format">The message to send</param>
|
||||||
Log.WriteLine("Shutdown at " + DateTime.Now.ToString());
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
Log.Close();
|
public void Warn(string format, params object[] args)
|
||||||
}
|
{
|
||||||
|
WriteNewLine(ConsoleColor.Yellow, format, args);
|
||||||
/// <summary>
|
}
|
||||||
/// derive an ansi color from a string, ignoring the darker colors.
|
|
||||||
/// This is used to help automatically bin component tags with colors
|
/// <summary>
|
||||||
/// in various print functions.
|
/// Sends a warning to the current console output
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">arbitrary string for input</param>
|
/// <param name="sender">The module that sent this message</param>
|
||||||
/// <returns>an ansii color</returns>
|
/// <param name="format">The message to send</param>
|
||||||
private ConsoleColor DeriveColor(string input)
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
{
|
public void Warn(string sender, string format, params object[] args)
|
||||||
int colIdx = (input.ToUpper().GetHashCode()%6) + 9;
|
{
|
||||||
return (ConsoleColor) colIdx;
|
WritePrefixLine(DeriveColor(sender), sender);
|
||||||
}
|
WriteNewLine(ConsoleColor.Yellow, format, args);
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Sends a warning to the current log output
|
/// <summary>
|
||||||
/// </summary>
|
/// Sends a notice to the current console output
|
||||||
/// <param name="format">The message to send</param>
|
/// </summary>
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
/// <param name="format">The message to send</param>
|
||||||
public void Warn(string format, params object[] args)
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
{
|
public void Notice(string format, params object[] args)
|
||||||
WriteNewLine(ConsoleColor.Yellow, format, args);
|
{
|
||||||
return;
|
WriteNewLine(ConsoleColor.White, format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sends a warning to the current log output
|
/// Sends a notice to the current console output
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender">The module that sent this message</param>
|
/// <param name="sender">The module that sent this message</param>
|
||||||
/// <param name="format">The message to send</param>
|
/// <param name="format">The message to send</param>
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
public void Warn(string sender, string format, params object[] args)
|
public void Notice(string sender, string format, params object[] args)
|
||||||
{
|
{
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
WritePrefixLine(DeriveColor(sender), sender);
|
||||||
WriteNewLine(ConsoleColor.Yellow, format, args);
|
WriteNewLine(ConsoleColor.White, format, args);
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Sends an error to the current console output
|
||||||
/// Sends a notice to the current log output
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="format">The message to send</param>
|
||||||
/// <param name="format">The message to send</param>
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
public void Error(string format, params object[] args)
|
||||||
public void Notice(string format, params object[] args)
|
{
|
||||||
{
|
WriteNewLine(ConsoleColor.Red, format, args);
|
||||||
WriteNewLine(ConsoleColor.White, format, args);
|
}
|
||||||
return;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Sends an error to the current console output
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Sends a notice to the current log output
|
/// <param name="sender">The module that sent this message</param>
|
||||||
/// </summary>
|
/// <param name="format">The message to send</param>
|
||||||
/// <param name="sender">The module that sent this message</param>
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
/// <param name="format">The message to send</param>
|
public void Error(string sender, string format, params object[] args)
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
{
|
||||||
public void Notice(string sender, string format, params object[] args)
|
WritePrefixLine(DeriveColor(sender), sender);
|
||||||
{
|
Error(format, args);
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
}
|
||||||
WriteNewLine(ConsoleColor.White, format, args);
|
|
||||||
return;
|
/// <summary>
|
||||||
}
|
/// Sends a status message to the current console output
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="format">The message to send</param>
|
||||||
/// Sends an error to the current log output
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
/// </summary>
|
public void Status(string format, params object[] args)
|
||||||
/// <param name="format">The message to send</param>
|
{
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
WriteNewLine(ConsoleColor.Blue, format, args);
|
||||||
public void Error(string format, params object[] args)
|
}
|
||||||
{
|
|
||||||
WriteNewLine(ConsoleColor.Red, format, args);
|
/// <summary>
|
||||||
return;
|
/// Sends a status message to the current console output
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="sender">The module that sent this message</param>
|
||||||
/// <summary>
|
/// <param name="format">The message to send</param>
|
||||||
/// Sends an error to the current log output
|
/// <param name="args">WriteLine-style message arguments</param>
|
||||||
/// </summary>
|
public void Status(string sender, string format, params object[] args)
|
||||||
/// <param name="sender">The module that sent this message</param>
|
{
|
||||||
/// <param name="format">The message to send</param>
|
WritePrefixLine(DeriveColor(sender), sender);
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
WriteNewLine(ConsoleColor.Blue, format, args);
|
||||||
public void Error(string sender, string format, params object[] args)
|
}
|
||||||
{
|
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
[Conditional("DEBUG")]
|
||||||
Error(format, args);
|
public void Debug(string format, params object[] args)
|
||||||
return;
|
{
|
||||||
}
|
WriteNewLine(ConsoleColor.Gray, format, args);
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Sends an informational message to the current log output
|
[Conditional("DEBUG")]
|
||||||
/// </summary>
|
public void Debug(string sender, string format, params object[] args)
|
||||||
/// <param name="sender">The module that sent this message</param>
|
{
|
||||||
/// <param name="format">The message to send</param>
|
WritePrefixLine(DeriveColor(sender), sender);
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
WriteNewLine(ConsoleColor.Gray, format, args);
|
||||||
public void Verbose(string sender, string format, params object[] args)
|
}
|
||||||
{
|
|
||||||
if (m_verbose)
|
private void WriteNewLine(ConsoleColor color, string format, params object[] args)
|
||||||
{
|
{
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
try
|
||||||
WriteNewLine(ConsoleColor.Gray, format, args);
|
{
|
||||||
return;
|
lock (m_syncRoot)
|
||||||
}
|
{
|
||||||
}
|
try
|
||||||
|
{
|
||||||
/// <summary>
|
if (color != ConsoleColor.White)
|
||||||
/// Sends a status message to the current log output
|
System.Console.ForegroundColor = color;
|
||||||
/// </summary>
|
|
||||||
/// <param name="format">The message to send</param>
|
System.Console.WriteLine(format, args);
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
System.Console.ResetColor();
|
||||||
public void Status(string format, params object[] args)
|
}
|
||||||
{
|
catch (ArgumentNullException)
|
||||||
WriteNewLine(ConsoleColor.Blue, format, args);
|
{
|
||||||
return;
|
// Some older systems dont support coloured text.
|
||||||
}
|
System.Console.WriteLine(format, args);
|
||||||
|
}
|
||||||
/// <summary>
|
catch (FormatException)
|
||||||
/// Sends a status message to the current log output
|
{
|
||||||
/// </summary>
|
System.Console.WriteLine(args);
|
||||||
/// <param name="sender">The module that sent this message</param>
|
}
|
||||||
/// <param name="format">The message to send</param>
|
}
|
||||||
/// <param name="args">WriteLine-style message arguments</param>
|
}
|
||||||
public void Status(string sender, string format, params object[] args)
|
catch (ObjectDisposedException)
|
||||||
{
|
{
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
}
|
||||||
WriteNewLine(ConsoleColor.Blue, format, args);
|
}
|
||||||
return;
|
|
||||||
}
|
private void WritePrefixLine(ConsoleColor color, string sender)
|
||||||
|
{
|
||||||
[Conditional("DEBUG")]
|
try
|
||||||
public void Debug(string format, params object[] args)
|
{
|
||||||
{
|
lock (m_syncRoot)
|
||||||
WriteNewLine(ConsoleColor.Gray, format, args);
|
{
|
||||||
return;
|
sender = sender.ToUpper();
|
||||||
}
|
|
||||||
|
System.Console.WriteLine("[" + sender + "] ");
|
||||||
[Conditional("DEBUG")]
|
|
||||||
public void Debug(string sender, string format, params object[] args)
|
System.Console.Write("[");
|
||||||
{
|
|
||||||
WritePrefixLine(DeriveColor(sender), sender);
|
try
|
||||||
WriteNewLine(ConsoleColor.Gray, format, args);
|
{
|
||||||
return;
|
System.Console.ForegroundColor = color;
|
||||||
}
|
System.Console.Write(sender);
|
||||||
|
System.Console.ResetColor();
|
||||||
private void WriteNewLine(ConsoleColor color, string format, params object[] args)
|
}
|
||||||
{
|
catch (ArgumentNullException)
|
||||||
lock (m_syncRoot)
|
{
|
||||||
{
|
// Some older systems dont support coloured text.
|
||||||
string now = DateTime.Now.ToString("[MM-dd hh:mm:ss] ");
|
System.Console.WriteLine(sender);
|
||||||
Log.Write(now);
|
}
|
||||||
try
|
|
||||||
{
|
System.Console.Write("] \t");
|
||||||
Log.WriteLine(format, args);
|
}
|
||||||
Log.Flush();
|
}
|
||||||
}
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
catch (FormatException)
|
}
|
||||||
{
|
}
|
||||||
System.Console.WriteLine(args);
|
|
||||||
}
|
public string ReadLine()
|
||||||
System.Console.Write(now);
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (color != ConsoleColor.White)
|
return System.Console.ReadLine();
|
||||||
System.Console.ForegroundColor = color;
|
}
|
||||||
|
catch (Exception e)
|
||||||
System.Console.WriteLine(format, args);
|
{
|
||||||
System.Console.ResetColor();
|
m_log.Error("[Console]: System.Console.ReadLine exception " + e.ToString());
|
||||||
}
|
return String.Empty;
|
||||||
catch (ArgumentNullException)
|
}
|
||||||
{
|
}
|
||||||
// Some older systems dont support coloured text.
|
|
||||||
System.Console.WriteLine(format, args);
|
public int Read()
|
||||||
}
|
{
|
||||||
catch (FormatException)
|
return System.Console.Read();
|
||||||
{
|
}
|
||||||
// Some older systems dont support coloured text.
|
|
||||||
System.Console.WriteLine(args);
|
public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue)
|
||||||
}
|
{
|
||||||
|
IPAddress address;
|
||||||
return;
|
string addressStr;
|
||||||
}
|
|
||||||
}
|
while (true)
|
||||||
|
{
|
||||||
private void WritePrefixLine(ConsoleColor color, string sender)
|
addressStr = CmdPrompt(prompt, defaultvalue);
|
||||||
{
|
if (IPAddress.TryParse(addressStr, out address))
|
||||||
lock (m_syncRoot)
|
{
|
||||||
{
|
break;
|
||||||
sender = sender.ToUpper();
|
}
|
||||||
Log.WriteLine("[" + sender + "] ");
|
else
|
||||||
Log.Flush();
|
{
|
||||||
|
m_log.Error("Illegal address. Please re-enter.");
|
||||||
System.Console.Write("[");
|
}
|
||||||
|
}
|
||||||
try
|
|
||||||
{
|
return address;
|
||||||
System.Console.ForegroundColor = color;
|
}
|
||||||
System.Console.Write(sender);
|
|
||||||
System.Console.ResetColor();
|
public uint CmdPromptIPPort(string prompt, string defaultvalue)
|
||||||
}
|
{
|
||||||
catch (ArgumentNullException)
|
uint port;
|
||||||
{
|
string portStr;
|
||||||
// Some older systems dont support coloured text.
|
|
||||||
System.Console.WriteLine(sender);
|
while (true)
|
||||||
}
|
{
|
||||||
|
portStr = CmdPrompt(prompt, defaultvalue);
|
||||||
System.Console.Write("] \t");
|
if (uint.TryParse(portStr, out port))
|
||||||
|
{
|
||||||
return;
|
if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort)
|
||||||
}
|
{
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
public string ReadLine()
|
|
||||||
{
|
m_log.Error("Illegal address. Please re-enter.");
|
||||||
try
|
}
|
||||||
{
|
|
||||||
string TempStr = System.Console.ReadLine();
|
return port;
|
||||||
Log.WriteLine(TempStr);
|
}
|
||||||
return TempStr;
|
|
||||||
}
|
// Displays a prompt and waits for the user to enter a string, then returns that string
|
||||||
catch (Exception e)
|
// (Done with no echo and suitable for passwords - currently disabled)
|
||||||
{
|
public string PasswdPrompt(string prompt)
|
||||||
MainLog.Instance.Error("Console", "System.Console.ReadLine exception " + e.ToString());
|
{
|
||||||
return "";
|
// FIXME: Needs to be better abstracted
|
||||||
}
|
System.Console.WriteLine(String.Format("{0}: ", prompt));
|
||||||
}
|
//ConsoleColor oldfg = System.Console.ForegroundColor;
|
||||||
|
//System.Console.ForegroundColor = System.Console.BackgroundColor;
|
||||||
public int Read()
|
string temp = System.Console.ReadLine();
|
||||||
{
|
//System.Console.ForegroundColor = oldfg;
|
||||||
int TempInt = System.Console.Read();
|
return temp;
|
||||||
Log.Write((char) TempInt);
|
}
|
||||||
return TempInt;
|
|
||||||
}
|
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
||||||
|
public string CmdPrompt(string prompt)
|
||||||
public IPAddress CmdPromptIPAddress(string prompt, string defaultvalue)
|
{
|
||||||
{
|
System.Console.WriteLine(String.Format("{0}: ", prompt));
|
||||||
IPAddress address;
|
return ReadLine();
|
||||||
string addressStr;
|
}
|
||||||
|
|
||||||
while (true)
|
// Displays a command prompt and returns a default value if the user simply presses enter
|
||||||
{
|
public string CmdPrompt(string prompt, string defaultresponse)
|
||||||
addressStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
|
{
|
||||||
if (IPAddress.TryParse(addressStr, out address))
|
string temp = CmdPrompt(String.Format("{0} [{1}]", prompt, defaultresponse));
|
||||||
{
|
if (temp == String.Empty)
|
||||||
break;
|
{
|
||||||
}
|
return defaultresponse;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
MainLog.Instance.Error("Illegal address. Please re-enter.");
|
{
|
||||||
}
|
return temp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return address;
|
|
||||||
}
|
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
|
||||||
|
public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB)
|
||||||
public uint CmdPromptIPPort(string prompt, string defaultvalue)
|
{
|
||||||
{
|
bool itisdone = false;
|
||||||
uint port;
|
string temp = CmdPrompt(prompt, defaultresponse);
|
||||||
string portStr;
|
while (itisdone == false)
|
||||||
|
{
|
||||||
while (true)
|
if ((temp == OptionA) || (temp == OptionB))
|
||||||
{
|
{
|
||||||
portStr = MainLog.Instance.CmdPrompt(prompt, defaultvalue);
|
itisdone = true;
|
||||||
if (uint.TryParse(portStr, out port))
|
}
|
||||||
{
|
else
|
||||||
if (port >= IPEndPoint.MinPort && port <= IPEndPoint.MaxPort)
|
{
|
||||||
{
|
System.Console.WriteLine("Valid options are " + OptionA + " or " + OptionB);
|
||||||
break;
|
temp = CmdPrompt(prompt, defaultresponse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return temp;
|
||||||
MainLog.Instance.Error("Illegal address. Please re-enter.");
|
}
|
||||||
}
|
|
||||||
|
// Runs a command with a number of parameters
|
||||||
return port;
|
public Object RunCmd(string Cmd, string[] cmdparams)
|
||||||
}
|
{
|
||||||
|
m_cmdParser.RunCmd(Cmd, cmdparams);
|
||||||
// Displays a prompt and waits for the user to enter a string, then returns that string
|
return null;
|
||||||
// Done with no echo and suitable for passwords
|
}
|
||||||
public string PasswdPrompt(string prompt)
|
|
||||||
{
|
// Shows data about something
|
||||||
// FIXME: Needs to be better abstracted
|
public void ShowCommands(string ShowWhat)
|
||||||
Log.WriteLine(prompt);
|
{
|
||||||
Notice(prompt);
|
m_cmdParser.Show(ShowWhat);
|
||||||
ConsoleColor oldfg = System.Console.ForegroundColor;
|
}
|
||||||
System.Console.ForegroundColor = System.Console.BackgroundColor;
|
|
||||||
string temp = System.Console.ReadLine();
|
public void Prompt()
|
||||||
System.Console.ForegroundColor = oldfg;
|
{
|
||||||
return temp;
|
string tempstr = CmdPrompt(m_componentName + "# ");
|
||||||
}
|
RunCommand(tempstr);
|
||||||
|
}
|
||||||
// Displays a command prompt and waits for the user to enter a string, then returns that string
|
|
||||||
public string CmdPrompt(string prompt)
|
public void RunCommand(string command)
|
||||||
{
|
{
|
||||||
Notice(String.Format("{0}: ", prompt));
|
string[] tempstrarray;
|
||||||
return ReadLine();
|
tempstrarray = command.Split(' ');
|
||||||
}
|
string cmd = tempstrarray[0];
|
||||||
|
Array.Reverse(tempstrarray);
|
||||||
// Displays a command prompt and returns a default value if the user simply presses enter
|
Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
|
||||||
public string CmdPrompt(string prompt, string defaultresponse)
|
Array.Reverse(tempstrarray);
|
||||||
{
|
string[] cmdparams = (string[]) tempstrarray;
|
||||||
string temp = CmdPrompt(String.Format("{0} [{1}]", prompt, defaultresponse));
|
|
||||||
if (temp == "")
|
try
|
||||||
{
|
{
|
||||||
return defaultresponse;
|
RunCmd(cmd, cmdparams);
|
||||||
}
|
}
|
||||||
else
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
return temp;
|
m_log.ErrorFormat("[Console]: Command [{0}] failed with exception {1}", command, e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Displays a command prompt and returns a default value, user may only enter 1 of 2 options
|
public string LineInfo
|
||||||
public string CmdPrompt(string prompt, string defaultresponse, string OptionA, string OptionB)
|
{
|
||||||
{
|
get
|
||||||
bool itisdone = false;
|
{
|
||||||
string temp = CmdPrompt(prompt, defaultresponse);
|
string result = String.Empty;
|
||||||
while (itisdone == false)
|
|
||||||
{
|
string stacktrace = Environment.StackTrace;
|
||||||
if ((temp == OptionA) || (temp == OptionB))
|
List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None));
|
||||||
{
|
|
||||||
itisdone = true;
|
if (lines.Count > 4)
|
||||||
}
|
{
|
||||||
else
|
lines.RemoveRange(0, 4);
|
||||||
{
|
|
||||||
Notice("Valid options are " + OptionA + " or " + OptionB);
|
string tmpLine = lines[0];
|
||||||
temp = CmdPrompt(prompt, defaultresponse);
|
|
||||||
}
|
int inIndex = tmpLine.IndexOf(" in ");
|
||||||
}
|
|
||||||
return temp;
|
if (inIndex > -1)
|
||||||
}
|
{
|
||||||
|
result = tmpLine.Substring(0, inIndex);
|
||||||
// Runs a command with a number of parameters
|
|
||||||
public Object RunCmd(string Cmd, string[] cmdparams)
|
int lineIndex = tmpLine.IndexOf(":line ");
|
||||||
{
|
|
||||||
cmdparser.RunCmd(Cmd, cmdparams);
|
if (lineIndex > -1)
|
||||||
return null;
|
{
|
||||||
}
|
lineIndex += 6;
|
||||||
|
result += ", line " + tmpLine.Substring(lineIndex, (tmpLine.Length - lineIndex) - 5);
|
||||||
// Shows data about something
|
}
|
||||||
public void ShowCommands(string ShowWhat)
|
}
|
||||||
{
|
}
|
||||||
cmdparser.Show(ShowWhat);
|
return result;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void MainLogPrompt()
|
}
|
||||||
{
|
}
|
||||||
string tempstr = CmdPrompt(componentname + "# ");
|
|
||||||
MainLogRunCommand(tempstr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MainLogRunCommand(string command)
|
|
||||||
{
|
|
||||||
string[] tempstrarray;
|
|
||||||
tempstrarray = command.Split(' ');
|
|
||||||
string cmd = tempstrarray[0];
|
|
||||||
Array.Reverse(tempstrarray);
|
|
||||||
Array.Resize<string>(ref tempstrarray, tempstrarray.Length - 1);
|
|
||||||
Array.Reverse(tempstrarray);
|
|
||||||
string[] cmdparams = (string[]) tempstrarray;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
RunCmd(cmd, cmdparams);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
MainLog.Instance.Error("Console", "Command failed with exception " + e.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LineInfo
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
string result = String.Empty;
|
|
||||||
|
|
||||||
string stacktrace = Environment.StackTrace;
|
|
||||||
List<string> lines = new List<string>(stacktrace.Split(new string[] {"at "}, StringSplitOptions.None));
|
|
||||||
|
|
||||||
if (lines.Count > 4)
|
|
||||||
{
|
|
||||||
lines.RemoveRange(0, 4);
|
|
||||||
|
|
||||||
string tmpLine = lines[0];
|
|
||||||
|
|
||||||
int inIndex = tmpLine.IndexOf(" in ");
|
|
||||||
|
|
||||||
if (inIndex > -1)
|
|
||||||
{
|
|
||||||
result = tmpLine.Substring(0, inIndex);
|
|
||||||
|
|
||||||
int lineIndex = tmpLine.IndexOf(":line ");
|
|
||||||
|
|
||||||
if (lineIndex > -1)
|
|
||||||
{
|
|
||||||
lineIndex += 6;
|
|
||||||
result += ", line " + tmpLine.Substring(lineIndex, (tmpLine.Length - lineIndex) - 5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +1,41 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OpenSim.Framework.Console
|
|
||||||
{
|
namespace OpenSim.Framework.Console
|
||||||
public class MainLog
|
{
|
||||||
{
|
public class MainConsole
|
||||||
private static LogBase instance;
|
{
|
||||||
|
private static ConsoleBase instance;
|
||||||
public static LogBase Instance
|
|
||||||
{
|
public static ConsoleBase Instance
|
||||||
get { return instance; }
|
{
|
||||||
set { instance = value; }
|
get { return instance; }
|
||||||
}
|
set { instance = value; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
using log4net.Core;
|
||||||
|
using log4net.Layout;
|
||||||
|
using log4net.Appender;
|
||||||
|
using log4net.Util;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Console
|
||||||
|
{
|
||||||
|
public class OpenSimAppender : AnsiColorTerminalAppender
|
||||||
|
{
|
||||||
|
override protected void Append(LoggingEvent le)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
string loggingMessage = RenderLoggingEvent(le);
|
||||||
|
string regex = @"^(?<Front>.*?)\[(?<Category>[^\]]+)\]:?(?<End>.*)";
|
||||||
|
|
||||||
|
Regex RE = new Regex(regex, RegexOptions.Multiline);
|
||||||
|
MatchCollection matches = RE.Matches(loggingMessage);
|
||||||
|
// Get some direct matches $1 $4 is a
|
||||||
|
if (matches.Count == 1)
|
||||||
|
{
|
||||||
|
System.Console.Write(matches[0].Groups["Front"].Value);
|
||||||
|
System.Console.Write("[");
|
||||||
|
|
||||||
|
WriteColorText(DeriveColor(matches[0].Groups["Category"].Value), matches[0].Groups["Category"].Value);
|
||||||
|
System.Console.Write("]:");
|
||||||
|
|
||||||
|
if (le.Level == Level.Error)
|
||||||
|
{
|
||||||
|
WriteColorText(ConsoleColor.Red, matches[0].Groups["End"].Value);
|
||||||
|
}
|
||||||
|
else if (le.Level == Level.Warn)
|
||||||
|
{
|
||||||
|
WriteColorText(ConsoleColor.Yellow, matches[0].Groups["End"].Value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Console.Write(matches[0].Groups["End"].Value);
|
||||||
|
}
|
||||||
|
System.Console.WriteLine();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Console.Write(loggingMessage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.Console.WriteLine("Couldn't write out log message", e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WriteColorText(ConsoleColor color, string sender)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lock (this)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
System.Console.ForegroundColor = color;
|
||||||
|
System.Console.Write(sender);
|
||||||
|
System.Console.ResetColor();
|
||||||
|
}
|
||||||
|
catch (ArgumentNullException)
|
||||||
|
{
|
||||||
|
// Some older systems dont support coloured text.
|
||||||
|
System.Console.WriteLine(sender);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ObjectDisposedException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ConsoleColor DeriveColor(string input)
|
||||||
|
{
|
||||||
|
int colIdx = (input.ToUpper().GetHashCode() % 6) + 9;
|
||||||
|
return (ConsoleColor) colIdx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Text;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework
|
||||||
|
{
|
||||||
|
public class Constants
|
||||||
|
{
|
||||||
|
public const uint RegionSize = 256;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,54 +1,54 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public class Culture
|
public class Culture
|
||||||
{
|
{
|
||||||
private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true);
|
private static readonly CultureInfo m_cultureInfo = new CultureInfo("en-US", true);
|
||||||
|
|
||||||
public static NumberFormatInfo NumberFormatInfo
|
public static NumberFormatInfo NumberFormatInfo
|
||||||
{
|
{
|
||||||
get { return m_cultureInfo.NumberFormat; }
|
get { return m_cultureInfo.NumberFormat; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IFormatProvider FormatProvider
|
public static IFormatProvider FormatProvider
|
||||||
{
|
{
|
||||||
get { return m_cultureInfo; }
|
get { return m_cultureInfo; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetCurrentCulture()
|
public static void SetCurrentCulture()
|
||||||
{
|
{
|
||||||
Thread.CurrentThread.CurrentCulture = m_cultureInfo;
|
Thread.CurrentThread.CurrentCulture = m_cultureInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,277 +1,282 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.DB4o
|
namespace OpenSim.Framework.Data.DB4o
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A User storage interface for the DB4o database system
|
/// A User storage interface for the DB4o database system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DB4oUserData : IUserData
|
public class DB4oUserData : IUserData
|
||||||
{
|
{
|
||||||
/// <summary>
|
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
/// The database manager
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private DB4oUserManager manager;
|
/// The database manager
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private DB4oUserManager manager;
|
||||||
/// Artificial constructor called upon plugin load
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public void Initialise()
|
/// Artificial constructor called upon plugin load
|
||||||
{
|
/// </summary>
|
||||||
manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap"));
|
public void Initialise()
|
||||||
}
|
{
|
||||||
|
manager = new DB4oUserManager(Path.Combine(Util.dataDir(), "userprofiles.yap"));
|
||||||
/// <summary>
|
}
|
||||||
/// Loads a specified user profile from a UUID
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="uuid">The users UUID</param>
|
/// Loads a specified user profile from a UUID
|
||||||
/// <returns>A user profile</returns>
|
/// </summary>
|
||||||
public UserProfileData GetUserByUUID(LLUUID uuid)
|
/// <param name="uuid">The users UUID</param>
|
||||||
{
|
/// <returns>A user profile</returns>
|
||||||
if (manager.userProfiles.ContainsKey(uuid))
|
public UserProfileData GetUserByUUID(LLUUID uuid)
|
||||||
return manager.userProfiles[uuid];
|
{
|
||||||
return null;
|
if (manager.userProfiles.ContainsKey(uuid))
|
||||||
}
|
return manager.userProfiles[uuid];
|
||||||
|
return null;
|
||||||
/// <summary>
|
}
|
||||||
/// Loads a specified user profile from a account
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="uuid">The users account</param>
|
/// Loads a specified user profile from a account
|
||||||
/// <returns>A user profile</returns>
|
/// </summary>
|
||||||
public UserProfileData GetUserByAccount(string account)
|
/// <param name="uuid">The users account</param>
|
||||||
{
|
/// <returns>A user profile</returns>
|
||||||
if (manager.userProfiles.ContainsKey(account))
|
public UserProfileData GetUserByAccount(string account)
|
||||||
return manager.userProfiles[account];
|
{
|
||||||
return null;
|
if (manager.userProfiles.ContainsKey(account))
|
||||||
}
|
return manager.userProfiles[account];
|
||||||
|
return null;
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a user by searching for its name
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="name">The users account name</param>
|
/// Returns a user by searching for its name
|
||||||
/// <returns>A matching users profile</returns>
|
/// </summary>
|
||||||
public UserProfileData GetUserByName(string name)
|
/// <param name="name">The users account name</param>
|
||||||
{
|
/// <returns>A matching users profile</returns>
|
||||||
return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
|
public UserProfileData GetUserByName(string name)
|
||||||
}
|
{
|
||||||
|
return GetUserByName(name.Split(' ')[0], name.Split(' ')[1]);
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a user by searching for its name
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="fname">The first part of the users account name</param>
|
/// Returns a user by searching for its name
|
||||||
/// <param name="lname">The second part of the users account name</param>
|
/// </summary>
|
||||||
/// <returns>A matching users profile</returns>
|
/// <param name="fname">The first part of the users account name</param>
|
||||||
public UserProfileData GetUserByName(string fname, string lname)
|
/// <param name="lname">The second part of the users account name</param>
|
||||||
{
|
/// <returns>A matching users profile</returns>
|
||||||
foreach (UserProfileData profile in manager.userProfiles.Values)
|
public UserProfileData GetUserByName(string fname, string lname)
|
||||||
{
|
{
|
||||||
if (profile.username == fname && profile.surname == lname)
|
foreach (UserProfileData profile in manager.userProfiles.Values)
|
||||||
return profile;
|
{
|
||||||
}
|
if (profile.username == fname && profile.surname == lname)
|
||||||
return null;
|
return profile;
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a user by UUID direct
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="uuid">The users account ID</param>
|
/// Returns a user by UUID direct
|
||||||
/// <returns>A matching users profile</returns>
|
/// </summary>
|
||||||
public UserAgentData GetAgentByUUID(LLUUID uuid)
|
/// <param name="uuid">The users account ID</param>
|
||||||
{
|
/// <returns>A matching users profile</returns>
|
||||||
try
|
public UserAgentData GetAgentByUUID(LLUUID uuid)
|
||||||
{
|
{
|
||||||
return GetUserByUUID(uuid).currentAgent;
|
try
|
||||||
}
|
{
|
||||||
catch (Exception)
|
return GetUserByUUID(uuid).currentAgent;
|
||||||
{
|
}
|
||||||
return null;
|
catch (Exception)
|
||||||
}
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a session by account name
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="name">The account name</param>
|
/// Returns a session by account name
|
||||||
/// <returns>The users session agent</returns>
|
/// </summary>
|
||||||
public UserAgentData GetAgentByName(string name)
|
/// <param name="name">The account name</param>
|
||||||
{
|
/// <returns>The users session agent</returns>
|
||||||
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
|
public UserAgentData GetAgentByName(string name)
|
||||||
}
|
{
|
||||||
|
return GetAgentByName(name.Split(' ')[0], name.Split(' ')[1]);
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a session by account name
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="fname">The first part of the users account name</param>
|
/// Returns a session by account name
|
||||||
/// <param name="lname">The second part of the users account name</param>
|
/// </summary>
|
||||||
/// <returns>A user agent</returns>
|
/// <param name="fname">The first part of the users account name</param>
|
||||||
public UserAgentData GetAgentByName(string fname, string lname)
|
/// <param name="lname">The second part of the users account name</param>
|
||||||
{
|
/// <returns>A user agent</returns>
|
||||||
try
|
public UserAgentData GetAgentByName(string fname, string lname)
|
||||||
{
|
{
|
||||||
return GetUserByName(fname, lname).currentAgent;
|
try
|
||||||
}
|
{
|
||||||
catch (Exception)
|
return GetUserByName(fname, lname).currentAgent;
|
||||||
{
|
}
|
||||||
return null;
|
catch (Exception)
|
||||||
}
|
{
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
#region User Friends List Data
|
}
|
||||||
|
public void StoreWebLoginKey(LLUUID AgentID, LLUUID WebLoginKey)
|
||||||
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
{
|
||||||
{
|
UserProfileData user = GetUserByUUID(AgentID);
|
||||||
//MainLog.Instance.Verbose("FRIEND", "Stub AddNewUserFriend called");
|
user.webLoginKey = WebLoginKey;
|
||||||
}
|
UpdateUserProfile(user);
|
||||||
|
|
||||||
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
}
|
||||||
{
|
#region User Friends List Data
|
||||||
//MainLog.Instance.Verbose("FRIEND", "Stub RemoveUserFriend called");
|
|
||||||
}
|
public void AddNewUserFriend(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||||
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
{
|
||||||
{
|
//m_log.Info("[FRIEND]: Stub AddNewUserFriend called");
|
||||||
//MainLog.Instance.Verbose("FRIEND", "Stub UpdateUserFriendPerms called");
|
}
|
||||||
}
|
|
||||||
|
public void RemoveUserFriend(LLUUID friendlistowner, LLUUID friend)
|
||||||
|
{
|
||||||
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
//m_log.Info("[FRIEND]: Stub RemoveUserFriend called");
|
||||||
{
|
}
|
||||||
//MainLog.Instance.Verbose("FRIEND", "Stub GetUserFriendList called");
|
public void UpdateUserFriendPerms(LLUUID friendlistowner, LLUUID friend, uint perms)
|
||||||
return new List<FriendListItem>();
|
{
|
||||||
}
|
//m_log.Info("[FRIEND]: Stub UpdateUserFriendPerms called");
|
||||||
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
|
public List<FriendListItem> GetUserFriendList(LLUUID friendlistowner)
|
||||||
{
|
{
|
||||||
//MainLog.Instance.Verbose("USER", "Stub UpdateUserCUrrentRegion called");
|
//m_log.Info("[FRIEND]: Stub GetUserFriendList called");
|
||||||
}
|
return new List<FriendListItem>();
|
||||||
|
}
|
||||||
public void LogOffUser(LLUUID avatarid)
|
|
||||||
{
|
#endregion
|
||||||
//MainLog.Instance.Verbose("USER", "Stub LogOffUser called");
|
|
||||||
}
|
public void UpdateUserCurrentRegion(LLUUID avatarid, LLUUID regionuuid)
|
||||||
|
{
|
||||||
public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
//m_log.Info("[USER]: Stub UpdateUserCUrrentRegion called");
|
||||||
{
|
}
|
||||||
//Do nothing yet
|
|
||||||
List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
|
|
||||||
return returnlist;
|
|
||||||
}
|
public List<Framework.AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
||||||
|
{
|
||||||
/// <summary>
|
//Do nothing yet
|
||||||
/// Creates a new user profile
|
List<Framework.AvatarPickerAvatar> returnlist = new List<Framework.AvatarPickerAvatar>();
|
||||||
/// </summary>
|
return returnlist;
|
||||||
/// <param name="user">The profile to add to the database</param>
|
}
|
||||||
public void AddNewUserProfile(UserProfileData user)
|
|
||||||
{
|
/// <summary>
|
||||||
try
|
/// Creates a new user profile
|
||||||
{
|
/// </summary>
|
||||||
manager.UpdateRecord(user);
|
/// <param name="user">The profile to add to the database</param>
|
||||||
}
|
public void AddNewUserProfile(UserProfileData user)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
try
|
||||||
Console.WriteLine(e.ToString());
|
{
|
||||||
}
|
manager.UpdateRecord(user);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
/// <summary>
|
{
|
||||||
/// Creates a new user profile
|
Console.WriteLine(e.ToString());
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="user">The profile to add to the database</param>
|
}
|
||||||
/// <returns>True on success, false on error</returns>
|
|
||||||
public bool UpdateUserProfile(UserProfileData user)
|
/// <summary>
|
||||||
{
|
/// Creates a new user profile
|
||||||
try
|
/// </summary>
|
||||||
{
|
/// <param name="user">The profile to add to the database</param>
|
||||||
return manager.UpdateRecord(user);
|
/// <returns>True on success, false on error</returns>
|
||||||
}
|
public bool UpdateUserProfile(UserProfileData user)
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
try
|
||||||
Console.WriteLine(e.ToString());
|
{
|
||||||
return false;
|
return manager.UpdateRecord(user);
|
||||||
}
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e.ToString());
|
||||||
/// <summary>
|
return false;
|
||||||
/// Creates a new user agent
|
}
|
||||||
/// </summary>
|
}
|
||||||
/// <param name="agent">The agent to add to the database</param>
|
|
||||||
public void AddNewUserAgent(UserAgentData agent)
|
|
||||||
{
|
/// <summary>
|
||||||
// Do nothing. yet.
|
/// Creates a new user agent
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="agent">The agent to add to the database</param>
|
||||||
/// <summary>
|
public void AddNewUserAgent(UserAgentData agent)
|
||||||
/// Transfers money between two user accounts
|
{
|
||||||
/// </summary>
|
// Do nothing. yet.
|
||||||
/// <param name="from">Starting account</param>
|
}
|
||||||
/// <param name="to">End account</param>
|
|
||||||
/// <param name="amount">The amount to move</param>
|
/// <summary>
|
||||||
/// <returns>Success?</returns>
|
/// Transfers money between two user accounts
|
||||||
public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
|
/// </summary>
|
||||||
{
|
/// <param name="from">Starting account</param>
|
||||||
return true;
|
/// <param name="to">End account</param>
|
||||||
}
|
/// <param name="amount">The amount to move</param>
|
||||||
|
/// <returns>Success?</returns>
|
||||||
/// <summary>
|
public bool MoneyTransferRequest(LLUUID from, LLUUID to, uint amount)
|
||||||
/// Transfers inventory between two accounts
|
{
|
||||||
/// </summary>
|
return true;
|
||||||
/// <remarks>Move to inventory server</remarks>
|
}
|
||||||
/// <param name="from">Senders account</param>
|
|
||||||
/// <param name="to">Receivers account</param>
|
/// <summary>
|
||||||
/// <param name="item">Inventory item</param>
|
/// Transfers inventory between two accounts
|
||||||
/// <returns>Success?</returns>
|
/// </summary>
|
||||||
public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
|
/// <remarks>Move to inventory server</remarks>
|
||||||
{
|
/// <param name="from">Senders account</param>
|
||||||
return true;
|
/// <param name="to">Receivers account</param>
|
||||||
}
|
/// <param name="item">Inventory item</param>
|
||||||
|
/// <returns>Success?</returns>
|
||||||
/// <summary>
|
public bool InventoryTransferRequest(LLUUID from, LLUUID to, LLUUID item)
|
||||||
/// Returns the name of the storage provider
|
{
|
||||||
/// </summary>
|
return true;
|
||||||
/// <returns>Storage provider name</returns>
|
}
|
||||||
public string getName()
|
|
||||||
{
|
/// <summary>
|
||||||
return "DB4o Userdata";
|
/// Returns the name of the storage provider
|
||||||
}
|
/// </summary>
|
||||||
|
/// <returns>Storage provider name</returns>
|
||||||
/// <summary>
|
public string getName()
|
||||||
/// Returns the version of the storage provider
|
{
|
||||||
/// </summary>
|
return "DB4o Userdata";
|
||||||
/// <returns>Storage provider version</returns>
|
}
|
||||||
public string GetVersion()
|
|
||||||
{
|
/// <summary>
|
||||||
return "0.1";
|
/// Returns the version of the storage provider
|
||||||
}
|
/// </summary>
|
||||||
}
|
/// <returns>Storage provider version</returns>
|
||||||
}
|
public string GetVersion()
|
||||||
|
{
|
||||||
|
return "0.1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Framework.Data.DB4o")]
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Framework.Data.DB4o")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("57991e15-79da-41b7-aa06-2e6b49165a63")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -1,240 +1,242 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.MSSQL
|
namespace OpenSim.Framework.Data.MSSQL
|
||||||
{
|
{
|
||||||
internal class MSSQLAssetData : IAssetProvider
|
internal class MSSQLAssetData : IAssetProvider
|
||||||
{
|
{
|
||||||
private MSSQLManager database;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
#region IAssetProvider Members
|
private MSSQLManager database;
|
||||||
|
|
||||||
private void UpgradeAssetsTable(string tableName)
|
#region IAssetProvider Members
|
||||||
{
|
|
||||||
// null as the version, indicates that the table didn't exist
|
private void UpgradeAssetsTable(string tableName)
|
||||||
if (tableName == null)
|
{
|
||||||
{
|
// null as the version, indicates that the table didn't exist
|
||||||
MainLog.Instance.Notice("ASSETS", "Creating new database tables");
|
if (tableName == null)
|
||||||
database.ExecuteResourceSql("CreateAssetsTable.sql");
|
{
|
||||||
return;
|
m_log.Info("[ASSETS]: Creating new database tables");
|
||||||
}
|
database.ExecuteResourceSql("CreateAssetsTable.sql");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Ensure that the assets related tables exists and are at the latest version
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private void TestTables()
|
/// Ensure that the assets related tables exists and are at the latest version
|
||||||
{
|
/// </summary>
|
||||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
private void TestTables()
|
||||||
|
{
|
||||||
tableList["assets"] = null;
|
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||||
database.GetTableVersion(tableList);
|
|
||||||
|
tableList["assets"] = null;
|
||||||
UpgradeAssetsTable(tableList["assets"]);
|
database.GetTableVersion(tableList);
|
||||||
}
|
|
||||||
|
UpgradeAssetsTable(tableList["assets"]);
|
||||||
public AssetBase FetchAsset(LLUUID assetID)
|
}
|
||||||
{
|
|
||||||
AssetBase asset = null;
|
public AssetBase FetchAsset(LLUUID assetID)
|
||||||
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
AssetBase asset = null;
|
||||||
param["id"] = assetID.ToString();
|
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
IDbCommand result = database.Query("SELECT * FROM assets WHERE id = @id", param);
|
param["id"] = assetID.ToString();
|
||||||
IDataReader reader = result.ExecuteReader();
|
|
||||||
|
IDbCommand result = database.Query("SELECT * FROM assets WHERE id = @id", param);
|
||||||
asset = database.getAssetRow(reader);
|
IDataReader reader = result.ExecuteReader();
|
||||||
reader.Close();
|
|
||||||
result.Dispose();
|
asset = database.getAssetRow(reader);
|
||||||
|
reader.Close();
|
||||||
return asset;
|
result.Dispose();
|
||||||
}
|
|
||||||
|
return asset;
|
||||||
public void CreateAsset(AssetBase asset)
|
}
|
||||||
{
|
|
||||||
if (ExistsAsset((LLUUID) asset.FullID))
|
public void CreateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
return;
|
if (ExistsAsset((LLUUID) asset.FullID))
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
SqlCommand cmd =
|
|
||||||
new SqlCommand(
|
|
||||||
"INSERT INTO assets ([id], [name], [mediaUrl], [description], [assetType], [invType], [local], [temporary], [data])" +
|
SqlCommand cmd =
|
||||||
" VALUES " +
|
new SqlCommand(
|
||||||
"(@id, @name, @mediaUrl, @description, @assetType, @invType, @local, @temporary, @data)",
|
"INSERT INTO assets ([id], [name], [mediaUrl], [description], [assetType], [invType], [local], [temporary], [data])" +
|
||||||
database.getConnection());
|
" VALUES " +
|
||||||
|
"(@id, @name, @mediaUrl, @description, @assetType, @invType, @local, @temporary, @data)",
|
||||||
using (cmd)
|
database.getConnection());
|
||||||
{
|
|
||||||
//SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar);
|
using (cmd)
|
||||||
//p.Value = asset.FullID.ToString();
|
{
|
||||||
cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
|
//SqlParameter p = cmd.Parameters.Add("id", SqlDbType.NVarChar);
|
||||||
cmd.Parameters.AddWithValue("name", asset.Name);
|
//p.Value = asset.FullID.ToString();
|
||||||
cmd.Parameters.AddWithValue("mediaUrl", asset.MediaURL);
|
cmd.Parameters.AddWithValue("id", asset.FullID.ToString());
|
||||||
cmd.Parameters.AddWithValue("description", asset.Description);
|
cmd.Parameters.AddWithValue("name", asset.Name);
|
||||||
SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt);
|
cmd.Parameters.AddWithValue("mediaUrl", asset.MediaURL);
|
||||||
e.Value = asset.Type;
|
cmd.Parameters.AddWithValue("description", asset.Description);
|
||||||
SqlParameter f = cmd.Parameters.Add("invType", SqlDbType.TinyInt);
|
SqlParameter e = cmd.Parameters.Add("assetType", SqlDbType.TinyInt);
|
||||||
f.Value = asset.InvType;
|
e.Value = asset.Type;
|
||||||
SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt);
|
SqlParameter f = cmd.Parameters.Add("invType", SqlDbType.TinyInt);
|
||||||
g.Value = asset.Local;
|
f.Value = asset.InvType;
|
||||||
SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt);
|
SqlParameter g = cmd.Parameters.Add("local", SqlDbType.TinyInt);
|
||||||
h.Value = asset.Temporary;
|
g.Value = asset.Local;
|
||||||
SqlParameter i = cmd.Parameters.Add("data", SqlDbType.Image);
|
SqlParameter h = cmd.Parameters.Add("temporary", SqlDbType.TinyInt);
|
||||||
i.Value = asset.Data;
|
h.Value = asset.Temporary;
|
||||||
try
|
SqlParameter i = cmd.Parameters.Add("data", SqlDbType.Image);
|
||||||
{
|
i.Value = asset.Data;
|
||||||
cmd.ExecuteNonQuery();
|
try
|
||||||
}
|
{
|
||||||
catch (Exception)
|
cmd.ExecuteNonQuery();
|
||||||
{
|
}
|
||||||
throw;
|
catch (Exception)
|
||||||
}
|
{
|
||||||
|
throw;
|
||||||
cmd.Dispose();
|
}
|
||||||
}
|
|
||||||
}
|
cmd.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
public void UpdateAsset(AssetBase asset)
|
|
||||||
{
|
|
||||||
SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
|
public void UpdateAsset(AssetBase asset)
|
||||||
"name = @name, " +
|
{
|
||||||
"mediaUrl = @mediaUrl, "+
|
SqlCommand command = new SqlCommand("UPDATE assets set id = @id, " +
|
||||||
"description = @description," +
|
"name = @name, " +
|
||||||
"assetType = @assetType," +
|
"mediaUrl = @mediaUrl, "+
|
||||||
"invType = @invType," +
|
"description = @description," +
|
||||||
"local = @local," +
|
"assetType = @assetType," +
|
||||||
"temporary = @temporary," +
|
"invType = @invType," +
|
||||||
"data = @data where " +
|
"local = @local," +
|
||||||
"id = @keyId;", database.getConnection());
|
"temporary = @temporary," +
|
||||||
SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
|
"data = @data where " +
|
||||||
SqlParameter param2 = new SqlParameter("@name", asset.Name);
|
"id = @keyId;", database.getConnection());
|
||||||
SqlParameter param3 = new SqlParameter("@mediaUrl", asset.MediaURL);
|
SqlParameter param1 = new SqlParameter("@id", asset.FullID.ToString());
|
||||||
SqlParameter param4 = new SqlParameter("@description", asset.Description);
|
SqlParameter param2 = new SqlParameter("@name", asset.Name);
|
||||||
SqlParameter param5 = new SqlParameter("@assetType", Convert.ToBoolean(asset.Type));
|
SqlParameter param3 = new SqlParameter("@mediaUrl", asset.MediaURL);
|
||||||
SqlParameter param6 = new SqlParameter("@invType", Convert.ToBoolean(asset.InvType));
|
SqlParameter param4 = new SqlParameter("@description", asset.Description);
|
||||||
SqlParameter param7 = new SqlParameter("@local", asset.Local);
|
SqlParameter param5 = new SqlParameter("@assetType", Convert.ToBoolean(asset.Type));
|
||||||
SqlParameter param8 = new SqlParameter("@temporary", asset.Temporary);
|
SqlParameter param6 = new SqlParameter("@invType", Convert.ToBoolean(asset.InvType));
|
||||||
SqlParameter param9 = new SqlParameter("@data", asset.Data);
|
SqlParameter param7 = new SqlParameter("@local", asset.Local);
|
||||||
SqlParameter param10 = new SqlParameter("@keyId", asset.FullID.ToString());
|
SqlParameter param8 = new SqlParameter("@temporary", asset.Temporary);
|
||||||
command.Parameters.Add(param1);
|
SqlParameter param9 = new SqlParameter("@data", asset.Data);
|
||||||
command.Parameters.Add(param2);
|
SqlParameter param10 = new SqlParameter("@keyId", asset.FullID.ToString());
|
||||||
command.Parameters.Add(param3);
|
command.Parameters.Add(param1);
|
||||||
command.Parameters.Add(param4);
|
command.Parameters.Add(param2);
|
||||||
command.Parameters.Add(param5);
|
command.Parameters.Add(param3);
|
||||||
command.Parameters.Add(param6);
|
command.Parameters.Add(param4);
|
||||||
command.Parameters.Add(param7);
|
command.Parameters.Add(param5);
|
||||||
command.Parameters.Add(param8);
|
command.Parameters.Add(param6);
|
||||||
command.Parameters.Add(param9);
|
command.Parameters.Add(param7);
|
||||||
command.Parameters.Add(param10);
|
command.Parameters.Add(param8);
|
||||||
|
command.Parameters.Add(param9);
|
||||||
try
|
command.Parameters.Add(param10);
|
||||||
{
|
|
||||||
command.ExecuteNonQuery();
|
try
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
command.ExecuteNonQuery();
|
||||||
{
|
}
|
||||||
MainLog.Instance.Error(e.ToString());
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
}
|
m_log.Error(e.ToString());
|
||||||
|
}
|
||||||
public bool ExistsAsset(LLUUID uuid)
|
}
|
||||||
{
|
|
||||||
if (FetchAsset(uuid) != null)
|
public bool ExistsAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
return true;
|
if (FetchAsset(uuid) != null)
|
||||||
}
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
// rex, new function, fixme not implemented
|
}
|
||||||
public List<AssetBase> GetAssetList(int vAssetType)
|
|
||||||
{
|
// rex, new function, fixme not implemented
|
||||||
List<AssetBase> retvals = new List<AssetBase>();
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
return retvals;
|
{
|
||||||
}
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
|
return retvals;
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// All writes are immediately commited to the database, so this is a no-op
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public void CommitAssets()
|
/// All writes are immediately commited to the database, so this is a no-op
|
||||||
{
|
/// </summary>
|
||||||
}
|
public void CommitAssets()
|
||||||
|
{
|
||||||
// rex new function for "replace assets" functionality
|
}
|
||||||
// TODO: actual implementation by someone, should return LLUUID of an asset
|
|
||||||
// with matching type & name, or zero if not in DB
|
// rex new function for "replace assets" functionality
|
||||||
public LLUUID ExistsAsset(sbyte type, string name)
|
// TODO: actual implementation by someone, should return LLUUID of an asset
|
||||||
{
|
// with matching type & name, or zero if not in DB
|
||||||
return LLUUID.Zero;
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
}
|
{
|
||||||
|
return LLUUID.Zero;
|
||||||
#endregion
|
}
|
||||||
|
|
||||||
#region IPlugin Members
|
#endregion
|
||||||
|
|
||||||
public void Initialise()
|
#region IPlugin Members
|
||||||
{
|
|
||||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
public void Initialise()
|
||||||
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
{
|
||||||
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||||
string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info");
|
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
||||||
string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
|
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
||||||
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info");
|
||||||
|
string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
|
||||||
database =
|
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
||||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
|
||||||
settingPassword);
|
database =
|
||||||
|
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||||
TestTables();
|
settingPassword);
|
||||||
}
|
|
||||||
|
TestTables();
|
||||||
public string Version
|
}
|
||||||
{
|
|
||||||
// get { return database.getVersion(); }
|
public string Version
|
||||||
get { return database.getVersion(); }
|
{
|
||||||
}
|
// get { return database.getVersion(); }
|
||||||
|
get { return database.getVersion(); }
|
||||||
public string Name
|
}
|
||||||
{
|
|
||||||
get { return "MSSQL Asset storage engine"; }
|
public string Name
|
||||||
}
|
{
|
||||||
|
get { return "MSSQL Asset storage engine"; }
|
||||||
#endregion
|
}
|
||||||
}
|
|
||||||
}
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,309 +1,327 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.MSSQL
|
namespace OpenSim.Framework.Data.MSSQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A grid data interface for Microsoft SQL Server
|
/// A grid data interface for Microsoft SQL Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SqlGridData : IGridData
|
public class MSSQLGridData : IGridData
|
||||||
{
|
{
|
||||||
/// <summary>
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
/// Database manager
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private MSSQLManager database;
|
/// Database manager
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private MSSQLManager database;
|
||||||
/// Initialises the Grid Interface
|
|
||||||
/// </summary>
|
private string m_regionsTableName;
|
||||||
public void Initialise()
|
|
||||||
{
|
/// <summary>
|
||||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
/// Initialises the Grid Interface
|
||||||
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
/// </summary>
|
||||||
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
public void Initialise()
|
||||||
string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info");
|
{
|
||||||
string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
|
IniFile iniFile = new IniFile("mssql_connection.ini");
|
||||||
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
|
||||||
|
string settingDataSource = iniFile.ParseFileReadValue("data_source");
|
||||||
database =
|
string settingInitialCatalog = iniFile.ParseFileReadValue("initial_catalog");
|
||||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
string settingPersistSecurityInfo = iniFile.ParseFileReadValue("persist_security_info");
|
||||||
settingPassword);
|
string settingUserId = iniFile.ParseFileReadValue("user_id");
|
||||||
}
|
string settingPassword = iniFile.ParseFileReadValue("password");
|
||||||
|
|
||||||
/// <summary>
|
m_regionsTableName = iniFile.ParseFileReadValue("regionstablename");
|
||||||
/// Shuts down the grid interface
|
if (m_regionsTableName == null)
|
||||||
/// </summary>
|
{
|
||||||
public void Close()
|
m_regionsTableName = "regions";
|
||||||
{
|
}
|
||||||
database.Close();
|
|
||||||
}
|
database =
|
||||||
|
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||||
/// <summary>
|
settingPassword);
|
||||||
/// Returns the storage system name
|
|
||||||
/// </summary>
|
TestTables();
|
||||||
/// <returns>A string containing the storage system name</returns>
|
}
|
||||||
public string getName()
|
|
||||||
{
|
private void TestTables()
|
||||||
return "Sql OpenGridData";
|
{
|
||||||
}
|
IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>());
|
||||||
|
|
||||||
/// <summary>
|
try
|
||||||
/// Returns the storage system version
|
{
|
||||||
/// </summary>
|
cmd.ExecuteNonQuery();
|
||||||
/// <returns>A string containing the storage system version</returns>
|
cmd.Dispose();
|
||||||
public string getVersion()
|
}
|
||||||
{
|
catch (Exception)
|
||||||
return "0.1";
|
{
|
||||||
}
|
m_log.Info("[DATASTORE]: MSSQL Database doesn't exist... creating");
|
||||||
|
database.ExecuteResourceSql("Mssql-regions.sql");
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a list of regions within the specified ranges
|
}
|
||||||
/// </summary>
|
|
||||||
/// <param name="a">minimum X coordinate</param>
|
/// <summary>
|
||||||
/// <param name="b">minimum Y coordinate</param>
|
/// Shuts down the grid interface
|
||||||
/// <param name="c">maximum X coordinate</param>
|
/// </summary>
|
||||||
/// <param name="d">maximum Y coordinate</param>
|
public void Close()
|
||||||
/// <returns>An array of region profiles</returns>
|
{
|
||||||
public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
|
database.Close();
|
||||||
{
|
}
|
||||||
return null;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns the storage system name
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Returns a sim profile from it's location
|
/// <returns>A string containing the storage system name</returns>
|
||||||
/// </summary>
|
public string getName()
|
||||||
/// <param name="handle">Region location handle</param>
|
{
|
||||||
/// <returns>Sim profile</returns>
|
return "Sql OpenGridData";
|
||||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
}
|
||||||
{
|
|
||||||
IDataReader reader = null;
|
/// <summary>
|
||||||
try
|
/// Returns the storage system version
|
||||||
{
|
/// </summary>
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
/// <returns>A string containing the storage system version</returns>
|
||||||
param["handle"] = handle.ToString();
|
public string getVersion()
|
||||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = @handle", param);
|
{
|
||||||
reader = result.ExecuteReader();
|
return "0.1";
|
||||||
|
}
|
||||||
RegionProfileData row = database.getRegionRow(reader);
|
|
||||||
reader.Close();
|
/// <summary>
|
||||||
result.Dispose();
|
/// Returns a list of regions within the specified ranges
|
||||||
|
/// </summary>
|
||||||
return row;
|
/// <param name="a">minimum X coordinate</param>
|
||||||
}
|
/// <param name="b">minimum Y coordinate</param>
|
||||||
catch (Exception)
|
/// <param name="c">maximum X coordinate</param>
|
||||||
{
|
/// <param name="d">maximum Y coordinate</param>
|
||||||
if (reader != null)
|
/// <returns>An array of region profiles</returns>
|
||||||
{
|
public RegionProfileData[] GetProfilesInRange(uint a, uint b, uint c, uint d)
|
||||||
reader.Close();
|
{
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns a sim profile from it's location
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// // Returns a list of avatar and UUIDs that match the query
|
/// <param name="handle">Region location handle</param>
|
||||||
/// </summary>
|
/// <returns>Sim profile</returns>
|
||||||
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||||
{
|
{
|
||||||
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
|
IDataReader reader = null;
|
||||||
string[] querysplit;
|
try
|
||||||
querysplit = query.Split(' ');
|
{
|
||||||
if (querysplit.Length == 2)
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
{
|
param["handle"] = handle.ToString();
|
||||||
try
|
IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE regionHandle = @handle", param);
|
||||||
{
|
reader = result.ExecuteReader();
|
||||||
lock (database)
|
|
||||||
{
|
RegionProfileData row = database.getRegionRow(reader);
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
reader.Close();
|
||||||
param["first"] = querysplit[0];
|
result.Dispose();
|
||||||
param["second"] = querysplit[1];
|
|
||||||
|
return row;
|
||||||
IDbCommand result =
|
}
|
||||||
database.Query(
|
catch (Exception)
|
||||||
"SELECT UUID,username,surname FROM users WHERE username = @first AND lastname = @second",
|
{
|
||||||
param);
|
if (reader != null)
|
||||||
IDataReader reader = result.ExecuteReader();
|
{
|
||||||
|
reader.Close();
|
||||||
|
}
|
||||||
while (reader.Read())
|
}
|
||||||
{
|
return null;
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
}
|
||||||
user.AvatarID = new LLUUID((string) reader["UUID"]);
|
|
||||||
user.firstName = (string) reader["username"];
|
|
||||||
user.lastName = (string) reader["surname"];
|
/// <summary>
|
||||||
returnlist.Add(user);
|
/// Returns a sim profile from it's UUID
|
||||||
}
|
/// </summary>
|
||||||
reader.Close();
|
/// <param name="uuid">The region UUID</param>
|
||||||
result.Dispose();
|
/// <returns>The sim profile</returns>
|
||||||
}
|
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||||
}
|
{
|
||||||
catch (Exception e)
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
{
|
param["uuid"] = uuid.ToString();
|
||||||
database.Reconnect();
|
IDbCommand result = database.Query("SELECT * FROM " + m_regionsTableName + " WHERE uuid = @uuid", param);
|
||||||
MainLog.Instance.Error(e.ToString());
|
IDataReader reader = result.ExecuteReader();
|
||||||
return returnlist;
|
|
||||||
}
|
RegionProfileData row = database.getRegionRow(reader);
|
||||||
}
|
reader.Close();
|
||||||
else if (querysplit.Length == 1)
|
result.Dispose();
|
||||||
{
|
|
||||||
try
|
return row;
|
||||||
{
|
}
|
||||||
lock (database)
|
|
||||||
{
|
/// <summary>
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
/// Adds a new specified region to the database
|
||||||
param["first"] = querysplit[0];
|
/// </summary>
|
||||||
param["second"] = querysplit[1];
|
/// <param name="profile">The profile to add</param>
|
||||||
|
/// <returns>A dataresponse enum indicating success</returns>
|
||||||
IDbCommand result =
|
public DataResponse AddProfile(RegionProfileData profile)
|
||||||
database.Query(
|
{
|
||||||
"SELECT UUID,username,surname FROM users WHERE username = @first OR lastname = @second",
|
try
|
||||||
param);
|
{
|
||||||
IDataReader reader = result.ExecuteReader();
|
if (GetProfileByLLUUID(profile.UUID) != null)
|
||||||
|
{
|
||||||
|
return DataResponse.RESPONSE_OK;
|
||||||
while (reader.Read())
|
}
|
||||||
{
|
}
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
catch (Exception)
|
||||||
user.AvatarID = new LLUUID((string) reader["UUID"]);
|
{
|
||||||
user.firstName = (string) reader["username"];
|
System.Console.WriteLine("No regions found. Create new one.");
|
||||||
user.lastName = (string) reader["surname"];
|
}
|
||||||
returnlist.Add(user);
|
|
||||||
}
|
if ( insertRegionRow(profile))
|
||||||
reader.Close();
|
{
|
||||||
result.Dispose();
|
return DataResponse.RESPONSE_OK;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
return DataResponse.RESPONSE_ERROR;
|
||||||
database.Reconnect();
|
}
|
||||||
MainLog.Instance.Error(e.ToString());
|
}
|
||||||
return returnlist;
|
|
||||||
}
|
|
||||||
}
|
/// <summary>
|
||||||
return returnlist;
|
/// Creates a new region in the database
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="profile">The region profile to insert</param>
|
||||||
/// <summary>
|
/// <returns>Successful?</returns>
|
||||||
/// Returns a sim profile from it's UUID
|
public bool insertRegionRow(RegionProfileData profile)
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="uuid">The region UUID</param>
|
//Insert new region
|
||||||
/// <returns>The sim profile</returns>
|
string sql =
|
||||||
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
"INSERT INTO " + m_regionsTableName + " ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], ";
|
||||||
{
|
sql +=
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
"[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], ";
|
||||||
param["uuid"] = uuid.ToString();
|
sql +=
|
||||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = @uuid", param);
|
"[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES ";
|
||||||
IDataReader reader = result.ExecuteReader();
|
|
||||||
|
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
|
||||||
RegionProfileData row = database.getRegionRow(reader);
|
sql +=
|
||||||
reader.Close();
|
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
|
||||||
result.Dispose();
|
sql +=
|
||||||
|
"@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);";
|
||||||
return row;
|
|
||||||
}
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
|
|
||||||
/// <summary>
|
parameters["regionHandle"] = profile.regionHandle.ToString();
|
||||||
/// Adds a new specified region to the database
|
parameters["regionName"] = profile.regionName;
|
||||||
/// </summary>
|
parameters["uuid"] = profile.UUID.ToString();
|
||||||
/// <param name="profile">The profile to add</param>
|
parameters["regionRecvKey"] = profile.regionRecvKey;
|
||||||
/// <returns>A dataresponse enum indicating success</returns>
|
parameters["regionSecret"] = profile.regionSecret;
|
||||||
public DataResponse AddProfile(RegionProfileData profile)
|
parameters["regionSendKey"] = profile.regionSendKey;
|
||||||
{
|
parameters["regionDataURI"] = profile.regionDataURI;
|
||||||
try
|
parameters["serverIP"] = profile.serverIP;
|
||||||
{
|
parameters["serverPort"] = profile.serverPort.ToString();
|
||||||
if (GetProfileByLLUUID(profile.UUID) != null)
|
parameters["serverURI"] = profile.serverURI;
|
||||||
{
|
parameters["locX"] = profile.regionLocX.ToString();
|
||||||
return DataResponse.RESPONSE_OK;
|
parameters["locY"] = profile.regionLocY.ToString();
|
||||||
}
|
parameters["locZ"] = profile.regionLocZ.ToString();
|
||||||
}
|
parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
|
||||||
catch (Exception)
|
parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
|
||||||
{
|
parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
|
||||||
System.Console.WriteLine("No regions found. Create new one.");
|
parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
|
||||||
}
|
parameters["regionAssetURI"] = profile.regionAssetURI;
|
||||||
|
parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
|
||||||
if (database.insertRegionRow(profile))
|
parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
|
||||||
{
|
parameters["regionUserURI"] = profile.regionUserURI;
|
||||||
return DataResponse.RESPONSE_OK;
|
parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
|
||||||
}
|
parameters["regionUserSendKey"] = profile.regionUserSendKey;
|
||||||
else
|
parameters["regionMapTexture"] = profile.regionMapTextureID.ToString();
|
||||||
{
|
parameters["serverHttpPort"] = profile.httpPort.ToString();
|
||||||
return DataResponse.RESPONSE_ERROR;
|
parameters["serverRemotingPort"] = profile.remotingPort.ToString();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
bool returnval = false;
|
||||||
/// <summary>
|
|
||||||
/// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
|
try
|
||||||
/// </summary>
|
{
|
||||||
/// <param name="uuid">The UUID of the challenger</param>
|
IDbCommand result = database.Query(sql, parameters);
|
||||||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
|
||||||
/// <param name="authkey">The secret</param>
|
if (result.ExecuteNonQuery() == 1)
|
||||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
returnval = true;
|
||||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
|
|
||||||
{
|
result.Dispose();
|
||||||
bool throwHissyFit = false; // Should be true by 1.0
|
}
|
||||||
|
catch (Exception e)
|
||||||
if (throwHissyFit)
|
{
|
||||||
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
|
m_log.Error("MSSQLManager : " + e.ToString());
|
||||||
|
}
|
||||||
RegionProfileData data = GetProfileByLLUUID(uuid);
|
|
||||||
|
return returnval;
|
||||||
return (handle == data.regionHandle && authkey == data.regionSecret);
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
|
||||||
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
|
/// </summary>
|
||||||
/// </summary>
|
/// <param name="uuid">The UUID of the challenger</param>
|
||||||
/// <remarks>This requires a security audit.</remarks>
|
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||||
/// <param name="uuid"></param>
|
/// <param name="authkey">The secret</param>
|
||||||
/// <param name="handle"></param>
|
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||||
/// <param name="authhash"></param>
|
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
|
||||||
/// <param name="challenge"></param>
|
{
|
||||||
/// <returns></returns>
|
bool throwHissyFit = false; // Should be true by 1.0
|
||||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
|
|
||||||
{
|
if (throwHissyFit)
|
||||||
SHA512Managed HashProvider = new SHA512Managed();
|
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
|
||||||
ASCIIEncoding TextProvider = new ASCIIEncoding();
|
|
||||||
|
RegionProfileData data = GetProfileByLLUUID(uuid);
|
||||||
byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
|
|
||||||
byte[] hash = HashProvider.ComputeHash(stream);
|
return (handle == data.regionHandle && authkey == data.regionSecret);
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
public ReservationData GetReservationAtPoint(uint x, uint y)
|
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
|
||||||
{
|
/// </summary>
|
||||||
return null;
|
/// <remarks>This requires a security audit.</remarks>
|
||||||
}
|
/// <param name="uuid"></param>
|
||||||
}
|
/// <param name="handle"></param>
|
||||||
}
|
/// <param name="authhash"></param>
|
||||||
|
/// <param name="challenge"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
|
||||||
|
{
|
||||||
|
SHA512Managed HashProvider = new SHA512Managed();
|
||||||
|
ASCIIEncoding TextProvider = new ASCIIEncoding();
|
||||||
|
|
||||||
|
byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
|
||||||
|
byte[] hash = HashProvider.ComputeHash(stream);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReservationData GetReservationAtPoint(uint x, uint y)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,105 +1,120 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
namespace OpenSim.Framework.Data.MSSQL
|
using System.Collections.Generic;
|
||||||
{
|
using System.Data;
|
||||||
/// <summary>
|
|
||||||
/// An interface to the log database for MySQL
|
namespace OpenSim.Framework.Data.MSSQL
|
||||||
/// </summary>
|
{
|
||||||
internal class MSSQLLogData : ILogData
|
/// <summary>
|
||||||
{
|
/// An interface to the log database for MySQL
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// The database manager
|
internal class MSSQLLogData : ILogData
|
||||||
/// </summary>
|
{
|
||||||
public MSSQLManager database;
|
/// <summary>
|
||||||
|
/// The database manager
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Artificial constructor called when the plugin is loaded
|
public MSSQLManager database;
|
||||||
/// </summary>
|
|
||||||
public void Initialise()
|
/// <summary>
|
||||||
{
|
/// Artificial constructor called when the plugin is loaded
|
||||||
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
/// </summary>
|
||||||
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
public void Initialise()
|
||||||
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
{
|
||||||
string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info");
|
IniFile GridDataMySqlFile = new IniFile("mssql_connection.ini");
|
||||||
string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
|
string settingDataSource = GridDataMySqlFile.ParseFileReadValue("data_source");
|
||||||
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
string settingInitialCatalog = GridDataMySqlFile.ParseFileReadValue("initial_catalog");
|
||||||
|
string settingPersistSecurityInfo = GridDataMySqlFile.ParseFileReadValue("persist_security_info");
|
||||||
database =
|
string settingUserId = GridDataMySqlFile.ParseFileReadValue("user_id");
|
||||||
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
||||||
settingPassword);
|
|
||||||
}
|
database =
|
||||||
|
new MSSQLManager(settingDataSource, settingInitialCatalog, settingPersistSecurityInfo, settingUserId,
|
||||||
/// <summary>
|
settingPassword);
|
||||||
/// Saves a log item to the database
|
|
||||||
/// </summary>
|
IDbCommand cmd = database.Query("select top 1 * from logs", new Dictionary<string, string>());
|
||||||
/// <param name="serverDaemon">The daemon triggering the event</param>
|
try
|
||||||
/// <param name="target">The target of the action (region / agent UUID, etc)</param>
|
{
|
||||||
/// <param name="methodCall">The method call where the problem occured</param>
|
cmd.ExecuteNonQuery();
|
||||||
/// <param name="arguments">The arguments passed to the method</param>
|
cmd.Dispose();
|
||||||
/// <param name="priority">How critical is this?</param>
|
}
|
||||||
/// <param name="logMessage">The message to log</param>
|
catch
|
||||||
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
{
|
||||||
string logMessage)
|
database.ExecuteResourceSql("Mssql-logs.sql");
|
||||||
{
|
}
|
||||||
try
|
|
||||||
{
|
}
|
||||||
database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
|
|
||||||
}
|
/// <summary>
|
||||||
catch
|
/// Saves a log item to the database
|
||||||
{
|
/// </summary>
|
||||||
database.Reconnect();
|
/// <param name="serverDaemon">The daemon triggering the event</param>
|
||||||
}
|
/// <param name="target">The target of the action (region / agent UUID, etc)</param>
|
||||||
}
|
/// <param name="methodCall">The method call where the problem occured</param>
|
||||||
|
/// <param name="arguments">The arguments passed to the method</param>
|
||||||
/// <summary>
|
/// <param name="priority">How critical is this?</param>
|
||||||
/// Returns the name of this DB provider
|
/// <param name="logMessage">The message to log</param>
|
||||||
/// </summary>
|
public void saveLog(string serverDaemon, string target, string methodCall, string arguments, int priority,
|
||||||
/// <returns>A string containing the DB provider name</returns>
|
string logMessage)
|
||||||
public string getName()
|
{
|
||||||
{
|
try
|
||||||
return "MSSQL Logdata Interface";
|
{
|
||||||
}
|
database.insertLogRow(serverDaemon, target, methodCall, arguments, priority, logMessage);
|
||||||
|
}
|
||||||
/// <summary>
|
catch
|
||||||
/// Closes the database provider
|
{
|
||||||
/// </summary>
|
database.Reconnect();
|
||||||
public void Close()
|
}
|
||||||
{
|
}
|
||||||
// Do nothing.
|
|
||||||
}
|
/// <summary>
|
||||||
|
/// Returns the name of this DB provider
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Returns the version of this DB provider
|
/// <returns>A string containing the DB provider name</returns>
|
||||||
/// </summary>
|
public string getName()
|
||||||
/// <returns>A string containing the provider version</returns>
|
{
|
||||||
public string getVersion()
|
return "MSSQL Logdata Interface";
|
||||||
{
|
}
|
||||||
return "0.1";
|
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Closes the database provider
|
||||||
}
|
/// </summary>
|
||||||
|
public void Close()
|
||||||
|
{
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the version of this DB provider
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A string containing the provider version</returns>
|
||||||
|
public string getVersion()
|
||||||
|
{
|
||||||
|
return "0.1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Framework.Data.MSSQL")]
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Framework.Data.MSSQL")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("0e1c1ca4-2cf2-4315-b0e7-432c02feea8a")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
|
||||||
|
SET ANSI_PADDING ON
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[userfriends](
|
||||||
|
[ownerID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||||
|
[friendID] [varchar](50) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||||
|
[friendPerms] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
|
||||||
|
[datetimestamp] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
|
||||||
|
) ON [PRIMARY]
|
||||||
|
|
||||||
|
SET ANSI_PADDING OFF
|
|
@ -0,0 +1,40 @@
|
||||||
|
SET ANSI_NULLS ON
|
||||||
|
|
||||||
|
SET QUOTED_IDENTIFIER ON
|
||||||
|
|
||||||
|
SET ANSI_PADDING ON
|
||||||
|
|
||||||
|
CREATE TABLE [dbo].[regions](
|
||||||
|
[regionHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionName] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[uuid] [varchar](255) COLLATE Latin1_General_CI_AS NOT NULL,
|
||||||
|
[regionRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionSecret] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionDataURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[serverIP] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[serverPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[serverURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[locX] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[locY] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[locZ] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[eastOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[westOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[southOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[northOverrideHandle] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionAssetURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionAssetRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionAssetSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionUserURI] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionUserRecvKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionUserSendKey] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[regionMapTexture] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[serverHttpPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
[serverRemotingPort] [varchar](255) COLLATE Latin1_General_CI_AS NULL,
|
||||||
|
PRIMARY KEY CLUSTERED
|
||||||
|
(
|
||||||
|
[uuid] ASC
|
||||||
|
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
|
||||||
|
) ON [PRIMARY]
|
||||||
|
|
||||||
|
SET ANSI_PADDING OFF
|
|
@ -1,194 +1,214 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.MySQL
|
namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
internal class MySQLAssetData : IAssetProvider
|
internal class MySQLAssetData : IAssetProvider
|
||||||
{
|
{
|
||||||
private MySQLManager _dbConnection;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
#region IAssetProvider Members
|
private MySQLManager _dbConnection;
|
||||||
|
|
||||||
private void UpgradeAssetsTable(string oldVersion)
|
#region IAssetProvider Members
|
||||||
{
|
|
||||||
// null as the version, indicates that the table didn't exist
|
private void UpgradeAssetsTable(string oldVersion)
|
||||||
if (oldVersion == null)
|
{
|
||||||
{
|
// null as the version, indicates that the table didn't exist
|
||||||
MainLog.Instance.Notice("ASSETS", "Creating new database tables");
|
if (oldVersion == null)
|
||||||
_dbConnection.ExecuteResourceSql("CreateAssetsTable.sql");
|
{
|
||||||
return;
|
m_log.Info("[ASSETS]: Creating new database tables");
|
||||||
}
|
_dbConnection.ExecuteResourceSql("CreateAssetsTable.sql");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Ensure that the assets related tables exists and are at the latest version
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private void TestTables()
|
/// Ensure that the assets related tables exists and are at the latest version
|
||||||
{
|
/// </summary>
|
||||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
private void TestTables()
|
||||||
|
{
|
||||||
tableList["assets"] = null;
|
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||||
_dbConnection.GetTableVersion(tableList);
|
|
||||||
|
tableList["assets"] = null;
|
||||||
UpgradeAssetsTable(tableList["assets"]);
|
_dbConnection.GetTableVersion(tableList);
|
||||||
}
|
|
||||||
|
UpgradeAssetsTable(tableList["assets"]);
|
||||||
public AssetBase FetchAsset(LLUUID assetID)
|
}
|
||||||
{
|
|
||||||
AssetBase asset = null;
|
public AssetBase FetchAsset(LLUUID assetID)
|
||||||
lock (_dbConnection)
|
{
|
||||||
{
|
AssetBase asset = null;
|
||||||
MySqlCommand cmd =
|
lock (_dbConnection)
|
||||||
new MySqlCommand(
|
{
|
||||||
"SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id",
|
MySqlCommand cmd =
|
||||||
_dbConnection.Connection);
|
new MySqlCommand(
|
||||||
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
|
"SELECT name, description, assetType, invType, local, temporary, data FROM assets WHERE id=?id",
|
||||||
p.Value = assetID.GetBytes();
|
_dbConnection.Connection);
|
||||||
try
|
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
|
||||||
{
|
p.Value = assetID.GetBytes();
|
||||||
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
|
||||||
{
|
try
|
||||||
if (dbReader.Read())
|
{
|
||||||
{
|
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
|
||||||
asset = new AssetBase();
|
{
|
||||||
asset.Data = (byte[]) dbReader["data"];
|
if (dbReader.Read())
|
||||||
asset.Description = (string) dbReader["description"];
|
{
|
||||||
asset.FullID = assetID;
|
asset = new AssetBase();
|
||||||
asset.InvType = (sbyte) dbReader["invType"];
|
asset.Data = (byte[]) dbReader["data"];
|
||||||
asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
|
asset.Description = (string) dbReader["description"];
|
||||||
asset.Name = (string) dbReader["name"];
|
asset.FullID = assetID;
|
||||||
asset.Type = (sbyte) dbReader["assetType"];
|
asset.InvType = (sbyte) dbReader["invType"];
|
||||||
}
|
asset.Local = ((sbyte) dbReader["local"]) != 0 ? true : false;
|
||||||
dbReader.Close();
|
asset.Name = (string) dbReader["name"];
|
||||||
cmd.Dispose();
|
asset.Type = (sbyte) dbReader["assetType"];
|
||||||
}
|
}
|
||||||
}
|
dbReader.Close();
|
||||||
catch (Exception)
|
cmd.Dispose();
|
||||||
{
|
}
|
||||||
MainLog.Instance.Warn("ASSETS", "MySql failure fetching asset");
|
}
|
||||||
}
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
return asset;
|
m_log.ErrorFormat(
|
||||||
}
|
"[ASSETS]: MySql failure fetching asset {0}" + Environment.NewLine + e.ToString()
|
||||||
|
+ Environment.NewLine + "Attempting reconnection", assetID);
|
||||||
public void CreateAsset(AssetBase asset)
|
_dbConnection.Reconnect();
|
||||||
{
|
}
|
||||||
MySqlCommand cmd =
|
}
|
||||||
new MySqlCommand(
|
return asset;
|
||||||
"REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
|
}
|
||||||
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)",
|
|
||||||
_dbConnection.Connection);
|
public void CreateAsset(AssetBase asset)
|
||||||
|
{
|
||||||
// need to ensure we dispose
|
lock (_dbConnection)
|
||||||
using (cmd)
|
{
|
||||||
{
|
MySqlCommand cmd =
|
||||||
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
|
new MySqlCommand(
|
||||||
p.Value = asset.FullID.GetBytes();
|
"REPLACE INTO assets(id, name, description, assetType, invType, local, temporary, data)" +
|
||||||
cmd.Parameters.AddWithValue("?name", asset.Name);
|
"VALUES(?id, ?name, ?description, ?assetType, ?invType, ?local, ?temporary, ?data)",
|
||||||
cmd.Parameters.AddWithValue("?description", asset.Description);
|
_dbConnection.Connection);
|
||||||
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
|
||||||
cmd.Parameters.AddWithValue("?invType", asset.InvType);
|
// need to ensure we dispose
|
||||||
cmd.Parameters.AddWithValue("?local", asset.Local);
|
try
|
||||||
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
{
|
||||||
cmd.Parameters.AddWithValue("?data", asset.Data);
|
using (cmd)
|
||||||
cmd.ExecuteNonQuery();
|
{
|
||||||
cmd.Dispose();
|
MySqlParameter p = cmd.Parameters.Add("?id", MySqlDbType.Binary, 16);
|
||||||
}
|
p.Value = asset.FullID.GetBytes();
|
||||||
}
|
cmd.Parameters.AddWithValue("?name", asset.Name);
|
||||||
|
cmd.Parameters.AddWithValue("?description", asset.Description);
|
||||||
public void UpdateAsset(AssetBase asset)
|
cmd.Parameters.AddWithValue("?assetType", asset.Type);
|
||||||
{
|
cmd.Parameters.AddWithValue("?invType", asset.InvType);
|
||||||
CreateAsset(asset);
|
cmd.Parameters.AddWithValue("?local", asset.Local);
|
||||||
}
|
cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
|
||||||
|
cmd.Parameters.AddWithValue("?data", asset.Data);
|
||||||
public bool ExistsAsset(LLUUID uuid)
|
cmd.ExecuteNonQuery();
|
||||||
{
|
cmd.Dispose();
|
||||||
throw new Exception("The method or operation is not implemented.");
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
// rex, new function, fixme not implemented
|
{
|
||||||
public List<AssetBase> GetAssetList(int vAssetType)
|
m_log.ErrorFormat(
|
||||||
{
|
"[ASSETS]: " +
|
||||||
List<AssetBase> retvals = new List<AssetBase>();
|
"MySql failure creating asset {0} with name {1}" + Environment.NewLine + e.ToString()
|
||||||
return retvals;
|
+ Environment.NewLine + "Attempting reconnection", asset.FullID, asset.Name);
|
||||||
}
|
_dbConnection.Reconnect();
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// All writes are immediately commited to the database, so this is a no-op
|
}
|
||||||
/// </summary>
|
|
||||||
public void CommitAssets()
|
public void UpdateAsset(AssetBase asset)
|
||||||
{
|
{
|
||||||
}
|
CreateAsset(asset);
|
||||||
|
}
|
||||||
// rex new function for "replace assets" functionality
|
|
||||||
// TODO: actual implementation by someone, should return LLUUID of an asset
|
public bool ExistsAsset(LLUUID uuid)
|
||||||
// with matching type & name, or zero if not in DB
|
{
|
||||||
public LLUUID ExistsAsset(sbyte type, string name)
|
throw new Exception("The method or operation is not implemented.");
|
||||||
{
|
}
|
||||||
return LLUUID.Zero;
|
|
||||||
}
|
// rex, new function, fixme not implemented
|
||||||
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
#endregion
|
{
|
||||||
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
#region IPlugin Members
|
return retvals;
|
||||||
|
}
|
||||||
public void Initialise()
|
|
||||||
{
|
/// <summary>
|
||||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
/// All writes are immediately commited to the database, so this is a no-op
|
||||||
string hostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
/// </summary>
|
||||||
string database = GridDataMySqlFile.ParseFileReadValue("database");
|
public void CommitAssets()
|
||||||
string username = GridDataMySqlFile.ParseFileReadValue("username");
|
{
|
||||||
string password = GridDataMySqlFile.ParseFileReadValue("password");
|
}
|
||||||
string pooling = GridDataMySqlFile.ParseFileReadValue("pooling");
|
|
||||||
string port = GridDataMySqlFile.ParseFileReadValue("port");
|
// rex new function for "replace assets" functionality
|
||||||
|
// TODO: actual implementation by someone, should return LLUUID of an asset
|
||||||
_dbConnection = new MySQLManager(hostname, database, username, password, pooling, port);
|
// with matching type & name, or zero if not in DB
|
||||||
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
TestTables();
|
{
|
||||||
}
|
return LLUUID.Zero;
|
||||||
|
}
|
||||||
public string Version
|
|
||||||
{
|
#endregion
|
||||||
get { return _dbConnection.getVersion(); }
|
|
||||||
}
|
#region IPlugin Members
|
||||||
|
|
||||||
public string Name
|
public void Initialise()
|
||||||
{
|
{
|
||||||
get { return "MySQL Asset storage engine"; }
|
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||||
}
|
string hostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
||||||
|
string database = GridDataMySqlFile.ParseFileReadValue("database");
|
||||||
#endregion
|
string username = GridDataMySqlFile.ParseFileReadValue("username");
|
||||||
}
|
string password = GridDataMySqlFile.ParseFileReadValue("password");
|
||||||
}
|
string pooling = GridDataMySqlFile.ParseFileReadValue("pooling");
|
||||||
|
string port = GridDataMySqlFile.ParseFileReadValue("port");
|
||||||
|
|
||||||
|
_dbConnection = new MySQLManager(hostname, database, username, password, pooling, port);
|
||||||
|
|
||||||
|
TestTables();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Version
|
||||||
|
{
|
||||||
|
get { return _dbConnection.getVersion(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "MySQL Asset storage engine"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Data.Common;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
//using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data.MySQL
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
||||||
|
{
|
||||||
|
public MySQLDatabaseMapper(string connectionString)
|
||||||
|
: base(connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DbConnection GetNewConnection()
|
||||||
|
{
|
||||||
|
MySqlConnection connection = new MySqlConnection(m_connectionString);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CreateParamName(string fieldName)
|
||||||
|
{
|
||||||
|
return "?" + fieldName;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
|
@ -1,413 +1,331 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.MySQL
|
namespace OpenSim.Framework.Data.MySQL
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A MySQL Interface for the Grid Server
|
/// A MySQL Interface for the Grid Server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MySQLGridData : IGridData
|
public class MySQLGridData : IGridData
|
||||||
{
|
{
|
||||||
/// <summary>
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
/// MySQL Database Manager
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private MySQLManager database;
|
/// MySQL Database Manager
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
private MySQLManager database;
|
||||||
/// Initialises the Grid Interface
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public void Initialise()
|
/// Initialises the Grid Interface
|
||||||
{
|
/// </summary>
|
||||||
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
public void Initialise()
|
||||||
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
{
|
||||||
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
|
IniFile GridDataMySqlFile = new IniFile("mysql_connection.ini");
|
||||||
string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
|
string settingHostname = GridDataMySqlFile.ParseFileReadValue("hostname");
|
||||||
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
string settingDatabase = GridDataMySqlFile.ParseFileReadValue("database");
|
||||||
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
|
string settingUsername = GridDataMySqlFile.ParseFileReadValue("username");
|
||||||
string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
|
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
|
||||||
|
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
|
||||||
database =
|
string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
|
||||||
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
|
|
||||||
settingPort);
|
database =
|
||||||
|
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
|
||||||
TestTables();
|
settingPort);
|
||||||
}
|
|
||||||
|
TestTables();
|
||||||
#region Test and initialization code
|
}
|
||||||
|
|
||||||
/// <summary>
|
#region Test and initialization code
|
||||||
/// Ensure that the user related tables exists and are at the latest version
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private void TestTables()
|
/// Ensure that the user related tables exists and are at the latest version
|
||||||
{
|
/// </summary>
|
||||||
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
private void TestTables()
|
||||||
|
{
|
||||||
tableList["regions"] = null;
|
Dictionary<string, string> tableList = new Dictionary<string, string>();
|
||||||
database.GetTableVersion(tableList);
|
|
||||||
|
tableList["regions"] = null;
|
||||||
UpgradeRegionsTable(tableList["regions"]);
|
database.GetTableVersion(tableList);
|
||||||
}
|
|
||||||
|
UpgradeRegionsTable(tableList["regions"]);
|
||||||
/// <summary>
|
}
|
||||||
/// Create or upgrade the table if necessary
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="oldVersion">A null indicates that the table does not
|
/// Create or upgrade the table if necessary
|
||||||
/// currently exist</param>
|
/// </summary>
|
||||||
private void UpgradeRegionsTable(string oldVersion)
|
/// <param name="oldVersion">A null indicates that the table does not
|
||||||
{
|
/// currently exist</param>
|
||||||
// null as the version, indicates that the table didn't exist
|
private void UpgradeRegionsTable(string oldVersion)
|
||||||
if (oldVersion == null)
|
{
|
||||||
{
|
// null as the version, indicates that the table didn't exist
|
||||||
database.ExecuteResourceSql("CreateRegionsTable.sql");
|
if (oldVersion == null)
|
||||||
return;
|
{
|
||||||
}
|
database.ExecuteResourceSql("CreateRegionsTable.sql");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
#endregion
|
}
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Shuts down the grid interface
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public void Close()
|
/// Shuts down the grid interface
|
||||||
{
|
/// </summary>
|
||||||
database.Close();
|
public void Close()
|
||||||
}
|
{
|
||||||
|
database.Close();
|
||||||
/// <summary>
|
}
|
||||||
/// Returns the plugin name
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <returns>Plugin name</returns>
|
/// Returns the plugin name
|
||||||
public string getName()
|
/// </summary>
|
||||||
{
|
/// <returns>Plugin name</returns>
|
||||||
return "MySql OpenGridData";
|
public string getName()
|
||||||
}
|
{
|
||||||
|
return "MySql OpenGridData";
|
||||||
/// <summary>
|
}
|
||||||
/// Returns the plugin version
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <returns>Plugin version</returns>
|
/// Returns the plugin version
|
||||||
public string getVersion()
|
/// </summary>
|
||||||
{
|
/// <returns>Plugin version</returns>
|
||||||
return "0.1";
|
public string getVersion()
|
||||||
}
|
{
|
||||||
|
return "0.1";
|
||||||
/// <summary>
|
}
|
||||||
/// Returns all the specified region profiles within coordates -- coordinates are inclusive
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="xmin">Minimum X coordinate</param>
|
/// Returns all the specified region profiles within coordates -- coordinates are inclusive
|
||||||
/// <param name="ymin">Minimum Y coordinate</param>
|
/// </summary>
|
||||||
/// <param name="xmax">Maximum X coordinate</param>
|
/// <param name="xmin">Minimum X coordinate</param>
|
||||||
/// <param name="ymax">Maximum Y coordinate</param>
|
/// <param name="ymin">Minimum Y coordinate</param>
|
||||||
/// <returns></returns>
|
/// <param name="xmax">Maximum X coordinate</param>
|
||||||
public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
|
/// <param name="ymax">Maximum Y coordinate</param>
|
||||||
{
|
/// <returns></returns>
|
||||||
try
|
public RegionProfileData[] GetProfilesInRange(uint xmin, uint ymin, uint xmax, uint ymax)
|
||||||
{
|
{
|
||||||
lock (database)
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
lock (database)
|
||||||
param["?xmin"] = xmin.ToString();
|
{
|
||||||
param["?ymin"] = ymin.ToString();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
param["?xmax"] = xmax.ToString();
|
param["?xmin"] = xmin.ToString();
|
||||||
param["?ymax"] = ymax.ToString();
|
param["?ymin"] = ymin.ToString();
|
||||||
|
param["?xmax"] = xmax.ToString();
|
||||||
IDbCommand result =
|
param["?ymax"] = ymax.ToString();
|
||||||
database.Query(
|
|
||||||
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
|
IDbCommand result =
|
||||||
param);
|
database.Query(
|
||||||
IDataReader reader = result.ExecuteReader();
|
"SELECT * FROM regions WHERE locX >= ?xmin AND locX <= ?xmax AND locY >= ?ymin AND locY <= ?ymax",
|
||||||
|
param);
|
||||||
RegionProfileData row;
|
IDataReader reader = result.ExecuteReader();
|
||||||
|
|
||||||
List<RegionProfileData> rows = new List<RegionProfileData>();
|
RegionProfileData row;
|
||||||
|
|
||||||
while ((row = database.readSimRow(reader)) != null)
|
List<RegionProfileData> rows = new List<RegionProfileData>();
|
||||||
{
|
|
||||||
rows.Add(row);
|
while ((row = database.readSimRow(reader)) != null)
|
||||||
}
|
{
|
||||||
reader.Close();
|
rows.Add(row);
|
||||||
result.Dispose();
|
}
|
||||||
|
reader.Close();
|
||||||
return rows.ToArray();
|
result.Dispose();
|
||||||
}
|
|
||||||
}
|
return rows.ToArray();
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
}
|
||||||
database.Reconnect();
|
catch (Exception e)
|
||||||
MainLog.Instance.Error(e.ToString());
|
{
|
||||||
return null;
|
database.Reconnect();
|
||||||
}
|
m_log.Error(e.ToString());
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Returns a sim profile from it's location
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="handle">Region location handle</param>
|
/// Returns a sim profile from it's location
|
||||||
/// <returns>Sim profile</returns>
|
/// </summary>
|
||||||
public RegionProfileData GetProfileByHandle(ulong handle)
|
/// <param name="handle">Region location handle</param>
|
||||||
{
|
/// <returns>Sim profile</returns>
|
||||||
try
|
public RegionProfileData GetProfileByHandle(ulong handle)
|
||||||
{
|
{
|
||||||
lock (database)
|
try
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
lock (database)
|
||||||
param["?handle"] = handle.ToString();
|
{
|
||||||
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
param["?handle"] = handle.ToString();
|
||||||
IDataReader reader = result.ExecuteReader();
|
|
||||||
|
IDbCommand result = database.Query("SELECT * FROM regions WHERE regionHandle = ?handle", param);
|
||||||
RegionProfileData row = database.readSimRow(reader);
|
IDataReader reader = result.ExecuteReader();
|
||||||
reader.Close();
|
|
||||||
result.Dispose();
|
RegionProfileData row = database.readSimRow(reader);
|
||||||
|
reader.Close();
|
||||||
return row;
|
result.Dispose();
|
||||||
}
|
|
||||||
}
|
return row;
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
}
|
||||||
database.Reconnect();
|
catch (Exception e)
|
||||||
MainLog.Instance.Error(e.ToString());
|
{
|
||||||
return null;
|
database.Reconnect();
|
||||||
}
|
m_log.Error(e.ToString());
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// // Returns a list of avatar and UUIDs that match the query
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query)
|
/// Returns a sim profile from it's UUID
|
||||||
{
|
/// </summary>
|
||||||
List<AvatarPickerAvatar> returnlist = new List<AvatarPickerAvatar>();
|
/// <param name="uuid">The region UUID</param>
|
||||||
|
/// <returns>The sim profile</returns>
|
||||||
Regex objAlphaNumericPattern = new Regex("[^a-zA-Z0-9]");
|
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
||||||
|
{
|
||||||
string[] querysplit;
|
try
|
||||||
querysplit = query.Split(' ');
|
{
|
||||||
if (querysplit.Length == 2)
|
lock (database)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
|
param["?uuid"] = uuid.ToString();
|
||||||
param["?second"] = objAlphaNumericPattern.Replace(querysplit[1], "") + "%";
|
|
||||||
try
|
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
||||||
{
|
IDataReader reader = result.ExecuteReader();
|
||||||
lock (database)
|
|
||||||
{
|
RegionProfileData row = database.readSimRow(reader);
|
||||||
IDbCommand result =
|
reader.Close();
|
||||||
database.Query(
|
result.Dispose();
|
||||||
"SELECT UUID,username,surname FROM users WHERE username like ?first AND lastname like ?second LIMIT 100",
|
|
||||||
param);
|
return row;
|
||||||
IDataReader reader = result.ExecuteReader();
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
while (reader.Read())
|
{
|
||||||
{
|
database.Reconnect();
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
m_log.Error(e.ToString());
|
||||||
user.AvatarID = new LLUUID((string) reader["UUID"]);
|
return null;
|
||||||
user.firstName = (string) reader["username"];
|
}
|
||||||
user.lastName = (string) reader["surname"];
|
}
|
||||||
returnlist.Add(user);
|
|
||||||
}
|
/// <summary>
|
||||||
reader.Close();
|
/// Adds a new profile to the database
|
||||||
result.Dispose();
|
/// </summary>
|
||||||
}
|
/// <param name="profile">The profile to add</param>
|
||||||
}
|
/// <returns>Successful?</returns>
|
||||||
catch (Exception e)
|
public DataResponse AddProfile(RegionProfileData profile)
|
||||||
{
|
{
|
||||||
database.Reconnect();
|
lock (database)
|
||||||
MainLog.Instance.Error(e.ToString());
|
{
|
||||||
return returnlist;
|
if (database.insertRegion(profile))
|
||||||
}
|
{
|
||||||
}
|
return DataResponse.RESPONSE_OK;
|
||||||
else if (querysplit.Length == 1)
|
}
|
||||||
{
|
else
|
||||||
try
|
{
|
||||||
{
|
return DataResponse.RESPONSE_ERROR;
|
||||||
lock (database)
|
}
|
||||||
{
|
}
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
}
|
||||||
param["?first"] = objAlphaNumericPattern.Replace(querysplit[0], "") + "%";
|
|
||||||
|
/// <summary>
|
||||||
IDbCommand result =
|
/// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
|
||||||
database.Query(
|
/// </summary>
|
||||||
"SELECT UUID,username,surname FROM users WHERE username like ?first OR lastname like ?second",
|
/// <param name="uuid">The UUID of the challenger</param>
|
||||||
param);
|
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
||||||
IDataReader reader = result.ExecuteReader();
|
/// <param name="authkey">The secret</param>
|
||||||
|
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
||||||
|
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
|
||||||
while (reader.Read())
|
{
|
||||||
{
|
bool throwHissyFit = false; // Should be true by 1.0
|
||||||
AvatarPickerAvatar user = new AvatarPickerAvatar();
|
|
||||||
user.AvatarID = new LLUUID((string) reader["UUID"]);
|
if (throwHissyFit)
|
||||||
user.firstName = (string) reader["username"];
|
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
|
||||||
user.lastName = (string) reader["surname"];
|
|
||||||
returnlist.Add(user);
|
RegionProfileData data = GetProfileByLLUUID(uuid);
|
||||||
}
|
|
||||||
reader.Close();
|
return (handle == data.regionHandle && authkey == data.regionSecret);
|
||||||
result.Dispose();
|
}
|
||||||
}
|
|
||||||
}
|
/// <summary>
|
||||||
catch (Exception e)
|
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
|
||||||
{
|
/// </summary>
|
||||||
database.Reconnect();
|
/// <remarks>This requires a security audit.</remarks>
|
||||||
MainLog.Instance.Error(e.ToString());
|
/// <param name="uuid"></param>
|
||||||
return returnlist;
|
/// <param name="handle"></param>
|
||||||
}
|
/// <param name="authhash"></param>
|
||||||
}
|
/// <param name="challenge"></param>
|
||||||
return returnlist;
|
/// <returns></returns>
|
||||||
}
|
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
|
||||||
|
{
|
||||||
/// <summary>
|
SHA512Managed HashProvider = new SHA512Managed();
|
||||||
/// Returns a sim profile from it's UUID
|
ASCIIEncoding TextProvider = new ASCIIEncoding();
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuid">The region UUID</param>
|
byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
|
||||||
/// <returns>The sim profile</returns>
|
byte[] hash = HashProvider.ComputeHash(stream);
|
||||||
public RegionProfileData GetProfileByLLUUID(LLUUID uuid)
|
|
||||||
{
|
return false;
|
||||||
try
|
}
|
||||||
{
|
|
||||||
lock (database)
|
public ReservationData GetReservationAtPoint(uint x, uint y)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
try
|
||||||
param["?uuid"] = uuid.ToString();
|
{
|
||||||
|
lock (database)
|
||||||
IDbCommand result = database.Query("SELECT * FROM regions WHERE uuid = ?uuid", param);
|
{
|
||||||
IDataReader reader = result.ExecuteReader();
|
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||||
|
param["?x"] = x.ToString();
|
||||||
RegionProfileData row = database.readSimRow(reader);
|
param["?y"] = y.ToString();
|
||||||
reader.Close();
|
IDbCommand result =
|
||||||
result.Dispose();
|
database.Query(
|
||||||
|
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
||||||
return row;
|
param);
|
||||||
}
|
IDataReader reader = result.ExecuteReader();
|
||||||
}
|
|
||||||
catch (Exception e)
|
ReservationData row = database.readReservationRow(reader);
|
||||||
{
|
reader.Close();
|
||||||
database.Reconnect();
|
result.Dispose();
|
||||||
MainLog.Instance.Error(e.ToString());
|
|
||||||
return null;
|
return row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
/// <summary>
|
{
|
||||||
/// Adds a new profile to the database
|
database.Reconnect();
|
||||||
/// </summary>
|
m_log.Error(e.ToString());
|
||||||
/// <param name="profile">The profile to add</param>
|
return null;
|
||||||
/// <returns>Successful?</returns>
|
}
|
||||||
public DataResponse AddProfile(RegionProfileData profile)
|
}
|
||||||
{
|
}
|
||||||
lock (database)
|
}
|
||||||
{
|
|
||||||
if (database.insertRegion(profile))
|
|
||||||
{
|
|
||||||
return DataResponse.RESPONSE_OK;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return DataResponse.RESPONSE_ERROR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="uuid">The UUID of the challenger</param>
|
|
||||||
/// <param name="handle">The attempted regionHandle of the challenger</param>
|
|
||||||
/// <param name="authkey">The secret</param>
|
|
||||||
/// <returns>Whether the secret and regionhandle match the database entry for UUID</returns>
|
|
||||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authkey)
|
|
||||||
{
|
|
||||||
bool throwHissyFit = false; // Should be true by 1.0
|
|
||||||
|
|
||||||
if (throwHissyFit)
|
|
||||||
throw new Exception("CRYPTOWEAK AUTHENTICATE: Refusing to authenticate due to replay potential.");
|
|
||||||
|
|
||||||
RegionProfileData data = GetProfileByLLUUID(uuid);
|
|
||||||
|
|
||||||
return (handle == data.regionHandle && authkey == data.regionSecret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// NOT YET FUNCTIONAL. Provides a cryptographic authentication of a region
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>This requires a security audit.</remarks>
|
|
||||||
/// <param name="uuid"></param>
|
|
||||||
/// <param name="handle"></param>
|
|
||||||
/// <param name="authhash"></param>
|
|
||||||
/// <param name="challenge"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool AuthenticateSim(LLUUID uuid, ulong handle, string authhash, string challenge)
|
|
||||||
{
|
|
||||||
SHA512Managed HashProvider = new SHA512Managed();
|
|
||||||
ASCIIEncoding TextProvider = new ASCIIEncoding();
|
|
||||||
|
|
||||||
byte[] stream = TextProvider.GetBytes(uuid.ToString() + ":" + handle.ToString() + ":" + challenge);
|
|
||||||
byte[] hash = HashProvider.ComputeHash(stream);
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReservationData GetReservationAtPoint(uint x, uint y)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lock (database)
|
|
||||||
{
|
|
||||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
|
||||||
param["?x"] = x.ToString();
|
|
||||||
param["?y"] = y.ToString();
|
|
||||||
IDbCommand result =
|
|
||||||
database.Query(
|
|
||||||
"SELECT * FROM reservations WHERE resXMin <= ?x AND resXMax >= ?x AND resYMin <= ?y AND resYMax >= ?y",
|
|
||||||
param);
|
|
||||||
IDataReader reader = result.ExecuteReader();
|
|
||||||
|
|
||||||
ReservationData row = database.readReservationRow(reader);
|
|
||||||
reader.Close();
|
|
||||||
result.Dispose();
|
|
||||||
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
database.Reconnect();
|
|
||||||
MainLog.Instance.Error(e.ToString());
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Framework.Data.MySQL")]
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Framework.Data.MySQL")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("e49826b2-dcef-41be-a5bd-596733fa3304")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
--
|
||||||
|
-- Create schema avatar_appearance
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE DATABASE IF NOT EXISTS avatar_appearance;
|
||||||
|
USE avatar_appearance;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `avatarappearance`;
|
||||||
|
CREATE TABLE `avatarappearance` (
|
||||||
|
`UUID` char(36) NOT NULL,
|
||||||
|
`Serial` int(10) unsigned NOT NULL,
|
||||||
|
`WearableItem0` char(36) NOT NULL,
|
||||||
|
`WearableAsset0` char(36) NOT NULL,
|
||||||
|
`WearableItem1` char(36) NOT NULL,
|
||||||
|
`WearableAsset1` char(36) NOT NULL,
|
||||||
|
`WearableItem2` char(36) NOT NULL,
|
||||||
|
`WearableAsset2` char(36) NOT NULL,
|
||||||
|
`WearableItem3` char(36) NOT NULL,
|
||||||
|
`WearableAsset3` char(36) NOT NULL,
|
||||||
|
`WearableItem4` char(36) NOT NULL,
|
||||||
|
`WearableAsset4` char(36) NOT NULL,
|
||||||
|
`WearableItem5` char(36) NOT NULL,
|
||||||
|
`WearableAsset5` char(36) NOT NULL,
|
||||||
|
`WearableItem6` char(36) NOT NULL,
|
||||||
|
`WearableAsset6` char(36) NOT NULL,
|
||||||
|
`WearableItem7` char(36) NOT NULL,
|
||||||
|
`WearableAsset7` char(36) NOT NULL,
|
||||||
|
`WearableItem8` char(36) NOT NULL,
|
||||||
|
`WearableAsset8` char(36) NOT NULL,
|
||||||
|
`WearableItem9` char(36) NOT NULL,
|
||||||
|
`WearableAsset9` char(36) NOT NULL,
|
||||||
|
`WearableItem10` char(36) NOT NULL,
|
||||||
|
`WearableAsset10` char(36) NOT NULL,
|
||||||
|
`WearableItem11` char(36) NOT NULL,
|
||||||
|
`WearableAsset11` char(36) NOT NULL,
|
||||||
|
`WearableItem12` char(36) NOT NULL,
|
||||||
|
`WearableAsset12` char(36) NOT NULL,
|
||||||
|
|
||||||
|
|
||||||
|
PRIMARY KEY (`UUID`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
SET FOREIGN_KEY_CHECKS=0;
|
SET FOREIGN_KEY_CHECKS=0;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for users
|
-- Table structure for users
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
CREATE TABLE `userfriends` (
|
CREATE TABLE `userfriends` (
|
||||||
`ownerID` VARCHAR(37) NOT NULL,
|
`ownerID` VARCHAR(37) NOT NULL,
|
||||||
`friendID` VARCHAR(47) NOT NULL,
|
`friendID` VARCHAR(37) NOT NULL,
|
||||||
`friendPerms` INT NOT NULL,
|
`friendPerms` INT NOT NULL,
|
||||||
`datetimestamp` INT NOT NULL,
|
`datetimestamp` INT NOT NULL,
|
||||||
UNIQUE KEY (`ownerID`, `friendID`)
|
UNIQUE KEY (`ownerID`, `friendID`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.1';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Rev.1';
|
||||||
|
|
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Framework.Data.SQLite")]
|
||||||
[assembly : AssemblyVersion("0.4.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Framework.Data.SQLite")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("6113d5ce-4547-49f4-9236-0dcc503457b1")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE assets(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
Name varchar(255),
|
||||||
|
Description varchar(255),
|
||||||
|
Type integer,
|
||||||
|
InvType integer,
|
||||||
|
Local integer,
|
||||||
|
Temporary integer,
|
||||||
|
Data blob);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,26 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE inventoryitems(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
assetID varchar(255),
|
||||||
|
assetType integer,
|
||||||
|
invType integer,
|
||||||
|
parentFolderID varchar(255),
|
||||||
|
avatarID varchar(255),
|
||||||
|
creatorsID varchar(255),
|
||||||
|
inventoryName varchar(255),
|
||||||
|
inventoryDescription varchar(255),
|
||||||
|
inventoryNextPermissions integer,
|
||||||
|
inventoryCurrentPermissions integer,
|
||||||
|
inventoryBasePermissions integer,
|
||||||
|
inventoryEveryOnePermissions integer);
|
||||||
|
|
||||||
|
CREATE TABLE inventoryfolders(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
name varchar(255),
|
||||||
|
agentID varchar(255),
|
||||||
|
parentID varchar(255),
|
||||||
|
type integer,
|
||||||
|
version integer);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,121 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE prims(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
RegionUUID varchar(255),
|
||||||
|
ParentID integer,
|
||||||
|
CreationDate integer,
|
||||||
|
Name varchar(255),
|
||||||
|
SceneGroupID varchar(255),
|
||||||
|
Text varchar(255),
|
||||||
|
Description varchar(255),
|
||||||
|
SitName varchar(255),
|
||||||
|
TouchName varchar(255),
|
||||||
|
CreatorID varchar(255),
|
||||||
|
OwnerID varchar(255),
|
||||||
|
GroupID varchar(255),
|
||||||
|
LastOwnerID varchar(255),
|
||||||
|
OwnerMask integer,
|
||||||
|
NextOwnerMask integer,
|
||||||
|
GroupMask integer,
|
||||||
|
EveryoneMask integer,
|
||||||
|
BaseMask integer,
|
||||||
|
PositionX float,
|
||||||
|
PositionY float,
|
||||||
|
PositionZ float,
|
||||||
|
GroupPositionX float,
|
||||||
|
GroupPositionY float,
|
||||||
|
GroupPositionZ float,
|
||||||
|
VelocityX float,
|
||||||
|
VelocityY float,
|
||||||
|
VelocityZ float,
|
||||||
|
AngularVelocityX float,
|
||||||
|
AngularVelocityY float,
|
||||||
|
AngularVelocityZ float,
|
||||||
|
AccelerationX float,
|
||||||
|
AccelerationY float,
|
||||||
|
AccelerationZ float,
|
||||||
|
RotationX float,
|
||||||
|
RotationY float,
|
||||||
|
RotationZ float,
|
||||||
|
RotationW float,
|
||||||
|
ObjectFlags integer,
|
||||||
|
SitTargetOffsetX float NOT NULL default 0,
|
||||||
|
SitTargetOffsetY float NOT NULL default 0,
|
||||||
|
SitTargetOffsetZ float NOT NULL default 0,
|
||||||
|
SitTargetOrientW float NOT NULL default 0,
|
||||||
|
SitTargetOrientX float NOT NULL default 0,
|
||||||
|
SitTargetOrientY float NOT NULL default 0,
|
||||||
|
SitTargetOrientZ float NOT NULL default 0);
|
||||||
|
|
||||||
|
CREATE TABLE primshapes(UUID varchar(255) primary key,
|
||||||
|
Shape integer,
|
||||||
|
ScaleX float,
|
||||||
|
ScaleY float,
|
||||||
|
ScaleZ float,
|
||||||
|
PCode integer,
|
||||||
|
PathBegin integer,
|
||||||
|
PathEnd integer,
|
||||||
|
PathScaleX integer,
|
||||||
|
PathScaleY integer,
|
||||||
|
PathShearX integer,
|
||||||
|
PathShearY integer,
|
||||||
|
PathSkew integer,
|
||||||
|
PathCurve integer,
|
||||||
|
PathRadiusOffset integer,
|
||||||
|
PathRevolutions integer,
|
||||||
|
PathTaperX integer,
|
||||||
|
PathTaperY integer,
|
||||||
|
PathTwist integer,
|
||||||
|
PathTwistBegin integer,
|
||||||
|
ProfileBegin integer,
|
||||||
|
ProfileEnd integer,
|
||||||
|
ProfileCurve integer,
|
||||||
|
ProfileHollow integer,
|
||||||
|
Texture blob,
|
||||||
|
ExtraParams blob);
|
||||||
|
|
||||||
|
CREATE TABLE terrain(
|
||||||
|
RegionUUID varchar(255),
|
||||||
|
Revision integer,
|
||||||
|
Heightfield blob);
|
||||||
|
|
||||||
|
CREATE TABLE land(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
RegionUUID varchar(255),
|
||||||
|
LocalLandID string,
|
||||||
|
Bitmap blob,
|
||||||
|
Name varchar(255),
|
||||||
|
Desc varchar(255),
|
||||||
|
OwnerUUID varchar(36),
|
||||||
|
IsGroupOwned string,
|
||||||
|
Area integer,
|
||||||
|
AuctionID integer,
|
||||||
|
Category integer,
|
||||||
|
ClaimDate integer,
|
||||||
|
ClaimPrice integer,
|
||||||
|
GroupUUID varchar(255),
|
||||||
|
SalePrice integer,
|
||||||
|
LandStatus integer,
|
||||||
|
LandFlags string,
|
||||||
|
LandingType string,
|
||||||
|
MediaAutoScale string,
|
||||||
|
MediaTextureUUID varchar(255),
|
||||||
|
MediaURL varchar(255),
|
||||||
|
MusicURL varchar(255),
|
||||||
|
PassHours float,
|
||||||
|
PassPrice string,
|
||||||
|
SnapshotUUID varchar(255),
|
||||||
|
UserLocationX float,
|
||||||
|
UserLocationY float,
|
||||||
|
UserLocationZ float,
|
||||||
|
UserLookAtX float,
|
||||||
|
UserLookAtY float,
|
||||||
|
UserLookAtZ float);
|
||||||
|
|
||||||
|
CREATE TABLE landaccesslist(
|
||||||
|
LandUUID varchar(255),
|
||||||
|
AccessUUID varchar(255),
|
||||||
|
Flags string);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,37 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
CREATE TABLE users(
|
||||||
|
UUID varchar(255) primary key,
|
||||||
|
username varchar(255),
|
||||||
|
surname varchar(255),
|
||||||
|
passwordHash varchar(255),
|
||||||
|
passwordSalt varchar(255),
|
||||||
|
homeRegionX integer,
|
||||||
|
homeRegionY integer,
|
||||||
|
homeLocationX float,
|
||||||
|
homeLocationY float,
|
||||||
|
homeLocationZ float,
|
||||||
|
homeLookAtX float,
|
||||||
|
homeLookAtY float,
|
||||||
|
homeLookAtZ float,
|
||||||
|
created integer,
|
||||||
|
lastLogin integer,
|
||||||
|
rootInventoryFolderID varchar(255),
|
||||||
|
userInventoryURI varchar(255),
|
||||||
|
userAssetURI varchar(255),
|
||||||
|
profileCanDoMask integer,
|
||||||
|
profileWantDoMask integer,
|
||||||
|
profileAboutText varchar(255),
|
||||||
|
profileFirstText varchar(255),
|
||||||
|
profileImage varchar(255),
|
||||||
|
profileFirstImage varchar(255),
|
||||||
|
webLoginKey text default '00000000-0000-0000-0000-000000000000');
|
||||||
|
|
||||||
|
CREATE TABLE userfriends(
|
||||||
|
ownerID varchar(255),
|
||||||
|
friendID varchar(255),
|
||||||
|
friendPerms integer,
|
||||||
|
ownerPerms integer,
|
||||||
|
datetimestamp integer);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -1,379 +1,391 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
using System.Collections.Generic; // rex added
|
using System.Collections.Generic; // rex added
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.SQLite
|
namespace OpenSim.Framework.Data.SQLite
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A User storage interface for the DB4o database system
|
/// A User storage interface for the DB4o database system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SQLiteAssetData : SQLiteBase, IAssetProvider
|
public class SQLiteAssetData : SQLiteBase, IAssetProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
/// The database manager
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <summary>
|
/// The database manager
|
||||||
/// Artificial constructor called upon plugin load
|
/// </summary>
|
||||||
/// </summary>
|
/// <summary>
|
||||||
private const string assetSelect = "select * from assets";
|
/// Artificial constructor called upon plugin load
|
||||||
|
/// </summary>
|
||||||
private DataSet ds;
|
private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
|
||||||
private SqliteDataAdapter da;
|
private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
|
||||||
|
private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, InvType, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :InvType, :Local, :Temporary, :Data)";
|
||||||
public void Initialise(string dbfile, string dbname)
|
private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, InvType=:InvType, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
|
||||||
{
|
private const string assetSelect = "select * from assets";
|
||||||
SqliteConnection conn = new SqliteConnection("URI=file:" + dbfile + ",version=3");
|
|
||||||
TestTables(conn);
|
private SqliteConnection m_conn;
|
||||||
|
|
||||||
ds = new DataSet();
|
public void Initialise(string dbfile, string dbname)
|
||||||
da = new SqliteDataAdapter(new SqliteCommand(assetSelect, conn));
|
{
|
||||||
|
m_conn = new SqliteConnection("URI=file:" + dbfile + ",version=3");
|
||||||
lock (ds)
|
m_conn.Open();
|
||||||
{
|
TestTables(m_conn);
|
||||||
ds.Tables.Add(createAssetsTable());
|
return;
|
||||||
|
}
|
||||||
setupAssetCommands(da, conn);
|
|
||||||
try
|
public AssetBase FetchAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
da.Fill(ds.Tables["assets"]);
|
|
||||||
}
|
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||||
catch (Exception e)
|
{
|
||||||
{
|
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
|
||||||
MainLog.Instance.Verbose("SQLITE", e.ToString());
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
}
|
{
|
||||||
}
|
if (reader.Read())
|
||||||
|
{
|
||||||
return;
|
AssetBase asset = buildAsset(reader);
|
||||||
}
|
reader.Close();
|
||||||
|
return asset;
|
||||||
public AssetBase FetchAsset(LLUUID uuid)
|
}
|
||||||
{
|
else
|
||||||
AssetBase asset = new AssetBase();
|
{
|
||||||
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
|
reader.Close();
|
||||||
if (row != null)
|
return null;
|
||||||
{
|
}
|
||||||
return buildAsset(row);
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
return null;
|
public void CreateAsset(AssetBase asset)
|
||||||
}
|
{
|
||||||
}
|
m_log.Info("[SQLITE]: Creating Asset " + Util.ToRawUuidString(asset.FullID));
|
||||||
|
if (ExistsAsset(asset.FullID))
|
||||||
public void CreateAsset(AssetBase asset)
|
{
|
||||||
{
|
m_log.Info("[SQLITE]: Asset exists, updating instead. You should fix the caller for this!");
|
||||||
// no difference for now
|
UpdateAsset(asset);
|
||||||
UpdateAsset(asset);
|
}
|
||||||
}
|
else
|
||||||
|
{
|
||||||
public void UpdateAsset(AssetBase asset)
|
using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn))
|
||||||
{
|
{
|
||||||
LogAssetLoad(asset);
|
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
||||||
DataTable assets = ds.Tables["assets"];
|
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
||||||
lock (ds)
|
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||||
{
|
cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType));
|
||||||
DataRow row = assets.Rows.Find(Util.ToRawUuidString(asset.FullID));
|
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||||
if (row == null)
|
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||||
{
|
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||||
row = assets.NewRow();
|
|
||||||
fillAssetRow(row, asset);
|
cmd.ExecuteNonQuery();
|
||||||
assets.Rows.Add(row);
|
}
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
{
|
|
||||||
fillAssetRow(row, asset);
|
public void UpdateAsset(AssetBase asset)
|
||||||
}
|
{
|
||||||
}
|
LogAssetLoad(asset);
|
||||||
}
|
|
||||||
|
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
|
||||||
// rex new function for "replace assets" functionality
|
{
|
||||||
public LLUUID ExistsAsset(sbyte type, string name)
|
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(asset.FullID)));
|
||||||
{
|
cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name));
|
||||||
LLUUID retVal = LLUUID.Zero;
|
cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description));
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type));
|
||||||
lock (ds)
|
cmd.Parameters.Add(new SqliteParameter(":InvType", asset.InvType));
|
||||||
{
|
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
|
||||||
string selectExp = "Type = '" + type.ToString() + "' AND Name = '" + name + "'";
|
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
|
||||||
DataRow[] match = ds.Tables["assets"].Select(selectExp);
|
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
|
||||||
if (match.Length > 0)
|
|
||||||
{
|
cmd.ExecuteNonQuery();
|
||||||
retVal = new LLUUID((String)match[0]["UUID"]);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
// rex new function for "replace assets" functionality
|
||||||
}
|
public LLUUID ExistsAsset(sbyte type, string name)
|
||||||
|
{
|
||||||
private void LogAssetLoad(AssetBase asset)
|
LLUUID retVal = LLUUID.Zero;
|
||||||
{
|
|
||||||
string temporary = asset.Temporary ? "Temporary" : "Stored";
|
lock (ds)
|
||||||
string local = asset.Local ? "Local" : "Remote";
|
{
|
||||||
|
string selectExp = "Type = '" + type.ToString() + "' AND Name = '" + name + "'";
|
||||||
MainLog.Instance.Verbose("SQLITE",
|
DataRow[] match = ds.Tables["assets"].Select(selectExp);
|
||||||
string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)",
|
if (match.Length > 0)
|
||||||
asset.FullID, asset.Name, asset.Description, asset.Type,
|
{
|
||||||
asset.InvType, temporary, local, asset.Data.Length));
|
retVal = new LLUUID((String)match[0]["UUID"]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public bool ExistsAsset(LLUUID uuid)
|
|
||||||
{
|
return retVal;
|
||||||
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
|
}
|
||||||
return (row != null);
|
|
||||||
}
|
private void LogAssetLoad(AssetBase asset)
|
||||||
|
{
|
||||||
// rex, new function
|
string temporary = asset.Temporary ? "Temporary" : "Stored";
|
||||||
public List<AssetBase> GetAssetList(int vAssetType)
|
string local = asset.Local ? "Local" : "Remote";
|
||||||
{
|
|
||||||
List<AssetBase> retvals = new List<AssetBase>();
|
m_log.Info("[SQLITE]: " +
|
||||||
lock (ds)
|
string.Format("Loaded {6} {5} Asset: [{0}][{3}/{4}] \"{1}\":{2} ({7} bytes)",
|
||||||
{
|
asset.FullID, asset.Name, asset.Description, asset.Type,
|
||||||
string selectExp = "InvType = '" + vAssetType.ToString() + "'";
|
asset.InvType, temporary, local, asset.Data.Length));
|
||||||
DataRow[] allAssets = ds.Tables["assets"].Select(selectExp);
|
}
|
||||||
foreach (DataRow row in allAssets)
|
|
||||||
{
|
public bool ExistsAsset(LLUUID uuid)
|
||||||
// Do not use buildAsset(row) because we don't want to return the asset.data - Tuco
|
{
|
||||||
AssetBase asset = new AssetBase();
|
using (SqliteCommand cmd = new SqliteCommand(SelectAssetSQL, m_conn))
|
||||||
asset.FullID = new LLUUID((String)row["UUID"]);
|
{
|
||||||
asset.Name = (String)row["Name"];
|
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
|
||||||
asset.Description = (String)row["Description"];
|
using (IDataReader reader = cmd.ExecuteReader())
|
||||||
asset.Type = Convert.ToSByte(row["Type"]);
|
{
|
||||||
asset.InvType = Convert.ToSByte(row["InvType"]);
|
if(reader.Read())
|
||||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
{
|
||||||
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
reader.Close();
|
||||||
retvals.Add(asset);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
return retvals;
|
{
|
||||||
}
|
reader.Close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
public void DeleteAsset(LLUUID uuid)
|
}
|
||||||
{
|
}
|
||||||
lock (ds)
|
}
|
||||||
{
|
|
||||||
DataRow row = ds.Tables["assets"].Rows.Find(Util.ToRawUuidString(uuid));
|
// rex, new function
|
||||||
if (row != null)
|
public List<AssetBase> GetAssetList(int vAssetType)
|
||||||
{
|
{
|
||||||
row.Delete();
|
List<AssetBase> retvals = new List<AssetBase>();
|
||||||
}
|
lock (ds)
|
||||||
}
|
{
|
||||||
}
|
string selectExp = "InvType = '" + vAssetType.ToString() + "'";
|
||||||
|
DataRow[] allAssets = ds.Tables["assets"].Select(selectExp);
|
||||||
public void CommitAssets() // force a sync to the database
|
foreach (DataRow row in allAssets)
|
||||||
{
|
{
|
||||||
MainLog.Instance.Verbose("SQLITE", "Attempting commit");
|
// Do not use buildAsset(row) because we don't want to return the asset.data - Tuco
|
||||||
lock (ds)
|
AssetBase asset = new AssetBase();
|
||||||
{
|
asset.FullID = new LLUUID((String)row["UUID"]);
|
||||||
da.Update(ds, "assets");
|
asset.Name = (String)row["Name"];
|
||||||
ds.AcceptChanges();
|
asset.Description = (String)row["Description"];
|
||||||
}
|
asset.Type = Convert.ToSByte(row["Type"]);
|
||||||
}
|
asset.InvType = Convert.ToSByte(row["InvType"]);
|
||||||
|
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||||
/***********************************************************************
|
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
||||||
*
|
retvals.Add(asset);
|
||||||
* Database Definition Functions
|
}
|
||||||
*
|
}
|
||||||
* This should be db agnostic as we define them in ADO.NET terms
|
return retvals;
|
||||||
*
|
}
|
||||||
**********************************************************************/
|
|
||||||
|
|
||||||
private DataTable createAssetsTable()
|
public void DeleteAsset(LLUUID uuid)
|
||||||
{
|
{
|
||||||
DataTable assets = new DataTable("assets");
|
using (SqliteCommand cmd = new SqliteCommand(DeleteAssetSQL, m_conn))
|
||||||
|
{
|
||||||
createCol(assets, "UUID", typeof (String));
|
cmd.Parameters.Add(new SqliteParameter(":UUID", Util.ToRawUuidString(uuid)));
|
||||||
createCol(assets, "Name", typeof (String));
|
|
||||||
createCol(assets, "Description", typeof (String));
|
cmd.ExecuteNonQuery();
|
||||||
createCol(assets, "MediaURL", typeof(String));//rex mediaurl
|
}
|
||||||
createCol(assets, "Type", typeof (Int32));
|
}
|
||||||
createCol(assets, "InvType", typeof (Int32));
|
|
||||||
createCol(assets, "Local", typeof (Boolean));
|
public void CommitAssets() // force a sync to the database
|
||||||
createCol(assets, "Temporary", typeof (Boolean));
|
{
|
||||||
createCol(assets, "Data", typeof (Byte[]));
|
m_log.Info("[SQLITE]: Attempting commit");
|
||||||
// Add in contraints
|
// lock (ds)
|
||||||
assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]};
|
// {
|
||||||
return assets;
|
// da.Update(ds, "assets");
|
||||||
}
|
// ds.AcceptChanges();
|
||||||
|
// }
|
||||||
/***********************************************************************
|
}
|
||||||
*
|
|
||||||
* Convert between ADO.NET <=> OpenSim Objects
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* These should be database independant
|
* Database Definition Functions
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
* This should be db agnostic as we define them in ADO.NET terms
|
||||||
|
*
|
||||||
private AssetBase buildAsset(DataRow row)
|
**********************************************************************/
|
||||||
{
|
|
||||||
// TODO: this doesn't work yet because something more
|
private DataTable createAssetsTable()
|
||||||
// interesting has to be done to actually get these values
|
{
|
||||||
// back out. Not enough time to figure it out yet.
|
DataTable assets = new DataTable("assets");
|
||||||
AssetBase asset = new AssetBase();
|
|
||||||
|
createCol(assets, "UUID", typeof (String));
|
||||||
asset.FullID = new LLUUID((String) row["UUID"]);
|
createCol(assets, "Name", typeof (String));
|
||||||
asset.Name = (String) row["Name"];
|
createCol(assets, "Description", typeof (String));
|
||||||
asset.Description = (String) row["Description"];
|
createCol(assets, "MediaURL", typeof(String));//rex mediaurl
|
||||||
try
|
createCol(assets, "Type", typeof (Int32));
|
||||||
{
|
createCol(assets, "InvType", typeof (Int32));
|
||||||
asset.MediaURL = (String) row["MediaURL"];//rex mediaurl
|
createCol(assets, "Local", typeof (Boolean));
|
||||||
}
|
createCol(assets, "Temporary", typeof (Boolean));
|
||||||
catch (Exception)
|
createCol(assets, "Data", typeof (Byte[]));
|
||||||
{
|
// Add in contraints
|
||||||
asset.MediaURL = ""; // fixme, the row returns null which can't be cast to string, happens with old dbs right now. - Tuco
|
assets.PrimaryKey = new DataColumn[] {assets.Columns["UUID"]};
|
||||||
}
|
return assets;
|
||||||
asset.Type = Convert.ToSByte(row["Type"]);
|
}
|
||||||
asset.InvType = Convert.ToSByte(row["InvType"]);
|
|
||||||
asset.Local = Convert.ToBoolean(row["Local"]);
|
/***********************************************************************
|
||||||
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
*
|
||||||
asset.Data = (byte[]) row["Data"];
|
* Convert between ADO.NET <=> OpenSim Objects
|
||||||
return asset;
|
*
|
||||||
}
|
* These should be database independant
|
||||||
|
*
|
||||||
|
**********************************************************************/
|
||||||
private void fillAssetRow(DataRow row, AssetBase asset)
|
|
||||||
{
|
private AssetBase buildAsset(IDataReader row)
|
||||||
row["UUID"] = Util.ToRawUuidString(asset.FullID);
|
{
|
||||||
row["Name"] = asset.Name;
|
// TODO: this doesn't work yet because something more
|
||||||
if (asset.Description != null)
|
// interesting has to be done to actually get these values
|
||||||
{
|
// back out. Not enough time to figure it out yet.
|
||||||
row["Description"] = asset.Description;
|
AssetBase asset = new AssetBase();
|
||||||
}
|
|
||||||
else
|
asset.FullID = new LLUUID((String) row["UUID"]);
|
||||||
{
|
asset.Name = (String) row["Name"];
|
||||||
row["Description"] = " ";
|
asset.Description = (String) row["Description"];
|
||||||
}
|
try
|
||||||
|
{
|
||||||
if (asset.MediaURL != null) //rex mediaurl
|
asset.MediaURL = (String) row["MediaURL"];//rex mediaurl
|
||||||
{
|
}
|
||||||
row["MediaURL"] = asset.MediaURL;
|
catch (Exception)
|
||||||
}
|
{
|
||||||
else
|
asset.MediaURL = ""; // fixme, the row returns null which can't be cast to string, happens with old dbs right now. - Tuco
|
||||||
{
|
}
|
||||||
row["MediaURL"] = " ";
|
asset.Type = Convert.ToSByte(row["Type"]);
|
||||||
}
|
asset.InvType = Convert.ToSByte(row["InvType"]);
|
||||||
row["Type"] = asset.Type;
|
asset.Local = Convert.ToBoolean(row["Local"]);
|
||||||
row["InvType"] = asset.InvType;
|
asset.Temporary = Convert.ToBoolean(row["Temporary"]);
|
||||||
row["Local"] = asset.Local;
|
asset.Data = (byte[]) row["Data"];
|
||||||
row["Temporary"] = asset.Temporary;
|
return asset;
|
||||||
row["Data"] = asset.Data;
|
}
|
||||||
|
|
||||||
// ADO.NET doesn't handle NULL very well
|
|
||||||
foreach (DataColumn col in ds.Tables["assets"].Columns)
|
private void fillAssetRow(DataRow row, AssetBase asset)
|
||||||
{
|
{
|
||||||
if (row[col] == null)
|
row["UUID"] = Util.ToRawUuidString(asset.FullID);
|
||||||
{
|
row["Name"] = asset.Name;
|
||||||
row[col] = "";
|
if (asset.Description != null)
|
||||||
}
|
{
|
||||||
}
|
row["Description"] = asset.Description;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/***********************************************************************
|
{
|
||||||
*
|
row["Description"] = " ";
|
||||||
* Database Binding functions
|
}
|
||||||
*
|
|
||||||
* These will be db specific due to typing, and minor differences
|
if (asset.MediaURL != null) //rex mediaurl
|
||||||
* in databases.
|
{
|
||||||
*
|
row["MediaURL"] = asset.MediaURL;
|
||||||
**********************************************************************/
|
}
|
||||||
|
else
|
||||||
private void setupAssetCommands(SqliteDataAdapter da, SqliteConnection conn)
|
{
|
||||||
{
|
row["MediaURL"] = " ";
|
||||||
da.InsertCommand = createInsertCommand("assets", ds.Tables["assets"]);
|
}
|
||||||
da.InsertCommand.Connection = conn;
|
row["Type"] = asset.Type;
|
||||||
|
row["InvType"] = asset.InvType;
|
||||||
da.UpdateCommand = createUpdateCommand("assets", "UUID=:UUID", ds.Tables["assets"]);
|
row["Local"] = asset.Local;
|
||||||
da.UpdateCommand.Connection = conn;
|
row["Temporary"] = asset.Temporary;
|
||||||
|
row["Data"] = asset.Data;
|
||||||
SqliteCommand delete = new SqliteCommand("delete from assets where UUID = :UUID");
|
|
||||||
delete.Parameters.Add(createSqliteParameter("UUID", typeof (String)));
|
// ADO.NET doesn't handle NULL very well
|
||||||
delete.Connection = conn;
|
foreach (DataColumn col in ds.Tables["assets"].Columns)
|
||||||
da.DeleteCommand = delete;
|
{
|
||||||
}
|
if (row[col] == null)
|
||||||
|
{
|
||||||
private void InitDB(SqliteConnection conn)
|
row[col] = "";
|
||||||
{
|
}
|
||||||
string createAssets = defineTable(createAssetsTable());
|
}
|
||||||
SqliteCommand pcmd = new SqliteCommand(createAssets, conn);
|
}
|
||||||
conn.Open();
|
|
||||||
pcmd.ExecuteNonQuery();
|
/***********************************************************************
|
||||||
conn.Close();
|
*
|
||||||
}
|
* Database Binding functions
|
||||||
|
*
|
||||||
private bool TestTables(SqliteConnection conn)
|
* These will be db specific due to typing, and minor differences
|
||||||
{
|
* in databases.
|
||||||
SqliteCommand cmd = new SqliteCommand(assetSelect, conn);
|
*
|
||||||
SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
|
**********************************************************************/
|
||||||
DataSet tmpDS = new DataSet();
|
|
||||||
try
|
private void InitDB(SqliteConnection conn)
|
||||||
{
|
{
|
||||||
pDa.Fill(tmpDS, "assets");
|
string createAssets = defineTable(createAssetsTable());
|
||||||
}
|
SqliteCommand pcmd = new SqliteCommand(createAssets, conn);
|
||||||
catch (SqliteSyntaxException)
|
pcmd.ExecuteNonQuery();
|
||||||
{
|
}
|
||||||
MainLog.Instance.Verbose("SQLITE", "SQLite Database doesn't exist... creating");
|
|
||||||
InitDB(conn);
|
private bool TestTables(SqliteConnection conn)
|
||||||
}
|
{
|
||||||
return true;
|
SqliteCommand cmd = new SqliteCommand(assetSelect, conn);
|
||||||
}
|
SqliteDataAdapter pDa = new SqliteDataAdapter(cmd);
|
||||||
|
DataSet tmpDS = new DataSet();
|
||||||
#region IPlugin interface
|
try
|
||||||
|
{
|
||||||
public string Version
|
pDa.Fill(tmpDS, "assets");
|
||||||
{
|
}
|
||||||
get
|
catch (SqliteSyntaxException)
|
||||||
{
|
{
|
||||||
Module module = GetType().Module;
|
m_log.Info("[SQLITE]: SQLite Database doesn't exist... creating");
|
||||||
string dllName = module.Assembly.ManifestModule.Name;
|
InitDB(conn);
|
||||||
Version dllVersion = module.Assembly.GetName().Version;
|
}
|
||||||
|
return true;
|
||||||
return
|
}
|
||||||
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
|
||||||
dllVersion.Revision);
|
#region IPlugin interface
|
||||||
}
|
|
||||||
}
|
public string Version
|
||||||
|
{
|
||||||
public void Initialise()
|
get
|
||||||
{
|
{
|
||||||
Initialise("AssetStorage.db", "");
|
Module module = GetType().Module;
|
||||||
}
|
string dllName = module.Assembly.ManifestModule.Name;
|
||||||
|
Version dllVersion = module.Assembly.GetName().Version;
|
||||||
public string Name
|
|
||||||
{
|
return
|
||||||
get { return "SQLite Asset storage engine"; }
|
string.Format("{0}.{1}.{2}.{3}", dllVersion.Major, dllVersion.Minor, dllVersion.Build,
|
||||||
}
|
dllVersion.Revision);
|
||||||
|
}
|
||||||
#endregion
|
}
|
||||||
}
|
|
||||||
}
|
public void Initialise()
|
||||||
|
{
|
||||||
|
Initialise("AssetStorage.db", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return "SQLite Asset storage engine"; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,269 +1,269 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.SqliteClient;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.SQLite
|
namespace OpenSim.Framework.Data.SQLite
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A base class for methods needed by all SQLite database classes
|
/// A base class for methods needed by all SQLite database classes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SQLiteBase
|
public class SQLiteBase
|
||||||
{
|
{
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Database Definition Functions
|
* Database Definition Functions
|
||||||
*
|
*
|
||||||
* This should be db agnostic as we define them in ADO.NET terms
|
* This should be db agnostic as we define them in ADO.NET terms
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
protected static void createCol(DataTable dt, string name, Type type)
|
protected static void createCol(DataTable dt, string name, Type type)
|
||||||
{
|
{
|
||||||
DataColumn col = new DataColumn(name, type);
|
DataColumn col = new DataColumn(name, type);
|
||||||
dt.Columns.Add(col);
|
dt.Columns.Add(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* SQL Statement Creation Functions
|
* SQL Statement Creation Functions
|
||||||
*
|
*
|
||||||
* These functions create SQL statements for update, insert, and create.
|
* These functions create SQL statements for update, insert, and create.
|
||||||
* They can probably be factored later to have a db independant
|
* They can probably be factored later to have a db independant
|
||||||
* portion and a db specific portion
|
* portion and a db specific portion
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
protected static SqliteCommand createInsertCommand(string table, DataTable dt)
|
protected static SqliteCommand createInsertCommand(string table, DataTable dt)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This is subtle enough to deserve some commentary.
|
* This is subtle enough to deserve some commentary.
|
||||||
* Instead of doing *lots* and *lots of hardcoded strings
|
* Instead of doing *lots* and *lots of hardcoded strings
|
||||||
* for database definitions we'll use the fact that
|
* for database definitions we'll use the fact that
|
||||||
* realistically all insert statements look like "insert
|
* realistically all insert statements look like "insert
|
||||||
* into A(b, c) values(:b, :c) on the parameterized query
|
* into A(b, c) values(:b, :c) on the parameterized query
|
||||||
* front. If we just have a list of b, c, etc... we can
|
* front. If we just have a list of b, c, etc... we can
|
||||||
* generate these strings instead of typing them out.
|
* generate these strings instead of typing them out.
|
||||||
*/
|
*/
|
||||||
string[] cols = new string[dt.Columns.Count];
|
string[] cols = new string[dt.Columns.Count];
|
||||||
for (int i = 0; i < dt.Columns.Count; i++)
|
for (int i = 0; i < dt.Columns.Count; i++)
|
||||||
{
|
{
|
||||||
DataColumn col = dt.Columns[i];
|
DataColumn col = dt.Columns[i];
|
||||||
cols[i] = col.ColumnName;
|
cols[i] = col.ColumnName;
|
||||||
}
|
}
|
||||||
|
|
||||||
string sql = "insert into " + table + "(";
|
string sql = "insert into " + table + "(";
|
||||||
sql += String.Join(", ", cols);
|
sql += String.Join(", ", cols);
|
||||||
// important, the first ':' needs to be here, the rest get added in the join
|
// important, the first ':' needs to be here, the rest get added in the join
|
||||||
sql += ") values (:";
|
sql += ") values (:";
|
||||||
sql += String.Join(", :", cols);
|
sql += String.Join(", :", cols);
|
||||||
sql += ")";
|
sql += ")";
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
SqliteCommand cmd = new SqliteCommand(sql);
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
// this provides the binding for all our parameters, so
|
||||||
// much less code than it used to be
|
// much less code than it used to be
|
||||||
foreach (DataColumn col in dt.Columns)
|
foreach (DataColumn col in dt.Columns)
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
||||||
}
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
|
protected static SqliteCommand createUpdateCommand(string table, string pk, DataTable dt)
|
||||||
{
|
{
|
||||||
string sql = "update " + table + " set ";
|
string sql = "update " + table + " set ";
|
||||||
string subsql = "";
|
string subsql = String.Empty;
|
||||||
foreach (DataColumn col in dt.Columns)
|
foreach (DataColumn col in dt.Columns)
|
||||||
{
|
{
|
||||||
if (subsql.Length > 0)
|
if (subsql.Length > 0)
|
||||||
{
|
{
|
||||||
// a map function would rock so much here
|
// a map function would rock so much here
|
||||||
subsql += ", ";
|
subsql += ", ";
|
||||||
}
|
}
|
||||||
subsql += col.ColumnName + "= :" + col.ColumnName;
|
subsql += col.ColumnName + "= :" + col.ColumnName;
|
||||||
}
|
}
|
||||||
sql += subsql;
|
sql += subsql;
|
||||||
sql += " where " + pk;
|
sql += " where " + pk;
|
||||||
SqliteCommand cmd = new SqliteCommand(sql);
|
SqliteCommand cmd = new SqliteCommand(sql);
|
||||||
|
|
||||||
// this provides the binding for all our parameters, so
|
// this provides the binding for all our parameters, so
|
||||||
// much less code than it used to be
|
// much less code than it used to be
|
||||||
|
|
||||||
foreach (DataColumn col in dt.Columns)
|
foreach (DataColumn col in dt.Columns)
|
||||||
{
|
{
|
||||||
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
cmd.Parameters.Add(createSqliteParameter(col.ColumnName, col.DataType));
|
||||||
}
|
}
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected static string defineTable(DataTable dt)
|
protected static string defineTable(DataTable dt)
|
||||||
{
|
{
|
||||||
string sql = "create table " + dt.TableName + "(";
|
string sql = "create table " + dt.TableName + "(";
|
||||||
string subsql = "";
|
string subsql = String.Empty;
|
||||||
foreach (DataColumn col in dt.Columns)
|
foreach (DataColumn col in dt.Columns)
|
||||||
{
|
{
|
||||||
if (subsql.Length > 0)
|
if (subsql.Length > 0)
|
||||||
{
|
{
|
||||||
// a map function would rock so much here
|
// a map function would rock so much here
|
||||||
subsql += ",\n";
|
subsql += ",\n";
|
||||||
}
|
}
|
||||||
subsql += col.ColumnName + " " + sqliteType(col.DataType);
|
subsql += col.ColumnName + " " + sqliteType(col.DataType);
|
||||||
if (dt.PrimaryKey.Length > 0)
|
if (dt.PrimaryKey.Length > 0)
|
||||||
{
|
{
|
||||||
if (col == dt.PrimaryKey[0])
|
if (col == dt.PrimaryKey[0])
|
||||||
{
|
{
|
||||||
subsql += " primary key";
|
subsql += " primary key";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sql += subsql;
|
sql += subsql;
|
||||||
sql += ")";
|
sql += ")";
|
||||||
return sql;
|
return sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Database Binding functions
|
* Database Binding functions
|
||||||
*
|
*
|
||||||
* These will be db specific due to typing, and minor differences
|
* These will be db specific due to typing, and minor differences
|
||||||
* in databases.
|
* in databases.
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// This is a convenience function that collapses 5 repetitive
|
/// This is a convenience function that collapses 5 repetitive
|
||||||
/// lines for defining SqliteParameters to 2 parameters:
|
/// lines for defining SqliteParameters to 2 parameters:
|
||||||
/// column name and database type.
|
/// column name and database type.
|
||||||
///
|
///
|
||||||
/// It assumes certain conventions like :param as the param
|
/// It assumes certain conventions like :param as the param
|
||||||
/// name to replace in parametrized queries, and that source
|
/// name to replace in parametrized queries, and that source
|
||||||
/// version is always current version, both of which are fine
|
/// version is always current version, both of which are fine
|
||||||
/// for us.
|
/// for us.
|
||||||
///</summary>
|
///</summary>
|
||||||
///<returns>a built sqlite parameter</returns>
|
///<returns>a built sqlite parameter</returns>
|
||||||
protected static SqliteParameter createSqliteParameter(string name, Type type)
|
protected static SqliteParameter createSqliteParameter(string name, Type type)
|
||||||
{
|
{
|
||||||
SqliteParameter param = new SqliteParameter();
|
SqliteParameter param = new SqliteParameter();
|
||||||
param.ParameterName = ":" + name;
|
param.ParameterName = ":" + name;
|
||||||
param.DbType = dbtypeFromType(type);
|
param.DbType = dbtypeFromType(type);
|
||||||
param.SourceColumn = name;
|
param.SourceColumn = name;
|
||||||
param.SourceVersion = DataRowVersion.Current;
|
param.SourceVersion = DataRowVersion.Current;
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Type conversion functions
|
* Type conversion functions
|
||||||
*
|
*
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
protected static DbType dbtypeFromType(Type type)
|
protected static DbType dbtypeFromType(Type type)
|
||||||
{
|
{
|
||||||
if (type == typeof (String))
|
if (type == typeof (String))
|
||||||
{
|
{
|
||||||
return DbType.String;
|
return DbType.String;
|
||||||
}
|
}
|
||||||
else if (type == typeof (Int32))
|
else if (type == typeof (Int32))
|
||||||
{
|
{
|
||||||
return DbType.Int32;
|
return DbType.Int32;
|
||||||
}
|
}
|
||||||
else if (type == typeof (UInt32))
|
else if (type == typeof (UInt32))
|
||||||
{
|
{
|
||||||
return DbType.UInt32;
|
return DbType.UInt32;
|
||||||
}
|
}
|
||||||
else if (type == typeof (Int64))
|
else if (type == typeof (Int64))
|
||||||
{
|
{
|
||||||
return DbType.Int64;
|
return DbType.Int64;
|
||||||
}
|
}
|
||||||
else if (type == typeof (UInt64))
|
else if (type == typeof (UInt64))
|
||||||
{
|
{
|
||||||
return DbType.UInt64;
|
return DbType.UInt64;
|
||||||
}
|
}
|
||||||
else if (type == typeof (Double))
|
else if (type == typeof (Double))
|
||||||
{
|
{
|
||||||
return DbType.Double;
|
return DbType.Double;
|
||||||
}
|
}
|
||||||
else if (type == typeof (Boolean))
|
else if (type == typeof (Boolean))
|
||||||
{
|
{
|
||||||
return DbType.Boolean;
|
return DbType.Boolean;
|
||||||
}
|
}
|
||||||
else if (type == typeof (Byte[]))
|
else if (type == typeof (Byte[]))
|
||||||
{
|
{
|
||||||
return DbType.Binary;
|
return DbType.Binary;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return DbType.String;
|
return DbType.String;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is something we'll need to implement for each db
|
// this is something we'll need to implement for each db
|
||||||
// slightly differently.
|
// slightly differently.
|
||||||
protected static string sqliteType(Type type)
|
protected static string sqliteType(Type type)
|
||||||
{
|
{
|
||||||
if (type == typeof (String))
|
if (type == typeof (String))
|
||||||
{
|
{
|
||||||
return "varchar(255)";
|
return "varchar(255)";
|
||||||
}
|
}
|
||||||
else if (type == typeof (Int32))
|
else if (type == typeof (Int32))
|
||||||
{
|
{
|
||||||
return "integer";
|
return "integer";
|
||||||
}
|
}
|
||||||
else if (type == typeof (UInt32))
|
else if (type == typeof (UInt32))
|
||||||
{
|
{
|
||||||
return "integer";
|
return "integer";
|
||||||
}
|
}
|
||||||
else if (type == typeof (Int64))
|
else if (type == typeof (Int64))
|
||||||
{
|
{
|
||||||
return "varchar(255)";
|
return "varchar(255)";
|
||||||
}
|
}
|
||||||
else if (type == typeof (UInt64))
|
else if (type == typeof (UInt64))
|
||||||
{
|
{
|
||||||
return "varchar(255)";
|
return "varchar(255)";
|
||||||
}
|
}
|
||||||
else if (type == typeof (Double))
|
else if (type == typeof (Double))
|
||||||
{
|
{
|
||||||
return "float";
|
return "float";
|
||||||
}
|
}
|
||||||
else if (type == typeof (Boolean))
|
else if (type == typeof (Boolean))
|
||||||
{
|
{
|
||||||
return "integer";
|
return "integer";
|
||||||
}
|
}
|
||||||
else if (type == typeof (Byte[]))
|
else if (type == typeof (Byte[]))
|
||||||
{
|
{
|
||||||
return "blob";
|
return "blob";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "string";
|
return "string";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,278 +1,280 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Mono.Data.SqliteClient;
|
using Mono.Data.SqliteClient;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data.SQLite
|
namespace OpenSim.Framework.Data.SQLite
|
||||||
{
|
{
|
||||||
internal class SQLiteManager : SQLiteBase
|
internal class SQLiteManager : SQLiteBase
|
||||||
{
|
{
|
||||||
private IDbConnection dbcon;
|
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
private IDbConnection dbcon;
|
||||||
/// Initialises and creates a new SQLite connection and maintains it.
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="hostname">The SQLite server being connected to</param>
|
/// Initialises and creates a new SQLite connection and maintains it.
|
||||||
/// <param name="database">The name of the SQLite database being used</param>
|
/// </summary>
|
||||||
/// <param name="username">The username logging into the database</param>
|
/// <param name="hostname">The SQLite server being connected to</param>
|
||||||
/// <param name="password">The password for the user logging in</param>
|
/// <param name="database">The name of the SQLite database being used</param>
|
||||||
/// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
|
/// <param name="username">The username logging into the database</param>
|
||||||
public SQLiteManager(string hostname, string database, string username, string password, string cpooling)
|
/// <param name="password">The password for the user logging in</param>
|
||||||
{
|
/// <param name="cpooling">Whether to use connection pooling or not, can be one of the following: 'yes', 'true', 'no' or 'false', if unsure use 'false'.</param>
|
||||||
try
|
public SQLiteManager(string hostname, string database, string username, string password, string cpooling)
|
||||||
{
|
{
|
||||||
string connectionString = "URI=file:GridServerSqlite.db;";
|
try
|
||||||
dbcon = new SQLiteConnection(connectionString);
|
{
|
||||||
|
string connectionString = "URI=file:GridServerSqlite.db;";
|
||||||
dbcon.Open();
|
dbcon = new SQLiteConnection(connectionString);
|
||||||
}
|
|
||||||
catch (Exception e)
|
dbcon.Open();
|
||||||
{
|
}
|
||||||
throw new Exception("Error initialising SQLite Database: " + e.ToString());
|
catch (Exception e)
|
||||||
}
|
{
|
||||||
}
|
throw new Exception("Error initialising SQLite Database: " + e.ToString());
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Shuts down the database connection
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
public void Close()
|
/// Shuts down the database connection
|
||||||
{
|
/// </summary>
|
||||||
dbcon.Close();
|
public void Close()
|
||||||
dbcon = null;
|
{
|
||||||
}
|
dbcon.Close();
|
||||||
|
dbcon = null;
|
||||||
/// <summary>
|
}
|
||||||
/// Runs a query with protection against SQL Injection by using parameterised input.
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
|
/// Runs a query with protection against SQL Injection by using parameterised input.
|
||||||
/// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
|
/// </summary>
|
||||||
/// <returns>A SQLite DB Command</returns>
|
/// <param name="sql">The SQL string - replace any variables such as WHERE x = "y" with WHERE x = @y</param>
|
||||||
public IDbCommand Query(string sql, Dictionary<string, string> parameters)
|
/// <param name="parameters">The parameters - index so that @y is indexed as 'y'</param>
|
||||||
{
|
/// <returns>A SQLite DB Command</returns>
|
||||||
SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
|
public IDbCommand Query(string sql, Dictionary<string, string> parameters)
|
||||||
dbcommand.CommandText = sql;
|
{
|
||||||
foreach (KeyValuePair<string, string> param in parameters)
|
SQLiteCommand dbcommand = (SQLiteCommand) dbcon.CreateCommand();
|
||||||
{
|
dbcommand.CommandText = sql;
|
||||||
SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
|
foreach (KeyValuePair<string, string> param in parameters)
|
||||||
dbcommand.Parameters.Add(paramx);
|
{
|
||||||
}
|
SQLiteParameter paramx = new SQLiteParameter(param.Key, param.Value);
|
||||||
|
dbcommand.Parameters.Add(paramx);
|
||||||
return (IDbCommand) dbcommand;
|
}
|
||||||
}
|
|
||||||
|
return (IDbCommand) dbcommand;
|
||||||
private bool TestTables(SQLiteConnection conn)
|
}
|
||||||
{
|
|
||||||
SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM regions", conn);
|
private bool TestTables(SQLiteConnection conn)
|
||||||
SQLiteDataAdapter pDa = new SQLiteDataAdapter(cmd);
|
{
|
||||||
DataSet tmpDS = new DataSet();
|
SQLiteCommand cmd = new SQLiteCommand("SELECT * FROM regions", conn);
|
||||||
try
|
SQLiteDataAdapter pDa = new SQLiteDataAdapter(cmd);
|
||||||
{
|
DataSet tmpDS = new DataSet();
|
||||||
pDa.Fill(tmpDS, "regions");
|
try
|
||||||
}
|
{
|
||||||
catch (SqliteSyntaxException)
|
pDa.Fill(tmpDS, "regions");
|
||||||
{
|
}
|
||||||
MainLog.Instance.Verbose("DATASTORE", "SQLite Database doesn't exist... creating");
|
catch (SqliteSyntaxException)
|
||||||
InitDB(conn);
|
{
|
||||||
}
|
m_log.Info("[DATASTORE]: SQLite Database doesn't exist... creating");
|
||||||
return true;
|
InitDB(conn);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
private DataTable createRegionsTable()
|
}
|
||||||
{
|
|
||||||
DataTable regions = new DataTable("regions");
|
private DataTable createRegionsTable()
|
||||||
|
{
|
||||||
createCol(regions, "regionHandle", typeof (ulong));
|
DataTable regions = new DataTable("regions");
|
||||||
createCol(regions, "regionName", typeof (String));
|
|
||||||
createCol(regions, "uuid", typeof (String));
|
createCol(regions, "regionHandle", typeof (ulong));
|
||||||
|
createCol(regions, "regionName", typeof (String));
|
||||||
createCol(regions, "regionRecvKey", typeof (String));
|
createCol(regions, "uuid", typeof (String));
|
||||||
createCol(regions, "regionSecret", typeof (String));
|
|
||||||
createCol(regions, "regionSendKey", typeof (String));
|
createCol(regions, "regionRecvKey", typeof (String));
|
||||||
|
createCol(regions, "regionSecret", typeof (String));
|
||||||
createCol(regions, "regionDataURI", typeof (String));
|
createCol(regions, "regionSendKey", typeof (String));
|
||||||
createCol(regions, "serverIP", typeof (String));
|
|
||||||
createCol(regions, "serverPort", typeof (String));
|
createCol(regions, "regionDataURI", typeof (String));
|
||||||
createCol(regions, "serverURI", typeof (String));
|
createCol(regions, "serverIP", typeof (String));
|
||||||
|
createCol(regions, "serverPort", typeof (String));
|
||||||
|
createCol(regions, "serverURI", typeof (String));
|
||||||
createCol(regions, "locX", typeof (uint));
|
|
||||||
createCol(regions, "locY", typeof (uint));
|
|
||||||
createCol(regions, "locZ", typeof (uint));
|
createCol(regions, "locX", typeof (uint));
|
||||||
|
createCol(regions, "locY", typeof (uint));
|
||||||
createCol(regions, "eastOverrideHandle", typeof (ulong));
|
createCol(regions, "locZ", typeof (uint));
|
||||||
createCol(regions, "westOverrideHandle", typeof (ulong));
|
|
||||||
createCol(regions, "southOverrideHandle", typeof (ulong));
|
createCol(regions, "eastOverrideHandle", typeof (ulong));
|
||||||
createCol(regions, "northOverrideHandle", typeof (ulong));
|
createCol(regions, "westOverrideHandle", typeof (ulong));
|
||||||
|
createCol(regions, "southOverrideHandle", typeof (ulong));
|
||||||
createCol(regions, "regionAssetURI", typeof (String));
|
createCol(regions, "northOverrideHandle", typeof (ulong));
|
||||||
createCol(regions, "regionAssetRecvKey", typeof (String));
|
|
||||||
createCol(regions, "regionAssetSendKey", typeof (String));
|
createCol(regions, "regionAssetURI", typeof (String));
|
||||||
|
createCol(regions, "regionAssetRecvKey", typeof (String));
|
||||||
createCol(regions, "regionUserURI", typeof (String));
|
createCol(regions, "regionAssetSendKey", typeof (String));
|
||||||
createCol(regions, "regionUserRecvKey", typeof (String));
|
|
||||||
createCol(regions, "regionUserSendKey", typeof (String));
|
createCol(regions, "regionUserURI", typeof (String));
|
||||||
|
createCol(regions, "regionUserRecvKey", typeof (String));
|
||||||
// Add in contraints
|
createCol(regions, "regionUserSendKey", typeof (String));
|
||||||
regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
|
|
||||||
return regions;
|
// Add in contraints
|
||||||
}
|
regions.PrimaryKey = new DataColumn[] {regions.Columns["UUID"]};
|
||||||
|
return regions;
|
||||||
private void InitDB(SQLiteConnection conn)
|
}
|
||||||
{
|
|
||||||
string createUsers = defineTable(createRegionsTable());
|
private void InitDB(SQLiteConnection conn)
|
||||||
SQLiteCommand pcmd = new SQLiteCommand(createUsers, conn);
|
{
|
||||||
conn.Open();
|
string createUsers = defineTable(createRegionsTable());
|
||||||
pcmd.ExecuteNonQuery();
|
SQLiteCommand pcmd = new SQLiteCommand(createUsers, conn);
|
||||||
conn.Close();
|
conn.Open();
|
||||||
}
|
pcmd.ExecuteNonQuery();
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// Reads a region row from a database reader
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="reader">An active database reader</param>
|
/// Reads a region row from a database reader
|
||||||
/// <returns>A region profile</returns>
|
/// </summary>
|
||||||
public RegionProfileData getRow(IDataReader reader)
|
/// <param name="reader">An active database reader</param>
|
||||||
{
|
/// <returns>A region profile</returns>
|
||||||
RegionProfileData retval = new RegionProfileData();
|
public RegionProfileData getRow(IDataReader reader)
|
||||||
|
{
|
||||||
if (reader.Read())
|
RegionProfileData retval = new RegionProfileData();
|
||||||
{
|
|
||||||
// Region Main
|
if (reader.Read())
|
||||||
retval.regionHandle = (ulong) reader["regionHandle"];
|
{
|
||||||
retval.regionName = (string) reader["regionName"];
|
// Region Main
|
||||||
retval.UUID = new LLUUID((string) reader["uuid"]);
|
retval.regionHandle = (ulong) reader["regionHandle"];
|
||||||
|
retval.regionName = (string) reader["regionName"];
|
||||||
// Secrets
|
retval.UUID = new LLUUID((string) reader["uuid"]);
|
||||||
retval.regionRecvKey = (string) reader["regionRecvKey"];
|
|
||||||
retval.regionSecret = (string) reader["regionSecret"];
|
// Secrets
|
||||||
retval.regionSendKey = (string) reader["regionSendKey"];
|
retval.regionRecvKey = (string) reader["regionRecvKey"];
|
||||||
|
retval.regionSecret = (string) reader["regionSecret"];
|
||||||
// Region Server
|
retval.regionSendKey = (string) reader["regionSendKey"];
|
||||||
retval.regionDataURI = (string) reader["regionDataURI"];
|
|
||||||
retval.regionOnline = false; // Needs to be pinged before this can be set.
|
// Region Server
|
||||||
retval.serverIP = (string) reader["serverIP"];
|
retval.regionDataURI = (string) reader["regionDataURI"];
|
||||||
retval.serverPort = (uint) reader["serverPort"];
|
retval.regionOnline = false; // Needs to be pinged before this can be set.
|
||||||
retval.serverURI = (string) reader["serverURI"];
|
retval.serverIP = (string) reader["serverIP"];
|
||||||
|
retval.serverPort = (uint) reader["serverPort"];
|
||||||
// Location
|
retval.serverURI = (string) reader["serverURI"];
|
||||||
retval.regionLocX = (uint) ((int) reader["locX"]);
|
|
||||||
retval.regionLocY = (uint) ((int) reader["locY"]);
|
// Location
|
||||||
retval.regionLocZ = (uint) ((int) reader["locZ"]);
|
retval.regionLocX = (uint) ((int) reader["locX"]);
|
||||||
|
retval.regionLocY = (uint) ((int) reader["locY"]);
|
||||||
// Neighbours - 0 = No Override
|
retval.regionLocZ = (uint) ((int) reader["locZ"]);
|
||||||
retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
|
|
||||||
retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
|
// Neighbours - 0 = No Override
|
||||||
retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
|
retval.regionEastOverrideHandle = (ulong) reader["eastOverrideHandle"];
|
||||||
retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
|
retval.regionWestOverrideHandle = (ulong) reader["westOverrideHandle"];
|
||||||
|
retval.regionSouthOverrideHandle = (ulong) reader["southOverrideHandle"];
|
||||||
// Assets
|
retval.regionNorthOverrideHandle = (ulong) reader["northOverrideHandle"];
|
||||||
retval.regionAssetURI = (string) reader["regionAssetURI"];
|
|
||||||
retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
|
// Assets
|
||||||
retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
|
retval.regionAssetURI = (string) reader["regionAssetURI"];
|
||||||
|
retval.regionAssetRecvKey = (string) reader["regionAssetRecvKey"];
|
||||||
// Userserver
|
retval.regionAssetSendKey = (string) reader["regionAssetSendKey"];
|
||||||
retval.regionUserURI = (string) reader["regionUserURI"];
|
|
||||||
retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
|
// Userserver
|
||||||
retval.regionUserSendKey = (string) reader["regionUserSendKey"];
|
retval.regionUserURI = (string) reader["regionUserURI"];
|
||||||
}
|
retval.regionUserRecvKey = (string) reader["regionUserRecvKey"];
|
||||||
else
|
retval.regionUserSendKey = (string) reader["regionUserSendKey"];
|
||||||
{
|
}
|
||||||
throw new Exception("No rows to return");
|
else
|
||||||
}
|
{
|
||||||
return retval;
|
throw new Exception("No rows to return");
|
||||||
}
|
}
|
||||||
|
return retval;
|
||||||
/// <summary>
|
}
|
||||||
/// Inserts a new region into the database
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
/// <param name="profile">The region to insert</param>
|
/// Inserts a new region into the database
|
||||||
/// <returns>Success?</returns>
|
/// </summary>
|
||||||
public bool insertRow(RegionProfileData profile)
|
/// <param name="profile">The region to insert</param>
|
||||||
{
|
/// <returns>Success?</returns>
|
||||||
string sql =
|
public bool insertRow(RegionProfileData profile)
|
||||||
"REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
|
{
|
||||||
sql +=
|
string sql =
|
||||||
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
|
"REPLACE INTO regions VALUES (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
|
||||||
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
|
sql +=
|
||||||
|
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
|
||||||
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
|
sql += "regionAssetSendKey, regionUserURI, regionUserRecvKey, regionUserSendKey) VALUES ";
|
||||||
sql +=
|
|
||||||
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
|
sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
|
||||||
sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
|
sql +=
|
||||||
|
"@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
sql += "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey);";
|
||||||
|
|
||||||
parameters["regionHandle"] = profile.regionHandle.ToString();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
parameters["regionName"] = profile.regionName;
|
|
||||||
parameters["uuid"] = profile.UUID.ToString();
|
parameters["regionHandle"] = profile.regionHandle.ToString();
|
||||||
parameters["regionRecvKey"] = profile.regionRecvKey;
|
parameters["regionName"] = profile.regionName;
|
||||||
parameters["regionSendKey"] = profile.regionSendKey;
|
parameters["uuid"] = profile.UUID.ToString();
|
||||||
parameters["regionDataURI"] = profile.regionDataURI;
|
parameters["regionRecvKey"] = profile.regionRecvKey;
|
||||||
parameters["serverIP"] = profile.serverIP;
|
parameters["regionSendKey"] = profile.regionSendKey;
|
||||||
parameters["serverPort"] = profile.serverPort.ToString();
|
parameters["regionDataURI"] = profile.regionDataURI;
|
||||||
parameters["serverURI"] = profile.serverURI;
|
parameters["serverIP"] = profile.serverIP;
|
||||||
parameters["locX"] = profile.regionLocX.ToString();
|
parameters["serverPort"] = profile.serverPort.ToString();
|
||||||
parameters["locY"] = profile.regionLocY.ToString();
|
parameters["serverURI"] = profile.serverURI;
|
||||||
parameters["locZ"] = profile.regionLocZ.ToString();
|
parameters["locX"] = profile.regionLocX.ToString();
|
||||||
parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
|
parameters["locY"] = profile.regionLocY.ToString();
|
||||||
parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
|
parameters["locZ"] = profile.regionLocZ.ToString();
|
||||||
parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
|
parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
|
||||||
parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
|
parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
|
||||||
parameters["regionAssetURI"] = profile.regionAssetURI;
|
parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
|
||||||
parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
|
parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
|
||||||
parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
|
parameters["regionAssetURI"] = profile.regionAssetURI;
|
||||||
parameters["regionUserURI"] = profile.regionUserURI;
|
parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
|
||||||
parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
|
parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
|
||||||
parameters["regionUserSendKey"] = profile.regionUserSendKey;
|
parameters["regionUserURI"] = profile.regionUserURI;
|
||||||
|
parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
|
||||||
bool returnval = false;
|
parameters["regionUserSendKey"] = profile.regionUserSendKey;
|
||||||
|
|
||||||
try
|
bool returnval = false;
|
||||||
{
|
|
||||||
IDbCommand result = Query(sql, parameters);
|
try
|
||||||
|
{
|
||||||
if (result.ExecuteNonQuery() == 1)
|
IDbCommand result = Query(sql, parameters);
|
||||||
returnval = true;
|
|
||||||
|
if (result.ExecuteNonQuery() == 1)
|
||||||
result.Dispose();
|
returnval = true;
|
||||||
}
|
|
||||||
catch (Exception)
|
result.Dispose();
|
||||||
{
|
}
|
||||||
return false;
|
catch (Exception)
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
return returnval;
|
}
|
||||||
}
|
|
||||||
}
|
return returnval;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,125 +1,122 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
{
|
{
|
||||||
public class AvatarPickerAvatar
|
public class AvatarPickerAvatar
|
||||||
{
|
{
|
||||||
public LLUUID AvatarID;
|
public LLUUID AvatarID;
|
||||||
public string firstName;
|
public string firstName;
|
||||||
public string lastName;
|
public string lastName;
|
||||||
|
|
||||||
public AvatarPickerAvatar()
|
public AvatarPickerAvatar()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DataResponse
|
public enum DataResponse
|
||||||
{
|
{
|
||||||
RESPONSE_OK,
|
RESPONSE_OK,
|
||||||
RESPONSE_AUTHREQUIRED,
|
RESPONSE_AUTHREQUIRED,
|
||||||
RESPONSE_INVALIDCREDENTIALS,
|
RESPONSE_INVALIDCREDENTIALS,
|
||||||
RESPONSE_ERROR
|
RESPONSE_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A standard grid interface
|
/// A standard grid interface
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGridData
|
public interface IGridData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sim profile from a regionHandle
|
/// Returns a sim profile from a regionHandle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionHandle">A 64bit Region Handle</param>
|
/// <param name="regionHandle">A 64bit Region Handle</param>
|
||||||
/// <returns>A simprofile</returns>
|
/// <returns>A simprofile</returns>
|
||||||
RegionProfileData GetProfileByHandle(ulong regionHandle);
|
RegionProfileData GetProfileByHandle(ulong regionHandle);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a sim profile from a UUID
|
/// Returns a sim profile from a UUID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="UUID">A 128bit UUID</param>
|
/// <param name="UUID">A 128bit UUID</param>
|
||||||
/// <returns>A sim profile</returns>
|
/// <returns>A sim profile</returns>
|
||||||
RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
RegionProfileData GetProfileByLLUUID(LLUUID UUID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns all profiles within the specified range
|
/// Returns all profiles within the specified range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Xmin">Minimum sim coordinate (X)</param>
|
/// <param name="Xmin">Minimum sim coordinate (X)</param>
|
||||||
/// <param name="Ymin">Minimum sim coordinate (Y)</param>
|
/// <param name="Ymin">Minimum sim coordinate (Y)</param>
|
||||||
/// <param name="Xmax">Maximum sim coordinate (X)</param>
|
/// <param name="Xmax">Maximum sim coordinate (X)</param>
|
||||||
/// <param name="Ymin">Maximum sim coordinate (Y)</param>
|
/// <param name="Ymin">Maximum sim coordinate (Y)</param>
|
||||||
/// <returns>An array containing all the sim profiles in the specified range</returns>
|
/// <returns>An array containing all the sim profiles in the specified range</returns>
|
||||||
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
List<AvatarPickerAvatar> GeneratePickerResults(LLUUID queryID, string query);
|
/// Authenticates a sim by use of its recv key.
|
||||||
|
/// WARNING: Insecure
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Authenticates a sim by use of its recv key.
|
/// <param name="UUID">The UUID sent by the sim</param>
|
||||||
/// WARNING: Insecure
|
/// <param name="regionHandle">The regionhandle sent by the sim</param>
|
||||||
/// </summary>
|
/// <param name="simrecvkey">The receiving key sent by the sim</param>
|
||||||
/// <param name="UUID">The UUID sent by the sim</param>
|
/// <returns>Whether the sim has been authenticated</returns>
|
||||||
/// <param name="regionHandle">The regionhandle sent by the sim</param>
|
bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
||||||
/// <param name="simrecvkey">The receiving key sent by the sim</param>
|
|
||||||
/// <returns>Whether the sim has been authenticated</returns>
|
/// <summary>
|
||||||
bool AuthenticateSim(LLUUID UUID, ulong regionHandle, string simrecvkey);
|
/// Initialises the interface
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
void Initialise();
|
||||||
/// Initialises the interface
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
void Initialise();
|
/// Closes the interface
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
void Close();
|
||||||
/// Closes the interface
|
|
||||||
/// </summary>
|
/// <summary>
|
||||||
void Close();
|
/// The plugin being loaded
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <returns>A string containing the plugin name</returns>
|
||||||
/// The plugin being loaded
|
string getName();
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugin name</returns>
|
/// <summary>
|
||||||
string getName();
|
/// The plugins version
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <returns>A string containing the plugin version</returns>
|
||||||
/// The plugins version
|
string getVersion();
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugin version</returns>
|
/// <summary>
|
||||||
string getVersion();
|
/// Adds a new profile to the database
|
||||||
|
/// </summary>
|
||||||
/// <summary>
|
/// <param name="profile">The profile to add</param>
|
||||||
/// Adds a new profile to the database
|
/// <returns>RESPONSE_OK if successful, error if not.</returns>
|
||||||
/// </summary>
|
DataResponse AddProfile(RegionProfileData profile);
|
||||||
/// <param name="profile">The profile to add</param>
|
|
||||||
/// <returns>RESPONSE_OK if successful, error if not.</returns>
|
ReservationData GetReservationAtPoint(uint x, uint y);
|
||||||
DataResponse AddProfile(RegionProfileData profile);
|
}
|
||||||
|
}
|
||||||
ReservationData GetReservationAtPoint(uint x, uint y);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Data;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data
|
||||||
|
{
|
||||||
|
public class OpenSimDataReader : BaseDataReader
|
||||||
|
{
|
||||||
|
public OpenSimDataReader(IDataReader source) : base(source)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLVector3 GetVector(string s)
|
||||||
|
{
|
||||||
|
float x = GetFloat(s + "X");
|
||||||
|
float y = GetFloat(s + "Y");
|
||||||
|
float z = GetFloat(s + "Z");
|
||||||
|
|
||||||
|
LLVector3 vector = new LLVector3(x, y, z);
|
||||||
|
|
||||||
|
return vector;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LLQuaternion GetQuaternion(string s)
|
||||||
|
{
|
||||||
|
float x = GetFloat(s + "X");
|
||||||
|
float y = GetFloat(s + "Y");
|
||||||
|
float z = GetFloat(s + "Z");
|
||||||
|
float w = GetFloat(s + "W");
|
||||||
|
|
||||||
|
LLQuaternion quaternion = new LLQuaternion(x, y, z, w);
|
||||||
|
|
||||||
|
return quaternion;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Data;
|
||||||
|
using System.Data.Common;
|
||||||
|
using libsecondlife;
|
||||||
|
using MySql.Data.MySqlClient;
|
||||||
|
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data
|
||||||
|
{
|
||||||
|
public abstract class OpenSimDatabaseConnector : BaseDatabaseConnector
|
||||||
|
{
|
||||||
|
public OpenSimDatabaseConnector(string connectionString) : base(connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object ConvertToDbType(object value)
|
||||||
|
{
|
||||||
|
if (value is LLUUID)
|
||||||
|
{
|
||||||
|
return ((LLUUID) value).UUID.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.ConvertToDbType(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override BaseDataReader CreateReader(IDataReader reader)
|
||||||
|
{
|
||||||
|
return new OpenSimDataReader(reader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class MySQLDatabaseMapper : OpenSimDatabaseConnector
|
||||||
|
{
|
||||||
|
public MySQLDatabaseMapper(string connectionString)
|
||||||
|
: base(connectionString)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DbConnection GetNewConnection()
|
||||||
|
{
|
||||||
|
MySqlConnection connection = new MySqlConnection(m_connectionString);
|
||||||
|
return connection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string CreateParamName(string fieldName)
|
||||||
|
{
|
||||||
|
return "?" + fieldName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Data.Common;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data
|
||||||
|
{
|
||||||
|
public class OpenSimObjectFieldMapper<TObject, TField> : ObjectField<TObject, TField>
|
||||||
|
{
|
||||||
|
public OpenSimObjectFieldMapper(BaseTableMapper tableMapper, string fieldName,
|
||||||
|
ObjectGetAccessor<TObject, TField> rowMapperGetAccessor,
|
||||||
|
ObjectSetAccessor<TObject, TField> rowMapperSetAccessor)
|
||||||
|
: base(tableMapper, fieldName, rowMapperGetAccessor, rowMapperSetAccessor)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ExpandField<TObj>(TObj obj, DbCommand command, List<string> fieldNames)
|
||||||
|
{
|
||||||
|
string fieldName = FieldName;
|
||||||
|
object value = GetParamValue(obj);
|
||||||
|
|
||||||
|
if (ValueType == typeof(LLVector3))
|
||||||
|
{
|
||||||
|
LLVector3 vector = (LLVector3)value;
|
||||||
|
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "X", vector.X);
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "Y", vector.Y);
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "Z", vector.Z);
|
||||||
|
}
|
||||||
|
else if (ValueType == typeof(LLQuaternion))
|
||||||
|
{
|
||||||
|
LLQuaternion quaternion = (LLQuaternion)value;
|
||||||
|
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "X", quaternion.X);
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "Y", quaternion.Y);
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "Z", quaternion.Z);
|
||||||
|
RawAddParam(command, fieldNames, fieldName + "W", quaternion.W);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.ExpandField(obj, command, fieldNames);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override object GetValue(BaseDataReader reader)
|
||||||
|
{
|
||||||
|
object value;
|
||||||
|
|
||||||
|
OpenSimDataReader osreader = (OpenSimDataReader) reader;
|
||||||
|
|
||||||
|
if (ValueType == typeof(LLVector3))
|
||||||
|
{
|
||||||
|
value = osreader.GetVector(FieldName);
|
||||||
|
}
|
||||||
|
else if (ValueType == typeof(LLQuaternion))
|
||||||
|
{
|
||||||
|
value = osreader.GetQuaternion(FieldName);
|
||||||
|
}
|
||||||
|
else if (ValueType == typeof(LLUUID))
|
||||||
|
{
|
||||||
|
Guid guid = reader.GetGuid(FieldName);
|
||||||
|
value = new LLUUID(guid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
value = base.GetValue(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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.Data;
|
||||||
|
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data
|
||||||
|
{
|
||||||
|
public abstract class OpenSimTableMapper<TRowMapper, TPrimaryKey> : BaseTableMapper<TRowMapper, TPrimaryKey>
|
||||||
|
{
|
||||||
|
public OpenSimTableMapper(BaseDatabaseConnector database, string tableName) : base(database, tableName)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
/*
|
||||||
|
* 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 OpenSim 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 OpenSim.Framework;
|
||||||
|
using TribalMedia.Framework.Data;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Framework.Data
|
||||||
|
{
|
||||||
|
public class PrimitiveBaseShapeRowMapper : BaseRowMapper<PrimitiveBaseShape>
|
||||||
|
{
|
||||||
|
public Guid SceneObjectPartId;
|
||||||
|
|
||||||
|
public PrimitiveBaseShapeRowMapper(BaseSchema schema, PrimitiveBaseShape obj) : base(schema, obj)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrimitiveBaseShapeTableMapper : OpenSimTableMapper<PrimitiveBaseShapeRowMapper, Guid>
|
||||||
|
{
|
||||||
|
public PrimitiveBaseShapeTableMapper(BaseDatabaseConnector connection, string tableName)
|
||||||
|
: base(connection, tableName)
|
||||||
|
{
|
||||||
|
BaseSchema<PrimitiveBaseShapeRowMapper> rowMapperSchema = new BaseSchema<PrimitiveBaseShapeRowMapper>(this);
|
||||||
|
m_schema = rowMapperSchema;
|
||||||
|
|
||||||
|
m_keyFieldMapper = rowMapperSchema.AddMapping<Guid>("SceneObjectPartId",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.SceneObjectPartId; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, Guid value) { shape.SceneObjectPartId = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PCode",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PCode; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PCode = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<ushort>("PathBegin",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathBegin; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathBegin = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<ushort>("PathEnd",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathEnd; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.PathEnd = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathScaleX",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleX; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleX = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathScaleY",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathScaleY; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathScaleY = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathShearX",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearX; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearX = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathShearY",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathShearY; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathShearY = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<ushort>("ProfileBegin",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileBegin; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileBegin = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<ushort>("ProfileEnd",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileEnd; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileEnd = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<LLVector3>("Scale",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.Scale; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, LLVector3 value) { shape.Object.Scale = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<sbyte>("PathTaperX",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperX; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperX = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<sbyte>("PathTaperY",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTaperY; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTaperY = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<sbyte>("PathTwist",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwist; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwist = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<sbyte>("PathRadiusOffset",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRadiusOffset; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathRadiusOffset = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathRevolutions",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathRevolutions; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathRevolutions = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<sbyte>("PathTwistBegin",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathTwistBegin; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, sbyte value) { shape.Object.PathTwistBegin = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("PathCurve",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.PathCurve; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.PathCurve = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte>("ProfileCurve",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileCurve; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte value) { shape.Object.ProfileCurve = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<ushort>("ProfileHollow",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ProfileHollow; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, ushort value) { shape.Object.ProfileHollow = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte[]>("TextureEntry",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.TextureEntry; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.TextureEntry = value; });
|
||||||
|
|
||||||
|
rowMapperSchema.AddMapping<byte[]>("ExtraParams",
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape) { return shape.Object.ExtraParams; },
|
||||||
|
delegate(PrimitiveBaseShapeRowMapper shape, byte[] value) { shape.Object.ExtraParams = value; });
|
||||||
|
}
|
||||||
|
|
||||||
|
public override PrimitiveBaseShapeRowMapper FromReader(BaseDataReader reader)
|
||||||
|
{
|
||||||
|
PrimitiveBaseShape shape = new PrimitiveBaseShape();
|
||||||
|
|
||||||
|
PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper(m_schema, shape);
|
||||||
|
mapper.FillObject( reader );
|
||||||
|
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Update(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||||
|
{
|
||||||
|
PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
|
||||||
|
return Update(sceneObjectPartId, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Add(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||||
|
{
|
||||||
|
PrimitiveBaseShapeRowMapper mapper = CreateRowMapper(sceneObjectPartId, primitiveBaseShape);
|
||||||
|
return Add(mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PrimitiveBaseShapeRowMapper CreateRowMapper(Guid sceneObjectPartId, PrimitiveBaseShape primitiveBaseShape)
|
||||||
|
{
|
||||||
|
PrimitiveBaseShapeRowMapper mapper = new PrimitiveBaseShapeRowMapper( m_schema, primitiveBaseShape );
|
||||||
|
mapper.SceneObjectPartId = sceneObjectPartId;
|
||||||
|
return mapper;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,38 +1,66 @@
|
||||||
using System.Reflection;
|
/*
|
||||||
using System.Runtime.InteropServices;
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
// General Information about an assembly is controlled through the following
|
*
|
||||||
// set of attributes. Change these attribute values to modify the information
|
* Redistribution and use in source and binary forms, with or without
|
||||||
// associated with an assembly.
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
* * Redistributions of source code must retain the above copyright
|
||||||
[assembly : AssemblyTitle("OpenSim.Framework.Data")]
|
* notice, this list of conditions and the following disclaimer.
|
||||||
[assembly : AssemblyDescription("")]
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
[assembly : AssemblyConfiguration("")]
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
[assembly : AssemblyCompany("")]
|
* documentation and/or other materials provided with the distribution.
|
||||||
[assembly : AssemblyProduct("OpenSim.Framework.Data")]
|
* * Neither the name of the OpenSim Project nor the
|
||||||
[assembly : AssemblyCopyright("Copyright © 2007")]
|
* names of its contributors may be used to endorse or promote products
|
||||||
[assembly : AssemblyTrademark("")]
|
* derived from this software without specific prior written permission.
|
||||||
[assembly : AssemblyCulture("")]
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
// to COM components. If you need to access a type in this assembly from
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
// COM, set the ComVisible attribute to true on that type.
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
[assembly : ComVisible(false)]
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
* 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
|
||||||
[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
// Version information for an assembly consists of the following four values:
|
*/
|
||||||
//
|
|
||||||
// Major Version
|
using System.Reflection;
|
||||||
// Minor Version
|
using System.Runtime.InteropServices;
|
||||||
// Build Number
|
|
||||||
// Revision
|
// General Information about an assembly is controlled through the following
|
||||||
//
|
// set of attributes. Change these attribute values to modify the information
|
||||||
// You can specify all the values or you can default the Revision and Build Numbers
|
// associated with an assembly.
|
||||||
// by using the '*' as shown below:
|
|
||||||
|
[assembly : AssemblyTitle("OpenSim.Framework.Data")]
|
||||||
[assembly : AssemblyVersion("1.0.0.0")]
|
[assembly : AssemblyDescription("")]
|
||||||
[assembly : AssemblyFileVersion("1.0.0.0")]
|
[assembly : AssemblyConfiguration("")]
|
||||||
|
[assembly : AssemblyCompany("")]
|
||||||
|
[assembly : AssemblyProduct("OpenSim.Framework.Data")]
|
||||||
|
[assembly : AssemblyCopyright("Copyright © OpenSimulator.org Developers 2007-2008")]
|
||||||
|
[assembly : AssemblyTrademark("")]
|
||||||
|
[assembly : AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
|
||||||
|
[assembly : ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
|
||||||
|
[assembly : Guid("3a711c34-b0c0-4264-b0fe-f366eabf9d7b")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Revision and Build Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
|
||||||
|
[assembly : AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly : AssemblyFileVersion("1.0.0.0")]
|
||||||
|
|
|
@ -1,201 +1,221 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A class which contains information known to the grid server about a region
|
/// A class which contains information known to the grid server about a region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class RegionProfileData
|
public class RegionProfileData
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The name of the region
|
/// The name of the region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string regionName = "";
|
public string regionName = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A 64-bit number combining map position into a (mostly) unique ID
|
/// A 64-bit number combining map position into a (mostly) unique ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong regionHandle;
|
public ulong regionHandle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// OGS/OpenSim Specific ID for a region
|
/// OGS/OpenSim Specific ID for a region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LLUUID UUID;
|
public LLUUID UUID;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Coordinates of the region
|
/// Coordinates of the region
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public uint regionLocX;
|
public uint regionLocX;
|
||||||
|
|
||||||
public uint regionLocY;
|
public uint regionLocY;
|
||||||
public uint regionLocZ; // Reserved (round-robin, layers, etc)
|
public uint regionLocZ; // Reserved (round-robin, layers, etc)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Authentication secrets
|
/// Authentication secrets
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Not very secure, needs improvement.</remarks>
|
/// <remarks>Not very secure, needs improvement.</remarks>
|
||||||
public string regionSendKey = "";
|
public string regionSendKey = String.Empty;
|
||||||
|
|
||||||
public string regionRecvKey = "";
|
public string regionRecvKey = String.Empty;
|
||||||
public string regionSecret = "";
|
public string regionSecret = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the region is online
|
/// Whether the region is online
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool regionOnline;
|
public bool regionOnline;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Information about the server that the region is currently hosted on
|
/// Information about the server that the region is currently hosted on
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string serverIP = "";
|
public string serverIP = String.Empty;
|
||||||
|
|
||||||
public uint serverPort;
|
public uint serverPort;
|
||||||
public string serverURI = "";
|
public string serverURI = String.Empty;
|
||||||
|
|
||||||
public uint httpPort;
|
public uint httpPort;
|
||||||
public uint remotingPort;
|
public uint remotingPort;
|
||||||
public string httpServerURI = "";
|
public string httpServerURI = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Set of optional overrides. Can be used to create non-eulicidean spaces.
|
/// Set of optional overrides. Can be used to create non-eulicidean spaces.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ulong regionNorthOverrideHandle;
|
public ulong regionNorthOverrideHandle;
|
||||||
|
|
||||||
public ulong regionSouthOverrideHandle;
|
public ulong regionSouthOverrideHandle;
|
||||||
public ulong regionEastOverrideHandle;
|
public ulong regionEastOverrideHandle;
|
||||||
public ulong regionWestOverrideHandle;
|
public ulong regionWestOverrideHandle;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional: URI Location of the region database
|
/// Optional: URI Location of the region database
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
|
/// <remarks>Used for floating sim pools where the region data is not nessecarily coupled to a specific server</remarks>
|
||||||
public string regionDataURI = "";
|
public string regionDataURI = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Region Asset Details
|
/// Region Asset Details
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string regionAssetURI = "";
|
public string regionAssetURI = String.Empty;
|
||||||
|
|
||||||
public string regionAssetSendKey = "";
|
public string regionAssetSendKey = String.Empty;
|
||||||
public string regionAssetRecvKey = "";
|
public string regionAssetRecvKey = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Region Userserver Details
|
/// Region Userserver Details
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string regionUserURI = "";
|
public string regionUserURI = String.Empty;
|
||||||
|
|
||||||
public string regionUserSendKey = "";
|
public string regionUserSendKey = String.Empty;
|
||||||
public string regionUserRecvKey = "";
|
public string regionUserRecvKey = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Region Map Texture Asset
|
/// Region Map Texture Asset
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006");
|
public LLUUID regionMapTextureID = new LLUUID("00000000-0000-0000-9999-000000000006");
|
||||||
|
|
||||||
/// <summary>
|
// part of an initial brutish effort to provide accurate information (as per the xml region spec)
|
||||||
/// Get Sim profile data from grid server when in grid mode
|
// wrt the ownership of a given region
|
||||||
/// </summary>
|
// the (very bad) assumption is that this value is being read and handled inconsistently or
|
||||||
/// <param name="region_uuid"></param>
|
// not at all. Current strategy is to put the code in place to support the validity of this information
|
||||||
/// <param name="gridserver_url"></param>
|
// and to roll forward debugging any issues from that point
|
||||||
/// <param name="?"></param>
|
//
|
||||||
/// <returns></returns>
|
/// <summary>
|
||||||
public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
|
/// this particular mod to the file provides support within the spec for RegionProfileData for the
|
||||||
string gridserver_sendkey, string gridserver_recvkey)
|
/// owner_uuid for the region
|
||||||
{
|
/// </summary>
|
||||||
Hashtable requestData = new Hashtable();
|
public LLUUID owner_uuid;
|
||||||
requestData["region_uuid"] = region_uuid.UUID.ToString();
|
|
||||||
requestData["authkey"] = gridserver_sendkey;
|
/// <summary>
|
||||||
ArrayList SendParams = new ArrayList();
|
/// Get Sim profile data from grid server when in grid mode
|
||||||
SendParams.Add(requestData);
|
/// </summary>
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
/// <param name="region_uuid"></param>
|
||||||
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
/// <param name="gridserver_url"></param>
|
||||||
|
/// <param name="?"></param>
|
||||||
Hashtable responseData = (Hashtable) GridResp.Value;
|
/// <returns></returns>
|
||||||
|
public RegionProfileData RequestSimProfileData(LLUUID region_uuid, string gridserver_url,
|
||||||
if (responseData.ContainsKey("error"))
|
string gridserver_sendkey, string gridserver_recvkey)
|
||||||
{
|
{
|
||||||
return null;
|
Hashtable requestData = new Hashtable();
|
||||||
}
|
requestData["region_uuid"] = region_uuid.UUID.ToString();
|
||||||
|
requestData["authkey"] = gridserver_sendkey;
|
||||||
RegionProfileData simData = new RegionProfileData();
|
ArrayList SendParams = new ArrayList();
|
||||||
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
SendParams.Add(requestData);
|
||||||
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||||
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
|
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
||||||
simData.serverIP = (string) responseData["sim_ip"];
|
|
||||||
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
Hashtable responseData = (Hashtable) GridResp.Value;
|
||||||
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
|
||||||
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
if (responseData.ContainsKey("error"))
|
||||||
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
|
{
|
||||||
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
return null;
|
||||||
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
}
|
||||||
simData.regionName = (string) responseData["region_name"];
|
|
||||||
|
RegionProfileData simData = new RegionProfileData();
|
||||||
return simData;
|
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
||||||
}
|
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
||||||
|
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
|
||||||
public RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
|
simData.serverIP = (string) responseData["sim_ip"];
|
||||||
string gridserver_sendkey, string gridserver_recvkey)
|
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
||||||
{
|
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
||||||
Hashtable requestData = new Hashtable();
|
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
||||||
requestData["region_handle"] = region_handle.ToString();
|
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
|
||||||
requestData["authkey"] = gridserver_sendkey;
|
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
||||||
ArrayList SendParams = new ArrayList();
|
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
||||||
SendParams.Add(requestData);
|
simData.regionName = (string) responseData["region_name"];
|
||||||
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
|
||||||
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
return simData;
|
||||||
|
}
|
||||||
Hashtable responseData = (Hashtable) GridResp.Value;
|
|
||||||
|
/// <summary>
|
||||||
if (responseData.ContainsKey("error"))
|
/// Request sim profile information from a grid server
|
||||||
{
|
/// </summary>
|
||||||
return null;
|
/// <param name="region_handle"></param>
|
||||||
}
|
/// <param name="gridserver_url"></param>
|
||||||
|
/// <param name="gridserver_sendkey"></param>
|
||||||
RegionProfileData simData = new RegionProfileData();
|
/// <param name="gridserver_recvkey"></param>
|
||||||
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
/// <returns>The sim profile. Null if there was a request failure</returns>
|
||||||
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
public static RegionProfileData RequestSimProfileData(ulong region_handle, string gridserver_url,
|
||||||
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
|
string gridserver_sendkey, string gridserver_recvkey)
|
||||||
simData.serverIP = (string) responseData["sim_ip"];
|
{
|
||||||
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
Hashtable requestData = new Hashtable();
|
||||||
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
requestData["region_handle"] = region_handle.ToString();
|
||||||
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
requestData["authkey"] = gridserver_sendkey;
|
||||||
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
ArrayList SendParams = new ArrayList();
|
||||||
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
|
SendParams.Add(requestData);
|
||||||
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_data_request", SendParams);
|
||||||
simData.regionName = (string) responseData["region_name"];
|
XmlRpcResponse GridResp = GridReq.Send(gridserver_url, 3000);
|
||||||
|
|
||||||
return simData;
|
Hashtable responseData = (Hashtable) GridResp.Value;
|
||||||
}
|
|
||||||
}
|
if (responseData.ContainsKey("error"))
|
||||||
}
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
RegionProfileData simData = new RegionProfileData();
|
||||||
|
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
|
||||||
|
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
|
||||||
|
simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
|
||||||
|
simData.serverIP = (string) responseData["sim_ip"];
|
||||||
|
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
|
||||||
|
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
|
||||||
|
simData.remotingPort = Convert.ToUInt32((string) responseData["remoting_port"]);
|
||||||
|
simData.httpServerURI = "http://" + simData.serverIP + ":" + simData.httpPort.ToString() + "/";
|
||||||
|
simData.serverURI = "http://" + simData.serverIP + ":" + simData.serverPort.ToString() + "/";
|
||||||
|
simData.UUID = new LLUUID((string) responseData["region_UUID"]);
|
||||||
|
simData.regionName = (string) responseData["region_name"];
|
||||||
|
|
||||||
|
return simData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,47 +1,47 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Data
|
namespace OpenSim.Framework.Data
|
||||||
{
|
{
|
||||||
public class ReservationData
|
public class ReservationData
|
||||||
{
|
{
|
||||||
public LLUUID userUUID = LLUUID.Zero;
|
public LLUUID userUUID = LLUUID.Zero;
|
||||||
public int reservationMinX = 0;
|
public int reservationMinX = 0;
|
||||||
public int reservationMinY = 0;
|
public int reservationMinY = 0;
|
||||||
public int reservationMaxX = 65536;
|
public int reservationMaxX = 65536;
|
||||||
public int reservationMaxY = 65536;
|
public int reservationMaxY = 65536;
|
||||||
|
|
||||||
public string reservationName = "";
|
public string reservationName = System.String.Empty;
|
||||||
public string reservationCompany = "";
|
public string reservationCompany = System.String.Empty;
|
||||||
public bool status = true;
|
public bool status = true;
|
||||||
|
|
||||||
public string gridSendKey = "";
|
public string gridSendKey = System.String.Empty;
|
||||||
public string gridRecvKey = "";
|
public string gridRecvKey = System.String.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,146 +1,149 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
using System;
|
||||||
{
|
using OpenSim.Framework.Console;
|
||||||
public class GridConfig
|
|
||||||
{
|
namespace OpenSim.Framework
|
||||||
public string GridOwner = "";
|
{
|
||||||
public string DefaultAssetServer = "";
|
public class GridConfig
|
||||||
public string AssetSendKey = "";
|
{
|
||||||
public string AssetRecvKey = "";
|
public string GridOwner = String.Empty;
|
||||||
|
public string DefaultAssetServer = String.Empty;
|
||||||
public string DefaultUserServer = "";
|
public string AssetSendKey = String.Empty;
|
||||||
public string UserSendKey = "";
|
public string AssetRecvKey = String.Empty;
|
||||||
public string UserRecvKey = "";
|
|
||||||
|
public string DefaultUserServer = String.Empty;
|
||||||
public string SimSendKey = "";
|
public string UserSendKey = String.Empty;
|
||||||
public string SimRecvKey = "";
|
public string UserRecvKey = String.Empty;
|
||||||
|
|
||||||
public string DatabaseProvider = "";
|
public string SimSendKey = String.Empty;
|
||||||
|
public string SimRecvKey = String.Empty;
|
||||||
|
|
||||||
public static uint DefaultHttpPort = 8001;
|
public string DatabaseProvider = String.Empty;
|
||||||
public uint HttpPort = DefaultHttpPort;
|
|
||||||
|
|
||||||
public string AllowForcefulBanlines = "TRUE";
|
public static uint DefaultHttpPort = 8001;
|
||||||
|
public uint HttpPort = DefaultHttpPort;
|
||||||
private ConfigurationMember configMember;
|
|
||||||
|
public string AllowForcefulBanlines = "TRUE";
|
||||||
public GridConfig(string description, string filename)
|
|
||||||
{
|
private ConfigurationMember configMember;
|
||||||
configMember =
|
|
||||||
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
public GridConfig(string description, string filename)
|
||||||
configMember.performConfigurationRetrieve();
|
{
|
||||||
}
|
configMember =
|
||||||
|
new ConfigurationMember(filename, description, loadConfigurationOptions, handleIncomingConfiguration, true);
|
||||||
public void loadConfigurationOptions()
|
configMember.performConfigurationRetrieve();
|
||||||
{
|
}
|
||||||
configMember.addConfigurationOption("grid_owner",
|
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
public void loadConfigurationOptions()
|
||||||
"OGS Grid Owner", "OGS development team", false);
|
{
|
||||||
configMember.addConfigurationOption("default_asset_server",
|
configMember.addConfigurationOption("grid_owner",
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
"Default Asset Server URI",
|
"OGS Grid Owner", "OGS development team", false);
|
||||||
"http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/",
|
configMember.addConfigurationOption("default_asset_server",
|
||||||
false);
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
"Default Asset Server URI",
|
||||||
"Key to send to asset server", "null", false);
|
"http://127.0.0.1:" + AssetConfig.DefaultHttpPort.ToString() + "/",
|
||||||
configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
false);
|
||||||
"Key to expect from asset server", "null", false);
|
configMember.addConfigurationOption("asset_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
|
"Key to send to asset server", "null", false);
|
||||||
configMember.addConfigurationOption("default_user_server",
|
configMember.addConfigurationOption("asset_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
"Key to expect from asset server", "null", false);
|
||||||
"Default User Server URI",
|
|
||||||
"http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false);
|
configMember.addConfigurationOption("default_user_server",
|
||||||
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
|
||||||
"Key to send to user server", "null", false);
|
"Default User Server URI",
|
||||||
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
"http://127.0.0.1:" + UserConfig.DefaultHttpPort.ToString() + "/", false);
|
||||||
"Key to expect from user server", "null", false);
|
configMember.addConfigurationOption("user_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
|
"Key to send to user server", "null", false);
|
||||||
configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
configMember.addConfigurationOption("user_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"Key to send to a simulator", "null", false);
|
"Key to expect from user server", "null", false);
|
||||||
configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
|
||||||
"Key to expect from a simulator", "null", false);
|
configMember.addConfigurationOption("sim_send_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
"Key to send to a simulator", "null", false);
|
||||||
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
|
configMember.addConfigurationOption("sim_recv_key", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
|
"Key to expect from a simulator", "null", false);
|
||||||
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
configMember.addConfigurationOption("database_provider", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
"Http Listener port", DefaultHttpPort.ToString(), false);
|
"DLL for database provider", "OpenSim.Framework.Data.MySQL.dll", false);
|
||||||
|
|
||||||
configMember.addConfigurationOption("allow_forceful_banlines",
|
configMember.addConfigurationOption("http_port", ConfigurationOption.ConfigurationTypes.TYPE_UINT32,
|
||||||
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
"Http Listener port", DefaultHttpPort.ToString(), false);
|
||||||
"Allow Forceful Banlines", "TRUE", true);
|
|
||||||
}
|
configMember.addConfigurationOption("allow_forceful_banlines",
|
||||||
|
ConfigurationOption.ConfigurationTypes.TYPE_STRING,
|
||||||
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
"Allow Forceful Banlines", "TRUE", true);
|
||||||
{
|
}
|
||||||
switch (configuration_key)
|
|
||||||
{
|
public bool handleIncomingConfiguration(string configuration_key, object configuration_result)
|
||||||
case "grid_owner":
|
{
|
||||||
GridOwner = (string) configuration_result;
|
switch (configuration_key)
|
||||||
break;
|
{
|
||||||
case "default_asset_server":
|
case "grid_owner":
|
||||||
DefaultAssetServer = (string) configuration_result;
|
GridOwner = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "asset_send_key":
|
case "default_asset_server":
|
||||||
AssetSendKey = (string) configuration_result;
|
DefaultAssetServer = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "asset_recv_key":
|
case "asset_send_key":
|
||||||
AssetRecvKey = (string) configuration_result;
|
AssetSendKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "default_user_server":
|
case "asset_recv_key":
|
||||||
DefaultUserServer = (string) configuration_result;
|
AssetRecvKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "user_send_key":
|
case "default_user_server":
|
||||||
UserSendKey = (string) configuration_result;
|
DefaultUserServer = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "user_recv_key":
|
case "user_send_key":
|
||||||
UserRecvKey = (string) configuration_result;
|
UserSendKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "sim_send_key":
|
case "user_recv_key":
|
||||||
SimSendKey = (string) configuration_result;
|
UserRecvKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "sim_recv_key":
|
case "sim_send_key":
|
||||||
SimRecvKey = (string) configuration_result;
|
SimSendKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "database_provider":
|
case "sim_recv_key":
|
||||||
DatabaseProvider = (string) configuration_result;
|
SimRecvKey = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "http_port":
|
case "database_provider":
|
||||||
HttpPort = (uint) configuration_result;
|
DatabaseProvider = (string) configuration_result;
|
||||||
break;
|
break;
|
||||||
case "allow_forceful_banlines":
|
case "http_port":
|
||||||
AllowForcefulBanlines = (string) configuration_result;
|
HttpPort = (uint) configuration_result;
|
||||||
break;
|
break;
|
||||||
}
|
case "allow_forceful_banlines":
|
||||||
|
AllowForcefulBanlines = (string) configuration_result;
|
||||||
return true;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,44 +1,44 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
using System.Collections.Generic; // rex added
|
using System.Collections.Generic; // rex added
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public interface IAssetProvider : IPlugin
|
public interface IAssetProvider : IPlugin
|
||||||
{
|
{
|
||||||
AssetBase FetchAsset(LLUUID uuid);
|
AssetBase FetchAsset(LLUUID uuid);
|
||||||
void CreateAsset(AssetBase asset);
|
void CreateAsset(AssetBase asset);
|
||||||
void UpdateAsset(AssetBase asset);
|
void UpdateAsset(AssetBase asset);
|
||||||
bool ExistsAsset(LLUUID uuid);
|
bool ExistsAsset(LLUUID uuid);
|
||||||
void CommitAssets(); // force a sync to the database
|
void CommitAssets(); // force a sync to the database
|
||||||
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
||||||
List<AssetBase> GetAssetList(int vAssetType); // rex, added
|
List<AssetBase> GetAssetList(int vAssetType); // rex, added
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,61 +1,71 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Description of IAssetServer.
|
/// Description of IAssetServer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IAssetServer
|
public interface IAssetServer
|
||||||
{
|
{
|
||||||
void SetReceiver(IAssetReceiver receiver);
|
void SetReceiver(IAssetReceiver receiver);
|
||||||
void RequestAsset(LLUUID assetID, bool isTexture);
|
void RequestAsset(LLUUID assetID, bool isTexture);
|
||||||
void UpdateAsset(AssetBase asset);
|
void UpdateAsset(AssetBase asset);
|
||||||
void StoreAndCommitAsset(AssetBase asset);
|
void StoreAndCommitAsset(AssetBase asset);
|
||||||
void Close();
|
void Close();
|
||||||
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
LLUUID ExistsAsset(sbyte type, string name); // rex new function for "replace asset" functionality
|
||||||
bool ExistsAsset(LLUUID assetID); // rex added
|
bool ExistsAsset(LLUUID assetID); // rex added
|
||||||
List<AssetBase> GetAssetList(int vAssetType); // rex added
|
List<AssetBase> GetAssetList(int vAssetType); // rex added
|
||||||
AssetBase FetchAsset(LLUUID assetID); // rex added
|
AssetBase FetchAsset(LLUUID assetID); // rex added
|
||||||
}
|
}
|
||||||
|
|
||||||
// could change to delegate?
|
// could change to delegate?
|
||||||
public interface IAssetReceiver
|
public interface IAssetReceiver
|
||||||
{
|
{
|
||||||
void AssetReceived(AssetBase asset, bool IsTexture);
|
/// <summary>
|
||||||
void AssetNotFound(LLUUID assetID);
|
/// Call back made when a requested asset has been retrieved by an asset server
|
||||||
}
|
/// </summary>
|
||||||
|
/// <param name="asset"></param>
|
||||||
public interface IAssetPlugin
|
/// <param name="IsTexture"></param>
|
||||||
{
|
void AssetReceived(AssetBase asset, bool IsTexture);
|
||||||
IAssetServer GetAssetServer();
|
|
||||||
}
|
/// <summary>
|
||||||
}
|
/// Call back made when an asset server could not retrieve a requested asset
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetID"></param>
|
||||||
|
void AssetNotFound(LLUUID assetID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IAssetPlugin
|
||||||
|
{
|
||||||
|
IAssetServer GetAssetServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,53 +1,53 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This interface, describes a generic plugin
|
/// This interface, describes a generic plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IPlugin
|
public interface IPlugin
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the plugin version
|
/// Returns the plugin version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
|
/// <returns>Plugin version in MAJOR.MINOR.REVISION.BUILD format</returns>
|
||||||
string Version { get; }
|
string Version { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the plugin name
|
/// Returns the plugin name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Plugin name, eg MySQL User Provider</returns>
|
/// <returns>Plugin name, eg MySQL User Provider</returns>
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initialises the plugin (artificial constructor)
|
/// Initialises the plugin (artificial constructor)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void Initialise();
|
void Initialise();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,68 +1,71 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* * Redistributions of source code must retain the above copyright
|
* * Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
* * Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* * Neither the name of the OpenSim Project nor the
|
* * Neither the name of the OpenSim Project nor the
|
||||||
* names of its contributors may be used to endorse or promote products
|
* names of its contributors may be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
|
||||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using libsecondlife;
|
using libsecondlife;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
|
public delegate void ExpectUserDelegate(ulong regionHandle, AgentCircuitData agent);
|
||||||
|
|
||||||
public delegate void ExpectPrimDelegate(ulong regionHandle, LLUUID primID, string objData);
|
public delegate void ExpectPrimDelegate(ulong regionHandle, LLUUID primID, string objData);
|
||||||
|
|
||||||
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
|
public delegate void UpdateNeighbours(List<RegionInfo> neighbours);
|
||||||
|
|
||||||
public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
|
public delegate void AgentCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying);
|
||||||
|
|
||||||
public delegate void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical);
|
public delegate void PrimCrossing(ulong regionHandle, LLUUID primID, LLVector3 position, bool isPhysical);
|
||||||
|
|
||||||
public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
|
public delegate void AcknowledgeAgentCross(ulong regionHandle, LLUUID agentID);
|
||||||
|
|
||||||
public delegate void AcknowledgePrimCross(ulong regionHandle, LLUUID PrimID);
|
public delegate void AcknowledgePrimCross(ulong regionHandle, LLUUID PrimID);
|
||||||
|
|
||||||
public delegate void CloseAgentConnection(ulong regionHandle, LLUUID agentID);
|
public delegate bool CloseAgentConnection(ulong regionHandle, LLUUID agentID);
|
||||||
|
|
||||||
public delegate bool RegionUp(RegionInfo region);
|
public delegate bool RegionUp(RegionInfo region);
|
||||||
|
|
||||||
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
|
public delegate bool ChildAgentUpdate(ulong regionHandle, ChildAgentDataUpdate cAgentData);
|
||||||
|
|
||||||
|
|
||||||
public interface IRegionCommsListener
|
|
||||||
{
|
|
||||||
event ExpectUserDelegate OnExpectUser;
|
public interface IRegionCommsListener
|
||||||
event ExpectPrimDelegate OnExpectPrim;
|
{
|
||||||
event GenericCall2 OnExpectChildAgent;
|
event ExpectUserDelegate OnExpectUser;
|
||||||
event AgentCrossing OnAvatarCrossingIntoRegion;
|
event ExpectPrimDelegate OnExpectPrim;
|
||||||
event PrimCrossing OnPrimCrossingIntoRegion;
|
event GenericCall2 OnExpectChildAgent;
|
||||||
event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
event AgentCrossing OnAvatarCrossingIntoRegion;
|
||||||
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
event PrimCrossing OnPrimCrossingIntoRegion;
|
||||||
event UpdateNeighbours OnNeighboursUpdate;
|
event AcknowledgeAgentCross OnAcknowledgeAgentCrossed;
|
||||||
event CloseAgentConnection OnCloseAgentConnection;
|
event AcknowledgePrimCross OnAcknowledgePrimCrossed;
|
||||||
event RegionUp OnRegionUp;
|
event UpdateNeighbours OnNeighboursUpdate;
|
||||||
event ChildAgentUpdate OnChildAgentUpdate;
|
event CloseAgentConnection OnCloseAgentConnection;
|
||||||
}
|
event RegionUp OnRegionUp;
|
||||||
}
|
event ChildAgentUpdate OnChildAgentUpdate;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue