Formatting cleanup.

0.6.0-stable
Jeff Ames 2008-08-18 00:39:10 +00:00
parent 531f6c01eb
commit 6ef9d4da90
208 changed files with 2980 additions and 3163 deletions

View File

@ -56,8 +56,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
public string Version { get { return m_version; } } public string Version { get { return m_version; } }
public string Name { get { return m_name; } } public string Name { get { return m_name; } }
public void Initialise() public void Initialise()
{ {
m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!"); m_log.Info("[RADMIN]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -512,7 +512,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try try
{ {
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
// check completeness // check completeness
checkStringParameters(request, new string[] { "password", "user_firstname", checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname", "user_password" }); "user_lastname", "user_password" });
@ -603,7 +603,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
try try
{ {
Hashtable requestData = (Hashtable) request.Params[0]; Hashtable requestData = (Hashtable) request.Params[0];
// check completeness // check completeness
checkStringParameters(request, new string[] { "password", "user_firstname", checkStringParameters(request, new string[] { "password", "user_firstname",
"user_lastname" }); "user_lastname" });
@ -616,7 +616,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
string firstname = (string) requestData["user_firstname"]; string firstname = (string) requestData["user_firstname"];
string lastname = (string) requestData["user_lastname"]; string lastname = (string) requestData["user_lastname"];
string passwd = String.Empty; string passwd = String.Empty;
uint? regX = null; uint? regX = null;
uint? regY = null; uint? regY = null;
@ -632,7 +632,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
if (null == userProfile) if (null == userProfile)
throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname)); throw new Exception(String.Format("avatar {0} {1} does not exist", firstname, lastname));
if (null != passwd) if (null != passwd)
{ {
string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty); string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(passwd) + ":" + String.Empty);
userProfile.PasswordHash = md5PasswdHash; userProfile.PasswordHash = md5PasswdHash;
@ -648,7 +648,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
response.Value = responseData; response.Value = responseData;
m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname, m_log.InfoFormat("[RADMIN]: UpdateUserAccount: account for user {0} {1} updated, UUID {2}", firstname, lastname,
userProfile.ID); userProfile.ID);
} }
catch (Exception e) catch (Exception e)

View File

@ -23,7 +23,6 @@
* 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;
@ -44,14 +43,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This class represents the current REST request. It /// This class represents the current REST request. It
/// encapsulates the request/response state and takes care /// encapsulates the request/response state and takes care
/// of response generation without exposing the REST handler /// of response generation without exposing the REST handler
/// to the actual mechanisms involved. /// to the actual mechanisms involved.
/// ///
/// This structure is created on entry to the Handler /// This structure is created on entry to the Handler
/// method and is disposed of upon return. It is part of /// method and is disposed of upon return. It is part of
/// the plug-in infrastructure, rather than the functionally /// the plug-in infrastructure, rather than the functionally
/// specific REST handler, and fundamental changes to /// specific REST handler, and fundamental changes to
/// this should be reflected in the Rest HandlerVersion. The /// this should be reflected in the Rest HandlerVersion. The
/// object is instantiated, and may be extended by, any /// object is instantiated, and may be extended by, any
/// given handler. See the inventory handler for an example /// given handler. See the inventory handler for an example
@ -100,7 +99,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal bool chunked = false; internal bool chunked = false;
// Authentication related state // Authentication related state
internal bool authenticated = false; internal bool authenticated = false;
// internal string scheme = Rest.AS_DIGEST; // internal string scheme = Rest.AS_DIGEST;
// internal string scheme = Rest.AS_BASIC; // internal string scheme = Rest.AS_BASIC;
@ -132,7 +131,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private static readonly string[] EmptyPath = { String.Empty }; private static readonly string[] EmptyPath = { String.Empty };
// Session related tables. These are only needed if QOP is set to "auth-sess" // Session related tables. These are only needed if QOP is set to "auth-sess"
// and for now at least, it is not. Session related authentication is of // and for now at least, it is not. Session related authentication is of
// questionable merit in the context of REST anyway, but it is, arguably, more // questionable merit in the context of REST anyway, but it is, arguably, more
// secure. // secure.
@ -148,27 +147,27 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*", private static Regex schema = new Regex("^\\s*(?<scheme>\\w+)\\s*.*",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*", private static Regex basicParms = new Regex("^\\s*(?:\\w+)\\s+(?<pval>\\S+)\\s*",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"", private static Regex digestParm1 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*\"(?<pval>[^\"]+)\"",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)", private static Regex digestParm2 = new Regex("\\s*(?<parm>\\w+)\\s*=\\s*(?<pval>[^\\p{P}\\s]+)",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)", private static Regex reuserPass = new Regex("(?<user>[^:]+):(?<pass>[\\S\\s]*)",
RegexOptions.Compiled | RegexOptions.IgnoreCase); RegexOptions.Compiled | RegexOptions.IgnoreCase);
// For efficiency, we create static instances of these objects // For efficiency, we create static instances of these objects
private static MD5 md5hash = MD5.Create(); private static MD5 md5hash = MD5.Create();
private static StringComparer sc = StringComparer.OrdinalIgnoreCase; private static StringComparer sc = StringComparer.OrdinalIgnoreCase;
// Constructor // Constructor
internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix)
{ {
@ -203,7 +202,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal bool IsAuthenticated internal bool IsAuthenticated
{ {
get get
{ {
if (Rest.Authenticate) if (Rest.Authenticate)
{ {
if (!authenticated) if (!authenticated)
@ -223,7 +222,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// Realm, domain, etc. /// Realm, domain, etc.
/// ///
/// This method checks to see if the current request is already /// This method checks to see if the current request is already
/// authenticated for this domain. If it is, then it returns /// authenticated for this domain. If it is, then it returns
/// true. If it is not, then it issues a challenge to the client /// true. If it is not, then it issues a challenge to the client
/// and responds negatively to the request. /// and responds negatively to the request.
/// </summary> /// </summary>
@ -243,7 +242,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId); Rest.Log.DebugFormat("{0} Challenge reason: No authorization data", MsgId);
DoChallenge(); DoChallenge();
} }
// So, we have authentication data, now we have to check to // So, we have authentication data, now we have to check to
// see what we got and whether or not it is valid for the // see what we got and whether or not it is valid for the
// current domain. To do this we need to interpret the data // current domain. To do this we need to interpret the data
@ -327,7 +326,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add("response",m.Groups["pval"].Value); authparms.Add("response",m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} Parameter matched : {1} = {2}",
MsgId, "response", m.Groups["pval"].Value); MsgId, "response", m.Groups["pval"].Value);
} }
@ -369,7 +368,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} String Parameter matched : {1} = {2}",
MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value);
} }
@ -380,7 +379,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (Match m in matches) foreach (Match m in matches)
{ {
authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value); authparms.Add(m.Groups["parm"].Value,m.Groups["pval"].Value);
Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}", Rest.Log.DebugFormat("{0} Tokenized Parameter matched : {1} = {2}",
MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value); MsgId, m.Groups["parm"].Value,m.Groups["pval"].Value);
} }
@ -417,7 +416,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.TryGetValue("nonce", out nonce) || nonce == null) if (!authparms.TryGetValue("nonce", out nonce) || nonce == null)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: nonce missing", MsgId);
break; break;
} }
@ -428,7 +427,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (temp != opaque) if (temp != opaque)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad opaque value", MsgId);
break; break;
} }
} }
@ -440,7 +439,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (temp != algorithm) if (temp != algorithm)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad algorithm value", MsgId);
break; break;
} }
} }
@ -457,7 +456,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.ContainsKey("cnonce")) if (!authparms.ContainsKey("cnonce"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: cnonce missing", MsgId);
break; break;
} }
@ -465,7 +464,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!authparms.TryGetValue("nc", out nck) || nck == null) if (!authparms.TryGetValue("nc", out nck) || nck == null)
{ {
Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: cnonce counter missing", MsgId);
break; break;
} }
@ -477,7 +476,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck)) if (Rest.Hex2Int(ncl) >= Rest.Hex2Int(nck))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: bad cnonce counter", MsgId);
break; break;
} }
cntable[nonce] = nck; cntable[nonce] = nck;
@ -497,12 +496,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// these MUST NOT be present. // these MUST NOT be present.
if (authparms.ContainsKey("cnonce")) if (authparms.ContainsKey("cnonce"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce", MsgId);
break; break;
} }
if (authparms.ContainsKey("nc")) if (authparms.ContainsKey("nc"))
{ {
Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId); Rest.Log.WarnFormat("{0} Authentication failed: invalid cnonce counter[2]", MsgId);
break; break;
} }
} }
@ -511,7 +510,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response);
} }
while (false); while (false);
} }
@ -608,7 +607,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// We don;t know the userid that will be used // We don;t know the userid that will be used
// so we cannot make any authentication domain // so we cannot make any authentication domain
// assumptions. So the prefix will determine // assumptions. So the prefix will determine
// this. // this.
@ -624,7 +623,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
/// <summary> /// <summary>
/// This method provides validation in support of the BASIC /// This method provides validation in support of the BASIC
/// authentication method. This is not normaly expected to be /// authentication method. This is not normaly expected to be
/// used, but is included for completeness (and because I tried /// used, but is included for completeness (and because I tried
/// it first). /// it first).
@ -650,11 +649,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This mechanism is used by the digest authetnication mechanism /// This mechanism is used by the digest authetnication mechanism
/// to return the user's password. In fact, because the OpenSim /// to return the user's password. In fact, because the OpenSim
/// user's passwords are already hashed, and the HTTP mechanism /// user's passwords are already hashed, and the HTTP mechanism
/// does not supply an open password, the hashed passwords cannot /// does not supply an open password, the hashed passwords cannot
/// be used unless the cliemt has used the same salting mechanism /// be used unless the cliemt has used the same salting mechanism
/// to has the password before using it in the authentication /// to has the password before using it in the authentication
/// algorithn. This is not inconceivable... /// algorithm. This is not inconceivable...
/// </summary> /// </summary>
private string getPassword(string user) private string getPassword(string user)
@ -665,12 +664,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string last; string last;
// Distinguish the parts, if necessary // Distinguish the parts, if necessary
if ((x=user.IndexOf(Rest.C_SPACE)) != -1) if ((x=user.IndexOf(Rest.C_SPACE)) != -1)
{ {
first = user.Substring(0,x); first = user.Substring(0,x);
last = user.Substring(x+1); last = user.Substring(x+1);
} }
else else
{ {
first = user; first = user;
@ -712,12 +711,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string last; string last;
// Distinguish the parts, if necessary // Distinguish the parts, if necessary
if ((x=user.IndexOf(Rest.C_SPACE)) != -1) if ((x=user.IndexOf(Rest.C_SPACE)) != -1)
{ {
first = user.Substring(0,x); first = user.Substring(0,x);
last = user.Substring(x+1); last = user.Substring(x+1);
} }
else else
{ {
first = user; first = user;
@ -733,9 +732,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
HA1 = HashToString(pass); HA1 = HashToString(pass);
HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
return (0 == sc.Compare(HA1, udata.PasswordHash)); return (0 == sc.Compare(HA1, udata.PasswordHash));
} }
// Validate the request-digest // Validate the request-digest
@ -784,7 +783,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
HA2 = HashToString(patt); HA2 = HashToString(patt);
// Generate Digest // Generate Digest
if (qop != String.Empty) if (qop != String.Empty)
{ {
patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2); patt = String.Format("{0}:{1}:{2}:{3}:{4}:{5}", HA1, nonce, nck, cnonce, qop, HA2);
@ -856,7 +855,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Fail(code, message, true); Fail(code, message, true);
} }
// More adventurous. This failure also includes a // More adventurous. This failure also includes a
// specified entity. // specified entity.
internal void Fail(int code, string message, string data) internal void Fail(int code, string message, string data)
@ -899,7 +898,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
fail = true; fail = true;
Respond("Failure response"); Respond("Failure response");
RestException re = new RestException(message+" <"+code+">"); RestException re = new RestException(message+" <"+code+">");
re.statusCode = code; re.statusCode = code;
@ -918,7 +917,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Fail(Rest.HttpStatusCodeNotImplemented, Rest.HttpStatusDescNotImplemented); Fail(Rest.HttpStatusCodeNotImplemented, Rest.HttpStatusDescNotImplemented);
} }
// This MUST be called by an agent handler before it returns // This MUST be called by an agent handler before it returns
// control to Handle, otherwise the request will be ignored. // control to Handle, otherwise the request will be ignored.
// This is called implciitly for the REST stream handlers and // This is called implciitly for the REST stream handlers and
// is harmless if it is called twice. // is harmless if it is called twice.
@ -962,7 +961,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} XML Response handler extension EXIT", MsgId); Rest.Log.DebugFormat("{0} XML Response handler extension EXIT", MsgId);
} }
// If buffer != null, then we assume that // If buffer != null, then we assume that
// this has already been done some other // this has already been done some other
// way. For example, transfer encoding might // way. For example, transfer encoding might
// have been done. // have been done.
@ -997,7 +996,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// Set the status code & description. If nothing has been stored, // Set the status code & description. If nothing has been stored,
// we consider that a success. // we consider that a success.
if (statusCode == 0) if (statusCode == 0)
@ -1011,7 +1010,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// For a redirect we need to set the relocation header accordingly // For a redirect we need to set the relocation header accordingly
if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect || if (response.StatusCode == (int) Rest.HttpStatusCodeTemporaryRedirect ||
response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect) response.StatusCode == (int) Rest.HttpStatusCodePermanentRedirect)
{ {
Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation); Rest.Log.DebugFormat("{0} Re-direct location is {1}", MsgId, redirectLocation);
@ -1031,7 +1030,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// We've left the setting of handled' until the // We've left the setting of handled' until the
// last minute because the header settings included // last minute because the header settings included
// above are pretty harmless. But everything from // above are pretty harmless. But everything from
// here on down probably leaves the response // here on down probably leaves the response
// element unusable by anyone else. // element unusable by anyone else.
handled = true; handled = true;
@ -1046,7 +1045,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (buffer != null && buffer.Length != 0) if (buffer != null && buffer.Length != 0)
{ {
Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>", Rest.Log.DebugFormat("{0} Entity buffer, length = {1} : <{2}>",
MsgId, buffer.Length, encoding.GetString(buffer)); MsgId, buffer.Length, encoding.GetString(buffer));
response.OutputStream.Write(buffer, 0, buffer.Length); response.OutputStream.Write(buffer, 0, buffer.Length);
} }
@ -1066,17 +1065,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Add a header to the table. We need to allow // Add a header to the table. We need to allow
// multiple instances of many of the headers. // multiple instances of many of the headers.
// If the // If the
internal void AddHeader(string hdr, string data) internal void AddHeader(string hdr, string data)
{ {
if (Rest.DEBUG) if (Rest.DEBUG)
{ {
Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>",
MsgId, hdr, data); MsgId, hdr, data);
if (response.Headers.Get(hdr) != null) if (response.Headers.Get(hdr) != null)
{ {
Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>",
MsgId, hdr); MsgId, hdr);
} }
} }
@ -1093,7 +1092,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr);
if (response.Headers.Get(hdr) == null) if (response.Headers.Get(hdr) == null)
{ {
Rest.Log.DebugFormat("{0} No such header existed", Rest.Log.DebugFormat("{0} No such header existed",
MsgId, hdr); MsgId, hdr);
} }
} }
@ -1110,7 +1109,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
for (int i=0;i<response.Headers.Count;i++) for (int i=0;i<response.Headers.Count;i++)
{ {
Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i,
response.Headers.Get(i)); response.Headers.Get(i));
} }
} }
@ -1144,7 +1143,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// If we succeeded in getting a path, perform any // If we succeeded in getting a path, perform any
// additional pre-processing required. // additional pre-processing required.
if (path != null) if (path != null)
{ {
if (Rest.ExtendedEscape) if (Rest.ExtendedEscape)
{ {
@ -1182,14 +1181,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
parameters = new string[0]; parameters = new string[0];
} }
// Generate a debug list of the decoded parameters // Generate a debug list of the decoded parameters
if (Rest.DEBUG && prfxlen < path.Length-1) if (Rest.DEBUG && prfxlen < path.Length-1)
{ {
Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen)); Rest.Log.DebugFormat("{0} URI: Parameters: {1}", MsgId, path.Substring(prfxlen));
for (int i = 0; i < parameters.Length; i++) for (int i = 0; i < parameters.Length; i++)
{ {
Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]); Rest.Log.DebugFormat("{0} Parameter[{1}]: {2}", MsgId, i, parameters[i]);
} }
} }
@ -1197,11 +1196,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
return parameters.Length; return parameters.Length;
} }
internal string[] PathNodes internal string[] PathNodes
{ {
get get
{ {
if (pathNodes == null) if (pathNodes == null)
{ {
initUrl(); initUrl();
@ -1209,10 +1208,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
return pathNodes; return pathNodes;
} }
} }
internal string BuildUrl(int first, int last) internal string BuildUrl(int first, int last)
{ {
if (pathNodes == null) if (pathNodes == null)
{ {
initUrl(); initUrl();

View File

@ -23,7 +23,7 @@
* 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;
@ -42,7 +42,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public class Rest public class Rest
{ {
internal static readonly log4net.ILog Log = internal static readonly log4net.ILog Log =
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
internal static bool DEBUG = Log.IsDebugEnabled; internal static bool DEBUG = Log.IsDebugEnabled;
@ -106,7 +106,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// supported by all servers. See Respond /// supported by all servers. See Respond
/// to see how these are handled. /// to see how these are handled.
/// </summary> /// </summary>
// REST AGENT 1.0 interpretations // REST AGENT 1.0 interpretations
public const string GET = "get"; // information retrieval - server state unchanged public const string GET = "get"; // information retrieval - server state unchanged
public const string HEAD = "head"; // same as get except only the headers are returned. public const string HEAD = "head"; // same as get except only the headers are returned.
@ -138,7 +138,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public static readonly char C_PERIOD = '.'; public static readonly char C_PERIOD = '.';
public static readonly char C_COMMA = ','; public static readonly char C_COMMA = ',';
public static readonly char C_DQUOTE = '"'; public static readonly char C_DQUOTE = '"';
public static readonly string CS_SPACE = " "; public static readonly string CS_SPACE = " ";
public static readonly string CS_SLASH = "/"; public static readonly string CS_SLASH = "/";
public static readonly string CS_PATHSEP = "/"; public static readonly string CS_PATHSEP = "/";
@ -147,7 +147,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public static readonly string CS_PERIOD = "."; public static readonly string CS_PERIOD = ".";
public static readonly string CS_COMMA = ","; public static readonly string CS_COMMA = ",";
public static readonly string CS_DQUOTE = "\""; public static readonly string CS_DQUOTE = "\"";
public static readonly char[] CA_SPACE = { C_SPACE }; public static readonly char[] CA_SPACE = { C_SPACE };
public static readonly char[] CA_SLASH = { C_SLASH }; public static readonly char[] CA_SLASH = { C_SLASH };
public static readonly char[] CA_PATHSEP = { C_PATHSEP }; public static readonly char[] CA_PATHSEP = { C_PATHSEP };
@ -311,7 +311,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public const string AS_DIGEST = "Digest"; public const string AS_DIGEST = "Digest";
/// Supported Digest algorithms /// Supported Digest algorithms
public const string Digest_MD5 = "MD5"; // assumedd efault if omitted public const string Digest_MD5 = "MD5"; // assumedd efault if omitted
public const string Digest_MD5Sess = "MD5-sess"; public const string Digest_MD5Sess = "MD5-sess";
@ -359,7 +359,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
int val = 0; int val = 0;
int sum = 0; int sum = 0;
string tmp = null; string tmp = null;
if (hex != null) if (hex != null)
{ {
tmp = hex.ToLower(); tmp = hex.ToLower();
@ -446,20 +446,20 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (i % 4 == 0) Console.Write(" "); if (i % 4 == 0) Console.Write(" ");
// if (i%16 == 0) Console.Write(" "); // if (i%16 == 0) Console.Write(" ");
Console.Write(" "); Console.Write(" ");
buffer[i % Rest.DumpLineSize] = ' '; buffer[i % Rest.DumpLineSize] = ' ';
} }
Console.WriteLine(" |"+(new String(buffer))+"|"); Console.WriteLine(" |"+(new String(buffer))+"|");
} }
else else
{ {
Console.Write("\n"); Console.Write("\n");
} }
} }
} }
// Local exception type // Local exception type
public class RestException : Exception public class RestException : Exception
@ -470,8 +470,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal string httpmethod; internal string httpmethod;
internal string httppath; internal string httppath;
public RestException(string msg) : base(msg) public RestException(string msg) : base(msg)
{ {
} }
} }

View File

@ -23,7 +23,6 @@
* 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;
@ -40,10 +39,8 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class RestAssetServices : IRest public class RestAssetServices : IRest
{ {
private bool enabled = false; private bool enabled = false;
private string qPrefix = "assets"; private string qPrefix = "assets";
@ -52,7 +49,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public RestAssetServices() public RestAssetServices()
{ {
Rest.Log.InfoFormat("{0} Asset services initializing", MsgId); Rest.Log.InfoFormat("{0} Asset services initializing", MsgId);
Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version);
@ -73,7 +69,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
enabled = true; enabled = true;
Rest.Log.InfoFormat("{0} Asset services initialization complete", MsgId); Rest.Log.InfoFormat("{0} Asset services initialization complete", MsgId);
} }
// Post-construction, pre-enabled initialization opportunity // Post-construction, pre-enabled initialization opportunity
@ -84,7 +79,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
// Called by the plug-in to halt REST processing. Local processing is // Called by the plug-in to halt REST processing. Local processing is
// disabled, and control blocks until all current processing has // disabled, and control blocks until all current processing has
// completed. No new processing will be started // completed. No new processing will be started
public void Close() public void Close()
@ -111,14 +106,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoAsset(RequestData rparm) private void DoAsset(RequestData rparm)
{ {
if (!enabled)
if (!enabled) return; return;
AssetRequestData rdata = (AssetRequestData) rparm; AssetRequestData rdata = (AssetRequestData) rparm;
Rest.Log.DebugFormat("{0} REST Asset handler ENTRY", MsgId); Rest.Log.DebugFormat("{0} REST Asset handler ENTRY", MsgId);
// Now that we know this is a serious attempt to // Now that we know this is a serious attempt to
// access inventory data, we should find out who // access inventory data, we should find out who
// is asking, and make sure they are authorized // is asking, and make sure they are authorized
// to do so. We need to validate the caller's // to do so. We need to validate the caller's
@ -129,9 +124,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// With the present HTTP server we can't use the // With the present HTTP server we can't use the
// builtin authentication mechanisms because they // builtin authentication mechanisms because they
// would be enforced for all in-bound requests. // would be enforced for all in-bound requests.
// Instead we look at the headers ourselves and // Instead we look at the headers ourselves and
// handle authentication directly. // handle authentication directly.
try try
{ {
if (!rdata.IsAuthenticated) if (!rdata.IsAuthenticated)
@ -144,13 +139,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (e.statusCode == Rest.HttpStatusCodeNotAuthorized) if (e.statusCode == Rest.HttpStatusCodeNotAuthorized)
{ {
Rest.Log.WarnFormat("{0} User not authenticated", MsgId); Rest.Log.WarnFormat("{0} User not authenticated", MsgId);
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId,
rdata.request.Headers.Get("Authorization")); rdata.request.Headers.Get("Authorization"));
} }
else else
{ {
Rest.Log.ErrorFormat("{0} User authentication failed", MsgId); Rest.Log.ErrorFormat("{0} User authentication failed", MsgId);
Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId, Rest.Log.DebugFormat("{0} Authorization header: {1}", MsgId,
rdata.request.Headers.Get("Authorization")); rdata.request.Headers.Get("Authorization"));
} }
throw (e); throw (e);
@ -173,7 +168,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
case "post" : case "post" :
case "delete" : case "delete" :
default : default :
Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}", Rest.Log.WarnFormat("{0} Asset: Method not supported: {1}",
MsgId, rdata.method); MsgId, rdata.method);
rdata.Fail(Rest.HttpStatusCodeBadRequest, rdata.Fail(Rest.HttpStatusCodeBadRequest,
Rest.HttpStatusDescBadRequest); Rest.HttpStatusDescBadRequest);
@ -194,7 +189,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoGet(AssetRequestData rdata) private void DoGet(AssetRequestData rdata)
{ {
bool istexture = false; bool istexture = false;
Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method); Rest.Log.DebugFormat("{0} REST Asset handler, Method = <{1}> ENTRY", MsgId, rdata.method);
@ -204,13 +198,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (rdata.parameters.Length == 1) if (rdata.parameters.Length == 1)
{ {
LLUUID uuid = new LLUUID(rdata.parameters[0]); LLUUID uuid = new LLUUID(rdata.parameters[0]);
AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture); AssetBase asset = Rest.AssetServices.GetAsset(uuid, istexture);
if (asset != null) if (asset != null)
{ {
Rest.Log.DebugFormat("{0} Asset located <{1}>", MsgId, rdata.parameters[0]); Rest.Log.DebugFormat("{0} Asset located <{1}>", MsgId, rdata.parameters[0]);
rdata.initXmlWriter(); rdata.initXmlWriter();
@ -227,19 +219,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length); rdata.writer.WriteBase64(asset.Data,0,asset.Data.Length);
rdata.writer.WriteFullEndElement(); rdata.writer.WriteFullEndElement();
} }
else else
{ {
Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path); Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path);
rdata.Fail(Rest.HttpStatusCodeNotFound, rdata.Fail(Rest.HttpStatusCodeNotFound,
Rest.HttpStatusDescNotFound); Rest.HttpStatusDescNotFound);
} }
} }
rdata.Complete(); rdata.Complete();
rdata.Respond("Asset " + rdata.method + ": Normal completion"); rdata.Respond("Asset " + rdata.method + ": Normal completion");
} }
private void DoPut(AssetRequestData rdata) private void DoPut(AssetRequestData rdata)
@ -257,7 +247,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!xml.ReadToFollowing("Asset")) if (!xml.ReadToFollowing("Asset"))
{ {
Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path); Rest.Log.DebugFormat("{0} Invalid request data: <{1}>", MsgId, rdata.path);
rdata.Fail(Rest.HttpStatusCodeBadRequest, rdata.Fail(Rest.HttpStatusCodeBadRequest,
Rest.HttpStatusDescBadRequest); Rest.HttpStatusDescBadRequest);
} }
@ -275,13 +265,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
else else
{ {
Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path); Rest.Log.DebugFormat("{0} Invalid parameters: <{1}>", MsgId, rdata.path);
rdata.Fail(Rest.HttpStatusCodeNotFound, rdata.Fail(Rest.HttpStatusCodeNotFound,
Rest.HttpStatusDescNotFound); Rest.HttpStatusDescNotFound);
} }
rdata.Complete(); rdata.Complete();
rdata.Respond("Asset " + rdata.method + ": Normal completion"); rdata.Respond("Asset " + rdata.method + ": Normal completion");
} }
internal class AssetRequestData : RequestData internal class AssetRequestData : RequestData
@ -291,6 +280,5 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
} }
} }
} }
} }

View File

@ -23,7 +23,6 @@
* 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;
@ -37,7 +36,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class RestHandler : RestPlugin, IHttpAgentHandler public class RestHandler : RestPlugin, IHttpAgentHandler
{ {
/// <remarks> /// <remarks>
/// The handler delegates are not noteworthy. The allocator allows /// The handler delegates are not noteworthy. The allocator allows
/// a given handler to optionally subclass the base RequestData /// a given handler to optionally subclass the base RequestData
@ -66,10 +64,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This static initializer scans the ASSEMBLY for classes that /// This static initializer scans the ASSEMBLY for classes that
/// export the IRest interface and builds a list of them. These /// export the IRest interface and builds a list of them. These
/// are later activated by the handler. To add a new handler it /// are later activated by the handler. To add a new handler it
/// is only necessary to create a new services class that implements /// is only necessary to create a new services class that implements
/// the IRest interface, and recompile the handler. This gives /// the IRest interface, and recompile the handler. This gives
/// all of the build-time flexibility of a modular approach /// all of the build-time flexibility of a modular approach
/// while not introducing yet-another module loader. Note that /// while not introducing yet-another module loader. Note that
/// multiple assembles can still be built, each with its own set /// multiple assembles can still be built, each with its own set
/// of handlers. Examples of services classes are RestInventoryServices /// of handlers. Examples of services classes are RestInventoryServices
@ -78,13 +76,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
static RestHandler() static RestHandler()
{ {
Module[] mods = Assembly.GetExecutingAssembly().GetModules(); Module[] mods = Assembly.GetExecutingAssembly().GetModules();
foreach (Module m in mods) foreach (Module m in mods)
{ {
Type[] types = m.GetTypes(); Type[] types = m.GetTypes();
foreach (Type t in types) foreach (Type t in types)
{ {
try try
{ {
@ -100,7 +97,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
} }
} }
} }
#endregion local static state #endregion local static state
@ -109,13 +105,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
/// <summary> /// <summary>
/// This routine loads all of the handlers discovered during /// This routine loads all of the handlers discovered during
/// instance initialization. /// instance initialization.
/// A table of all loaded and successfully constructed handlers /// A table of all loaded and successfully constructed handlers
/// is built, and this table is then used by the constructor to /// is built, and this table is then used by the constructor to
/// initialize each of the handlers in turn. /// initialize each of the handlers in turn.
/// NOTE: The loading process does not automatically imply that /// NOTE: The loading process does not automatically imply that
/// the handler has registered any kind of an interface, that /// the handler has registered any kind of an interface, that
/// may be (optionally) done by the handler either during /// may be (optionally) done by the handler either during
/// construction, or during initialization. /// construction, or during initialization.
/// ///
/// I was not able to make this code work within a constructor /// I was not able to make this code work within a constructor
@ -128,7 +124,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (!handlersLoaded) if (!handlersLoaded)
{ {
ConstructorInfo ci; ConstructorInfo ci;
Object ht; Object ht;
@ -159,8 +154,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Name is used to differentiate the message header. // Name is used to differentiate the message header.
public override string Name public override string Name
{ {
get { return "HANDLER"; } get { return "HANDLER"; }
} }
@ -173,7 +168,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// We have to rename these because we want // We have to rename these because we want
// to be able to share the values with other // to be able to share the values with other
// classes in our assembly and the base // classes in our assembly and the base
// names are protected. // names are protected.
internal string MsgId internal string MsgId
@ -203,7 +198,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
try try
{ {
// This plugin will only be enabled if the broader // This plugin will only be enabled if the broader
// REST plugin mechanism is enabled. // REST plugin mechanism is enabled.
@ -214,7 +208,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// IsEnabled is implemented by the base class and // IsEnabled is implemented by the base class and
// reflects an overall RestPlugin status // reflects an overall RestPlugin status
if (!IsEnabled) if (!IsEnabled)
{ {
Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId); Rest.Log.WarnFormat("{0} Plugins are disabled", MsgId);
return; return;
@ -263,15 +257,15 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.DumpLineSize); Rest.DumpLineSize);
} }
// Load all of the handlers present in the // Load all of the handlers present in the
// assembly // assembly
// In principle, as we're an application plug-in, // In principle, as we're an application plug-in,
// most of what needs to be done could be done using // most of what needs to be done could be done using
// static resources, however the Open Sim plug-in // static resources, however the Open Sim plug-in
// model makes this an instance, so that's what we // model makes this an instance, so that's what we
// need to be. // need to be.
// There is only one Communications manager per // There is only one Communications manager per
// server, and by inference, only one each of the // server, and by inference, only one each of the
// user, asset, and inventory servers. So we can cache // user, asset, and inventory servers. So we can cache
// those using a static initializer. // those using a static initializer.
@ -314,13 +308,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message); Rest.Log.ErrorFormat("{0} Plugin initialization has failed: {1}", MsgId, e.Message);
} }
} }
/// <summary> /// <summary>
/// In the interests of efficiency, and because we cannot determine whether /// In the interests of efficiency, and because we cannot determine whether
/// or not this instance will actually be harvested, we clobber the only /// or not this instance will actually be harvested, we clobber the only
/// anchoring reference to the working state for this plug-in. What the /// anchoring reference to the working state for this plug-in. What the
/// call to close does is irrelevant to this class beyond knowing that it /// call to close does is irrelevant to this class beyond knowing that it
/// can nullify the reference when it returns. /// can nullify the reference when it returns.
/// To make sure everything is copacetic we make sure the primary interface /// To make sure everything is copacetic we make sure the primary interface
@ -329,7 +322,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public override void Close() public override void Close()
{ {
Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId); Rest.Log.InfoFormat("{0} Plugin is terminating", MsgId);
try try
@ -337,12 +329,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
RemoveAgentHandler(Rest.Name, this); RemoveAgentHandler(Rest.Name, this);
} }
catch (KeyNotFoundException){} catch (KeyNotFoundException){}
foreach (IRest handler in handlers) foreach (IRest handler in handlers)
{ {
handler.Close(); handler.Close();
} }
} }
#endregion overriding methods #endregion overriding methods
@ -380,7 +371,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
return true; return true;
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
@ -414,7 +404,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
for (int i = 0; i < request.Headers.Count; i++) for (int i = 0; i < request.Headers.Count; i++)
{ {
Rest.Log.DebugFormat("{0} Header [{1}] : <{2}> = <{3}>", Rest.Log.DebugFormat("{0} Header [{1}] : <{2}> = <{3}>",
MsgId, i, request.Headers.GetKey(i), request.Headers.Get(i)); MsgId, i, request.Headers.GetKey(i), request.Headers.Get(i));
} }
Rest.Log.DebugFormat("{0} URI: {1}", MsgId, request.RawUrl); Rest.Log.DebugFormat("{0} URI: {1}", MsgId, request.RawUrl);
@ -425,8 +415,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
try try
{ {
handled = ( FindPathHandler(request, response) || handled = FindPathHandler(request, response) ||
FindStreamHandler(request, response) ); FindStreamHandler(request, response);
} }
catch (Exception e) catch (Exception e)
{ {
@ -440,7 +430,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} EXIT", MsgId); Rest.Log.DebugFormat("{0} EXIT", MsgId);
return handled; return handled;
} }
#endregion interface methods #endregion interface methods
@ -488,7 +477,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return rdata.handled; return rdata.handled;
} }
/// <summary> /// <summary>
@ -501,13 +489,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public void AddStreamHandler(string httpMethod, string path, RestMethod method) public void AddStreamHandler(string httpMethod, string path, RestMethod method)
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
return; return;
} }
if (!path.StartsWith(Rest.Prefix)) if (!path.StartsWith(Rest.Prefix))
{ {
path = String.Format("{0}{1}", Rest.Prefix, path); path = String.Format("{0}{1}", Rest.Prefix, path);
} }
@ -525,7 +512,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.WarnFormat("{0} Ignoring duplicate handler for {1}", MsgId, path); Rest.Log.WarnFormat("{0} Ignoring duplicate handler for {1}", MsgId, path);
} }
} }
/// <summary> /// <summary>
@ -540,10 +526,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response) internal bool FindPathHandler(OSHttpRequest request, OSHttpResponse response)
{ {
RequestData rdata = null; RequestData rdata = null;
string bestMatch = null; string bestMatch = null;
if (!IsEnabled) if (!IsEnabled)
{ {
return false; return false;
@ -566,7 +551,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!String.IsNullOrEmpty(bestMatch)) if (!String.IsNullOrEmpty(bestMatch))
{ {
rdata = pathAllocators[bestMatch](request, response); rdata = pathAllocators[bestMatch](request, response);
Rest.Log.DebugFormat("{0} Path based REST handler matched with <{1}>", MsgId, bestMatch); Rest.Log.DebugFormat("{0} Path based REST handler matched with <{1}>", MsgId, bestMatch);
@ -575,7 +559,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
pathHandlers[bestMatch](rdata); pathHandlers[bestMatch](rdata);
} }
// A plugin generated error indicates a request-related error // A plugin generated error indicates a request-related error
// that has been handled by the plugin. // that has been handled by the plugin.
@ -583,11 +567,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Rest.Log.WarnFormat("{0} Request failed: {1}", MsgId, r.Message); Rest.Log.WarnFormat("{0} Request failed: {1}", MsgId, r.Message);
} }
} }
return (rdata == null) ? false : rdata.handled; return (rdata == null) ? false : rdata.handled;
} }
/// <summary> /// <summary>
@ -597,7 +579,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra) internal void AddPathHandler(RestMethodHandler mh, string path, RestMethodAllocator ra)
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
return; return;
@ -619,8 +600,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
pathHandlers.Add(path, mh); pathHandlers.Add(path, mh);
pathAllocators.Add(path, ra); pathAllocators.Add(path, ra);
} }
} }
} }

View File

@ -57,7 +57,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
_xmlNs = new XmlSerializerNamespaces(); _xmlNs = new XmlSerializerNamespaces();
_xmlNs.Add(String.Empty, String.Empty); _xmlNs.Add(String.Empty, String.Empty);
} }
#region overriding properties #region overriding properties
public override string Name public override string Name
{ {
@ -90,7 +90,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
return; return;
} }
m_log.InfoFormat("{0} REST region plugin enabled", MsgID); m_log.InfoFormat("{0} REST region plugin enabled", MsgID);
// add REST method handlers // add REST method handlers
AddRestStreamHandler("GET", "/regions/", GetHandler); AddRestStreamHandler("GET", "/regions/", GetHandler);
AddRestStreamHandler("POST", "/regions/", PostHandler); AddRestStreamHandler("POST", "/regions/", PostHandler);

View File

@ -39,7 +39,7 @@ namespace OpenSim.Data
public abstract DataResponse AddProfile(RegionProfileData profile); public abstract DataResponse AddProfile(RegionProfileData profile);
public abstract ReservationData GetReservationAtPoint(uint x, uint y); public abstract ReservationData GetReservationAtPoint(uint x, uint y);
public abstract DataResponse UpdateProfile(RegionProfileData profile); public abstract DataResponse UpdateProfile(RegionProfileData profile);
public abstract void Initialise(); public abstract void Initialise();
public abstract void Initialise(string connect); public abstract void Initialise(string connect);
public abstract void Dispose(); public abstract void Dispose();

View File

@ -47,7 +47,7 @@ namespace OpenSim.Data
/// Initialises the interface /// Initialises the interface
/// </summary> /// </summary>
void Initialise(string connect); void Initialise(string connect);
/// <summary> /// <summary>
/// Returns a sim profile from a regionHandle /// Returns a sim profile from a regionHandle
/// </summary> /// </summary>
@ -100,7 +100,7 @@ namespace OpenSim.Data
ReservationData GetReservationAtPoint(uint x, uint y); ReservationData GetReservationAtPoint(uint x, uint y);
} }
public class GridDataInitialiser : PluginInitialiserBase public class GridDataInitialiser : PluginInitialiserBase
{ {
private string connect; private string connect;

View File

@ -73,7 +73,7 @@ namespace OpenSim.Data
/// </summary> /// </summary>
void Initialise(string connect); void Initialise(string connect);
} }
public class LogDataInitialiser : PluginInitialiserBase public class LogDataInitialiser : PluginInitialiserBase
{ {
private string connect; private string connect;

View File

@ -63,7 +63,7 @@ namespace OpenSim.Data.MSSQL
database.ExecuteResourceSql("CreateAssetsTable.sql"); database.ExecuteResourceSql("CreateAssetsTable.sql");
return; return;
} }
} }
/// <summary> /// <summary>
@ -230,7 +230,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// Database provider version. /// Database provider version.
/// </summary> /// </summary>
override public string Version override public string Version
{ {
@ -238,7 +238,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// The name of this DB provider. /// The name of this DB provider.
/// </summary> /// </summary>
override public string Name override public string Name
{ {

View File

@ -51,8 +51,8 @@ namespace OpenSim.Data.MSSQL
private string m_regionsTableName; private string m_regionsTableName;
override public void Initialise() override public void Initialise()
{ {
m_log.Info("[MSSQLGridData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MSSQLGridData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -87,7 +87,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private void TestTables() private void TestTables()
{ {
@ -114,7 +114,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// The name of this DB provider. /// The name of this DB provider.
/// </summary> /// </summary>
/// <returns>A string containing the storage system name</returns> /// <returns>A string containing the storage system name</returns>
override public string Name override public string Name
@ -123,7 +123,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// Database provider version. /// Database provider version.
/// </summary> /// </summary>
/// <returns>A string containing the storage system version</returns> /// <returns>A string containing the storage system version</returns>
override public string Version override public string Version
@ -209,7 +209,7 @@ namespace OpenSim.Data.MSSQL
{ {
return database.getRegionRow(reader); return database.getRegionRow(reader);
} }
} }
catch (Exception e) catch (Exception e)
{ {

View File

@ -40,14 +40,14 @@ namespace OpenSim.Data.MSSQL
internal class MSSQLLogData : ILogDataPlugin internal class MSSQLLogData : ILogDataPlugin
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
/// <summary> /// <summary>
/// The database manager /// The database manager
/// </summary> /// </summary>
public MSSQLManager database; public MSSQLManager database;
public void Initialise() public void Initialise()
{ {
m_log.Info("[MSSQLLogData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MSSQLLogData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }

View File

@ -60,7 +60,7 @@ namespace OpenSim.Data.MSSQL
builder.UserID = userId; builder.UserID = userId;
builder.Password = password; builder.Password = password;
builder.ApplicationName = Assembly.GetEntryAssembly().Location; builder.ApplicationName = Assembly.GetEntryAssembly().Location;
connectionString = builder.ToString(); connectionString = builder.ToString();
} }
@ -117,7 +117,7 @@ namespace OpenSim.Data.MSSQL
//} //}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="dt"></param> /// <param name="dt"></param>
/// <param name="name"></param> /// <param name="name"></param>
@ -376,7 +376,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="reader"></param> /// <param name="reader"></param>
/// <returns></returns> /// <returns></returns>
@ -492,7 +492,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="name"></param> /// <param name="name"></param>
/// <returns></returns> /// <returns></returns>

View File

@ -52,8 +52,8 @@ namespace OpenSim.Data.MSSQL
private string m_usersTableName; private string m_usersTableName;
private string m_userFriendsTableName; private string m_userFriendsTableName;
public override void Initialise() public override void Initialise()
{ {
m_log.Info("[MSSQLUserData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MSSQLUserData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -99,11 +99,11 @@ namespace OpenSim.Data.MSSQL
TestTables(); TestTables();
} }
public override void Dispose () {} public override void Dispose () {}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private bool TestTables() private bool TestTables()
@ -205,7 +205,7 @@ namespace OpenSim.Data.MSSQL
{ {
adder.ExecuteNonQuery(); adder.ExecuteNonQuery();
} }
using (IDbCommand adder = using (IDbCommand adder =
database.Query( database.Query(
"INSERT INTO " + m_userFriendsTableName + " " + "INSERT INTO " + m_userFriendsTableName + " " +
@ -351,7 +351,7 @@ namespace OpenSim.Data.MSSQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="queryID"></param> /// <param name="queryID"></param>
/// <param name="query"></param> /// <param name="query"></param>
@ -379,7 +379,7 @@ namespace OpenSim.Data.MSSQL
user.firstName = (string)reader["username"]; user.firstName = (string)reader["username"];
user.lastName = (string)reader["lastname"]; user.lastName = (string)reader["lastname"];
returnlist.Add(user); returnlist.Add(user);
} }
} }
} }
catch (Exception e) catch (Exception e)
@ -406,7 +406,7 @@ namespace OpenSim.Data.MSSQL
returnlist.Add(user); returnlist.Add(user);
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error(e.ToString()); m_log.Error(e.ToString());

View File

@ -36,7 +36,7 @@ using log4net;
namespace OpenSim.Data namespace OpenSim.Data
{ {
/// <summary> /// <summary>
/// ///
/// The Migration theory is based on the ruby on rails concept. /// The Migration theory is based on the ruby on rails concept.
/// Each database driver is going to be allowed to have files in /// Each database driver is going to be allowed to have files in
@ -77,11 +77,11 @@ namespace OpenSim.Data
// private string _subtype; // private string _subtype;
private Assembly _assem; private Assembly _assem;
private Regex _match; private Regex _match;
private static readonly string _migrations_create = "create table migrations(name varchar(100), version int)"; private static readonly string _migrations_create = "create table migrations(name varchar(100), version int)";
// private static readonly string _migrations_init = "insert into migrations values('migrations', 1)"; // private static readonly string _migrations_init = "insert into migrations values('migrations', 1)";
// private static readonly string _migrations_find = "select version from migrations where name='migrations'"; // private static readonly string _migrations_find = "select version from migrations where name='migrations'";
public Migration(DbConnection conn, Assembly assem, string type) public Migration(DbConnection conn, Assembly assem, string type)
{ {
_type = type; _type = type;
@ -105,7 +105,7 @@ namespace OpenSim.Data
// clever, eh, we figure out which migrations version we are // clever, eh, we figure out which migrations version we are
int migration_version = FindVersion("migrations"); int migration_version = FindVersion("migrations");
if (migration_version > 0) if (migration_version > 0)
return; return;
// If not, create the migration tables // If not, create the migration tables
@ -130,14 +130,14 @@ namespace OpenSim.Data
m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!"); m_log.Info("[MIGRATIONS] NOTE: this may take a while, don't interupt this process!");
DbCommand cmd = _conn.CreateCommand(); DbCommand cmd = _conn.CreateCommand();
foreach (KeyValuePair<int, string> kvp in migrations) foreach (KeyValuePair<int, string> kvp in migrations)
{ {
int newversion = kvp.Key; int newversion = kvp.Key;
cmd.CommandText = kvp.Value; cmd.CommandText = kvp.Value;
// we need to up the command timeout to infinite as we might be doing long migrations. // we need to up the command timeout to infinite as we might be doing long migrations.
cmd.CommandTimeout = 0; cmd.CommandTimeout = 0;
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
if (version == 0) if (version == 0)
{ {
InsertVersion(_type, newversion); InsertVersion(_type, newversion);
@ -158,7 +158,7 @@ namespace OpenSim.Data
// foreach (string s in names) // foreach (string s in names)
// { // {
// Match m = _match.Match(s); // Match m = _match.Match(s);
// if (m.Success) // if (m.Success)
// { // {
// int MigrationVersion = int.Parse(m.Groups[1].ToString()); // int MigrationVersion = int.Parse(m.Groups[1].ToString());
// if (MigrationVersion > max) // if (MigrationVersion > max)
@ -168,10 +168,10 @@ namespace OpenSim.Data
// return max; // return max;
// } // }
public int Version public int Version
{ {
get { return FindVersion(_type); } get { return FindVersion(_type); }
set { set {
if (Version < 1) if (Version < 1)
{ {
InsertVersion(_type, value); InsertVersion(_type, value);
@ -179,11 +179,11 @@ namespace OpenSim.Data
else else
{ {
UpdateVersion(_type, value); UpdateVersion(_type, value);
} }
} }
} }
private int FindVersion(string type) private int FindVersion(string type)
{ {
int version = 0; int version = 0;
DbCommand cmd = _conn.CreateCommand(); DbCommand cmd = _conn.CreateCommand();
@ -206,22 +206,22 @@ namespace OpenSim.Data
return version; return version;
} }
private void InsertVersion(string type, int version) private void InsertVersion(string type, int version)
{ {
DbCommand cmd = _conn.CreateCommand(); DbCommand cmd = _conn.CreateCommand();
cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")"; cmd.CommandText = "insert into migrations(name, version) values('" + type + "', " + version + ")";
m_log.InfoFormat("[MIGRATIONS] Creating {0} at version {1}", type, version); m_log.InfoFormat("[MIGRATIONS] Creating {0} at version {1}", type, version);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
private void UpdateVersion(string type, int version) private void UpdateVersion(string type, int version)
{ {
DbCommand cmd = _conn.CreateCommand(); DbCommand cmd = _conn.CreateCommand();
cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'"; cmd.CommandText = "update migrations set version=" + version + " where name='" + type + "'";
m_log.InfoFormat("[MIGRATIONS] Updating {0} to version {1}", type, version); m_log.InfoFormat("[MIGRATIONS] Updating {0} to version {1}", type, version);
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
// private SortedList<int, string> GetAllMigrations() // private SortedList<int, string> GetAllMigrations()
// { // {
// return GetMigrationsAfter(0); // return GetMigrationsAfter(0);
@ -261,4 +261,4 @@ namespace OpenSim.Data
return migrations; return migrations;
} }
} }
} }

View File

@ -144,11 +144,11 @@ namespace OpenSim.Data.MySQL
_dbConnection.GetTableVersion(tableList); _dbConnection.GetTableVersion(tableList);
// if there is no table, return, migrations will handle it. // if there is no table, return, migrations will handle it.
if (tableList["assets"] == null) if (tableList["assets"] == null)
return; return;
// if there is a table, and we don't have a migration, set it to 1 // if there is a table, and we don't have a migration, set it to 1
if (m.Version == 0) if (m.Version == 0)
m.Version = 1; m.Version = 1;
} }
@ -272,12 +272,12 @@ namespace OpenSim.Data.MySQL
lock (_dbConnection) lock (_dbConnection)
{ {
_dbConnection.CheckConnection(); _dbConnection.CheckConnection();
MySqlCommand cmd = MySqlCommand cmd =
new MySqlCommand( new MySqlCommand(
"SELECT id FROM assets WHERE id=?id", "SELECT id FROM assets WHERE id=?id",
_dbConnection.Connection); _dbConnection.Connection);
cmd.Parameters.AddWithValue("?id", uuid.ToString()); cmd.Parameters.AddWithValue("?id", uuid.ToString());
try try

View File

@ -51,7 +51,7 @@ namespace OpenSim.Data.MySQL
private string m_connectionString; private string m_connectionString;
private long m_waitTimeout; private long m_waitTimeout;
private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond; private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond;
private long m_lastConnectionUse; private long m_lastConnectionUse;
private FieldInfo[] m_Fields; private FieldInfo[] m_Fields;
private Dictionary<string, FieldInfo> m_FieldMap = private Dictionary<string, FieldInfo> m_FieldMap =
@ -83,13 +83,13 @@ namespace OpenSim.Data.MySQL
} }
m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString); m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString);
//m_log.Info("[ESTATE DB]: MySql - connecting: "+m_connectionString); //m_log.Info("[ESTATE DB]: MySql - connecting: "+m_connectionString);
m_connection = new MySqlConnection(m_connectionString); m_connection = new MySqlConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
GetWaitTimeout(); GetWaitTimeout();
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration(m_connection, assem, "EstateStore"); Migration m = new Migration(m_connection, assem, "EstateStore");
@ -106,7 +106,7 @@ namespace OpenSim.Data.MySQL
m_FieldMap[f.Name.Substring(2)] = f; m_FieldMap[f.Name.Substring(2)] = f;
} }
} }
private string[] FieldList private string[] FieldList
{ {
get { return new List<string>(m_FieldMap.Keys).ToArray(); } get { return new List<string>(m_FieldMap.Keys).ToArray(); }
@ -116,28 +116,28 @@ namespace OpenSim.Data.MySQL
{ {
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect,
m_connection); m_connection);
using (MySqlDataReader dbReader = using (MySqlDataReader dbReader =
cmd.ExecuteReader(CommandBehavior.SingleRow)) cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if (dbReader.Read()) if (dbReader.Read())
{ {
m_waitTimeout m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * = Convert.ToInt32(dbReader["@@wait_timeout"]) *
TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
} }
dbReader.Close(); dbReader.Close();
cmd.Dispose(); cmd.Dispose();
} }
m_lastConnectionUse = System.DateTime.Now.Ticks; m_lastConnectionUse = System.DateTime.Now.Ticks;
m_log.DebugFormat( m_log.DebugFormat(
"[REGION DB]: Connection wait timeout {0} seconds", "[REGION DB]: Connection wait timeout {0} seconds",
m_waitTimeout / TimeSpan.TicksPerSecond); m_waitTimeout / TimeSpan.TicksPerSecond);
} }
protected void CheckConnection() protected void CheckConnection()
{ {
long timeNow = System.DateTime.Now.Ticks; long timeNow = System.DateTime.Now.Ticks;
@ -145,17 +145,17 @@ namespace OpenSim.Data.MySQL
m_connection.State != ConnectionState.Open) m_connection.State != ConnectionState.Open)
{ {
m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting"); m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting");
lock (m_connection) lock (m_connection)
{ {
m_connection.Close(); m_connection.Close();
m_connection = new MySqlConnection(m_connectionString); m_connection = new MySqlConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
} }
} }
m_lastConnectionUse = timeNow; m_lastConnectionUse = timeNow;
} }
public EstateSettings LoadEstateSettings(LLUUID regionID) public EstateSettings LoadEstateSettings(LLUUID regionID)
{ {
@ -210,7 +210,7 @@ namespace OpenSim.Data.MySQL
names.Remove("EstateID"); names.Remove("EstateID");
sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( ?"+String.Join(", ?", names.ToArray())+")"; sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( ?"+String.Join(", ?", names.ToArray())+")";
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.Parameters.Clear(); cmd.Parameters.Clear();
@ -318,7 +318,7 @@ namespace OpenSim.Data.MySQL
es.ClearBans(); es.ClearBans();
CheckConnection(); CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand(); MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID"; cmd.CommandText = "select bannedUUID from estateban where EstateID = ?EstateID";
@ -344,18 +344,18 @@ namespace OpenSim.Data.MySQL
private void SaveBanList(EstateSettings es) private void SaveBanList(EstateSettings es)
{ {
CheckConnection(); CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand(); MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = ?EstateID"; cmd.CommandText = "delete from estateban where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID) values ( ?EstateID, ?bannedUUID )"; cmd.CommandText = "insert into estateban (EstateID, bannedUUID) values ( ?EstateID, ?bannedUUID )";
foreach (EstateBan b in es.EstateBans) foreach (EstateBan b in es.EstateBans)
{ {
cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString()); cmd.Parameters.AddWithValue("?EstateID", es.EstateID.ToString());
@ -369,18 +369,18 @@ namespace OpenSim.Data.MySQL
void SaveUUIDList(uint EstateID, string table, LLUUID[] data) void SaveUUIDList(uint EstateID, string table, LLUUID[] data)
{ {
CheckConnection(); CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand(); MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = ?EstateID"; cmd.CommandText = "delete from "+table+" where EstateID = ?EstateID";
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( ?EstateID, ?uuid )"; cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( ?EstateID, ?uuid )";
foreach (LLUUID uuid in data) foreach (LLUUID uuid in data)
{ {
cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString()); cmd.Parameters.AddWithValue("?EstateID", EstateID.ToString());
@ -396,7 +396,7 @@ namespace OpenSim.Data.MySQL
List<LLUUID> uuids = new List<LLUUID>(); List<LLUUID> uuids = new List<LLUUID>();
CheckConnection(); CheckConnection();
MySqlCommand cmd = m_connection.CreateCommand(); MySqlCommand cmd = m_connection.CreateCommand();
cmd.CommandText = "select uuid from "+table+" where EstateID = ?EstateID"; cmd.CommandText = "select uuid from "+table+" where EstateID = ?EstateID";
@ -414,7 +414,7 @@ namespace OpenSim.Data.MySQL
uuids.Add(uuid); uuids.Add(uuid);
} }
r.Close(); r.Close();
return uuids.ToArray(); return uuids.ToArray();
} }
} }

View File

@ -49,8 +49,8 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
private MySQLManager database; private MySQLManager database;
override public void Initialise() override public void Initialise()
{ {
m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MySQLGridData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -253,7 +253,7 @@ namespace OpenSim.Data.MySQL
return null; return null;
} }
} }
/// <summary> /// <summary>
/// Returns a sim profile from it's UUID /// Returns a sim profile from it's UUID
/// </summary> /// </summary>

View File

@ -48,8 +48,8 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
private MySQLManager database; private MySQLManager database;
public void Initialise() public void Initialise()
{ {
m_log.Info("[MySQLInventoryData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MySQLInventoryData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -81,7 +81,7 @@ namespace OpenSim.Data.MySQL
string settingPassword = GridDataMySqlFile.ParseFileReadValue("password"); string settingPassword = GridDataMySqlFile.ParseFileReadValue("password");
string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling"); string settingPooling = GridDataMySqlFile.ParseFileReadValue("pooling");
string settingPort = GridDataMySqlFile.ParseFileReadValue("port"); string settingPort = GridDataMySqlFile.ParseFileReadValue("port");
database = database =
new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling, new MySQLManager(settingHostname, settingDatabase, settingUsername, settingPassword, settingPooling,
settingPort); settingPort);
@ -147,7 +147,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn">MySQL connection handler</param> /// <param name="conn">MySQL connection handler</param>
/// <param name="m"></param> /// <param name="m"></param>
@ -180,7 +180,7 @@ namespace OpenSim.Data.MySQL
// ... and set the version // ... and set the version
if (m.Version == 0) if (m.Version == 0)
m.Version = 1; m.Version = 1;
} }
#endregion #endregion
@ -290,7 +290,7 @@ namespace OpenSim.Data.MySQL
} }
} }
/// <summary> /// <summary>
/// see <see cref="InventoryItemBase.getUserRootFolder"/> /// see <see cref="InventoryItemBase.getUserRootFolder"/>
/// </summary> /// </summary>
@ -708,10 +708,10 @@ namespace OpenSim.Data.MySQL
* - We will only need to hit the database twice instead of n times. * - We will only need to hit the database twice instead of n times.
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
* by the same person, each user only has 1 inventory heirarchy * by the same person, each user only has 1 inventory heirarchy
* - The returned list is not ordered, instead of breadth-first ordered * - The returned list is not ordered, instead of breadth-first ordered
There are basically 2 usage cases for getFolderHeirarchy: There are basically 2 usage cases for getFolderHeirarchy:
1) Getting the user's entire inventory heirarchy when they log in 1) Getting the user's entire inventory heirarchy when they log in
2) Finding a subfolder heirarchy to delete when emptying the trash. 2) Finding a subfolder heirarchy to delete when emptying the trash.
This implementation will pull all inventory folders from the database, and then prune away any folder that This implementation will pull all inventory folders from the database, and then prune away any folder that
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
database than to make n requests. This pays off only if requested heirarchy is large. database than to make n requests. This pays off only if requested heirarchy is large.
@ -774,7 +774,7 @@ namespace OpenSim.Data.MySQL
while (reader.Read()) while (reader.Read())
{ {
InventoryFolderBase curFolder = readInventoryFolder(reader); InventoryFolderBase curFolder = readInventoryFolder(reader);
if (hashtable.ContainsKey(curFolder.ParentID)) // Current folder already has a sibling if (hashtable.ContainsKey(curFolder.ParentID)) // Current folder already has a sibling
hashtable[curFolder.ParentID].Add(curFolder); // append to sibling list hashtable[curFolder.ParentID].Add(curFolder); // append to sibling list
else // else current folder has no known (yet) siblings else // else current folder has no known (yet) siblings
{ {

View File

@ -44,12 +44,12 @@ namespace OpenSim.Data.MySQL
/// </summary> /// </summary>
public MySQLManager database; public MySQLManager database;
public void Initialise() public void Initialise()
{ {
m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MySQLLogData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
/// <summary> /// <summary>
/// Artificial constructor called when the plugin is loaded /// Artificial constructor called when the plugin is loaded
/// Uses the obsolete mysql_connection.ini if connect string is empty. /// Uses the obsolete mysql_connection.ini if connect string is empty.
@ -100,7 +100,7 @@ namespace OpenSim.Data.MySQL
Dictionary<string, string> tableList = new Dictionary<string, string>(); Dictionary<string, string> tableList = new Dictionary<string, string>();
tableList["logs"] = null; tableList["logs"] = null;
database.GetTableVersion(tableList); database.GetTableVersion(tableList);
// migrations will handle it // migrations will handle it
if (tableList["logs"] == null) if (tableList["logs"] == null)
return; return;

View File

@ -55,7 +55,7 @@ namespace OpenSim.Data.MySQL
private string connectionString; private string connectionString;
private const string m_waitTimeoutSelect = "select @@wait_timeout"; private const string m_waitTimeoutSelect = "select @@wait_timeout";
/// <summary> /// <summary>
/// Wait timeout for our connection in ticks. /// Wait timeout for our connection in ticks.
/// </summary> /// </summary>
@ -70,7 +70,7 @@ namespace OpenSim.Data.MySQL
/// <summary> /// <summary>
/// Holds the last tick time that the connection was used. /// Holds the last tick time that the connection was used.
/// </summary> /// </summary>
private long m_lastConnectionUse; private long m_lastConnectionUse;
/// <summary> /// <summary>
/// Initialises and creates a new MySQL connection and maintains it. /// Initialises and creates a new MySQL connection and maintains it.
@ -172,7 +172,7 @@ namespace OpenSim.Data.MySQL
// inaccuracy. // inaccuracy.
m_lastConnectionUse = timeNow; m_lastConnectionUse = timeNow;
} }
/// <summary> /// <summary>
/// Get the connection being used /// Get the connection being used
/// </summary> /// </summary>
@ -287,14 +287,14 @@ namespace OpenSim.Data.MySQL
{ {
lock (dbcon) lock (dbcon)
{ {
CheckConnection(); CheckConnection();
MySqlCommand tablesCmd = MySqlCommand tablesCmd =
new MySqlCommand( new MySqlCommand(
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
dbcon); dbcon);
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
using (MySqlDataReader tables = tablesCmd.ExecuteReader()) using (MySqlDataReader tables = tablesCmd.ExecuteReader())
{ {
while (tables.Read()) while (tables.Read())
@ -541,7 +541,7 @@ namespace OpenSim.Data.MySQL
LLUUID regionID = LLUUID.Zero; LLUUID regionID = LLUUID.Zero;
LLUUID.TryParse(reader["homeRegionID"].ToString(), out regionID); // it's ok if it doesn't work; just use LLUUID.Zero LLUUID.TryParse(reader["homeRegionID"].ToString(), out regionID); // it's ok if it doesn't work; just use LLUUID.Zero
retval.HomeRegionID = regionID; retval.HomeRegionID = regionID;
retval.Created = Convert.ToInt32(reader["created"].ToString()); retval.Created = Convert.ToInt32(reader["created"].ToString());
retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString()); retval.LastLogin = Convert.ToInt32(reader["lastLogin"].ToString());
@ -1124,7 +1124,7 @@ namespace OpenSim.Data.MySQL
sql += "?skirt_item, ?skirt_asset)"; sql += "?skirt_item, ?skirt_asset)";
bool returnval = false; bool returnval = false;
// we want to send in byte data, which means we can't just pass down strings // we want to send in byte data, which means we can't just pass down strings
try { try {
MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand();
@ -1160,7 +1160,7 @@ namespace OpenSim.Data.MySQL
cmd.Parameters.AddWithValue("?underpants_asset", appearance.UnderPantsAsset.ToString()); cmd.Parameters.AddWithValue("?underpants_asset", appearance.UnderPantsAsset.ToString());
cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString()); cmd.Parameters.AddWithValue("?skirt_item", appearance.SkirtItem.ToString());
cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString()); cmd.Parameters.AddWithValue("?skirt_asset", appearance.SkirtAsset.ToString());
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0)
returnval = true; returnval = true;

View File

@ -53,27 +53,27 @@ namespace OpenSim.Data.MySQL
private const string m_terrainSelect = "select * from terrain limit 1"; private const string m_terrainSelect = "select * from terrain limit 1";
private const string m_landSelect = "select * from land"; private const string m_landSelect = "select * from land";
private const string m_landAccessListSelect = "select * from landaccesslist"; private const string m_landAccessListSelect = "select * from landaccesslist";
private const string m_regionSettingsSelect = "select * from regionsettings"; private const string m_regionSettingsSelect = "select * from regionsettings";
private const string m_waitTimeoutSelect = "select @@wait_timeout"; private const string m_waitTimeoutSelect = "select @@wait_timeout";
private MySqlConnection m_connection; private MySqlConnection m_connection;
private string m_connectionString; private string m_connectionString;
/// <summary> /// <summary>
/// Wait timeout for our connection in ticks. /// Wait timeout for our connection in ticks.
/// </summary> /// </summary>
private long m_waitTimeout; private long m_waitTimeout;
/// <summary> /// <summary>
/// Make our storage of the timeout this amount smaller than it actually is, to give us a margin on long /// Make our storage of the timeout this amount smaller than it actually is, to give us a margin on long
/// running database operations. /// running database operations.
/// </summary> /// </summary>
private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond; private long m_waitTimeoutLeeway = 60 * TimeSpan.TicksPerSecond;
/// <summary> /// <summary>
/// Holds the last tick time that the connection was used. /// Holds the last tick time that the connection was used.
/// </summary> /// </summary>
private long m_lastConnectionUse; private long m_lastConnectionUse;
private DataSet m_dataSet; private DataSet m_dataSet;
private MySqlDataAdapter m_primDataAdapter; private MySqlDataAdapter m_primDataAdapter;
@ -105,7 +105,7 @@ namespace OpenSim.Data.MySQL
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
m_dataSet = new DataSet(); m_dataSet = new DataSet();
int passPosition = 0; int passPosition = 0;
@ -132,8 +132,8 @@ namespace OpenSim.Data.MySQL
m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString); m_log.Info("[REGION DB]: MySql - connecting: " + displayConnectionString);
m_connection = new MySqlConnection(m_connectionString); m_connection = new MySqlConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
GetWaitTimeout(); GetWaitTimeout();
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
@ -177,12 +177,11 @@ namespace OpenSim.Data.MySQL
m_dataSet.Tables.Add(m_shapeTable); m_dataSet.Tables.Add(m_shapeTable);
SetupShapeCommands(m_shapeDataAdapter, m_connection); SetupShapeCommands(m_shapeDataAdapter, m_connection);
m_shapeDataAdapter.Fill(m_shapeTable); m_shapeDataAdapter.Fill(m_shapeTable);
m_itemsTable = createItemsTable(); m_itemsTable = createItemsTable();
m_dataSet.Tables.Add(m_itemsTable); m_dataSet.Tables.Add(m_itemsTable);
SetupItemsCommands(m_itemsDataAdapter, m_connection); SetupItemsCommands(m_itemsDataAdapter, m_connection);
m_itemsDataAdapter.Fill(m_itemsTable); m_itemsDataAdapter.Fill(m_itemsTable);
m_terrainTable = createTerrainTable(); m_terrainTable = createTerrainTable();
m_dataSet.Tables.Add(m_terrainTable); m_dataSet.Tables.Add(m_terrainTable);
@ -205,58 +204,58 @@ namespace OpenSim.Data.MySQL
m_regionSettingsDataAdapter.Fill(m_regionSettingsTable); m_regionSettingsDataAdapter.Fill(m_regionSettingsTable);
} }
} }
/// <summary> /// <summary>
/// Get the wait_timeout value for our connection /// Get the wait_timeout value for our connection
/// </summary> /// </summary>
protected void GetWaitTimeout() protected void GetWaitTimeout()
{ {
MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection); MySqlCommand cmd = new MySqlCommand(m_waitTimeoutSelect, m_connection);
using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow)) using (MySqlDataReader dbReader = cmd.ExecuteReader(CommandBehavior.SingleRow))
{ {
if (dbReader.Read()) if (dbReader.Read())
{ {
m_waitTimeout m_waitTimeout
= Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway; = Convert.ToInt32(dbReader["@@wait_timeout"]) * TimeSpan.TicksPerSecond + m_waitTimeoutLeeway;
} }
dbReader.Close(); dbReader.Close();
cmd.Dispose(); cmd.Dispose();
} }
m_lastConnectionUse = System.DateTime.Now.Ticks; m_lastConnectionUse = System.DateTime.Now.Ticks;
m_log.DebugFormat( m_log.DebugFormat(
"[REGION DB]: Connection wait timeout {0} seconds", m_waitTimeout / TimeSpan.TicksPerSecond); "[REGION DB]: Connection wait timeout {0} seconds", m_waitTimeout / TimeSpan.TicksPerSecond);
} }
/// <summary> /// <summary>
/// Should be called before any db operation. This checks to see if the connection has not timed out /// Should be called before any db operation. This checks to see if the connection has not timed out
/// </summary> /// </summary>
protected void CheckConnection() protected void CheckConnection()
{ {
//m_log.Debug("[REGION DB]: Checking connection"); //m_log.Debug("[REGION DB]: Checking connection");
long timeNow = System.DateTime.Now.Ticks; long timeNow = System.DateTime.Now.Ticks;
if (timeNow - m_lastConnectionUse > m_waitTimeout || m_connection.State != ConnectionState.Open) if (timeNow - m_lastConnectionUse > m_waitTimeout || m_connection.State != ConnectionState.Open)
{ {
m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting"); m_log.DebugFormat("[REGION DB]: Database connection has gone away - reconnecting");
lock (m_connection) lock (m_connection)
{ {
m_connection.Close(); m_connection.Close();
m_connection = new MySqlConnection(m_connectionString); m_connection = new MySqlConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
} }
} }
// Strictly, we should set this after the actual db operation. But it's more convenient to set here rather // Strictly, we should set this after the actual db operation. But it's more convenient to set here rather
// than require the code to call another method - the timeout leeway should be large enough to cover the // than require the code to call another method - the timeout leeway should be large enough to cover the
// inaccuracy. // inaccuracy.
m_lastConnectionUse = timeNow; m_lastConnectionUse = timeNow;
} }
/// <summary> /// <summary>
/// Given a list of tables, return the version of the tables, as seen in the database /// Given a list of tables, return the version of the tables, as seen in the database
/// </summary> /// </summary>
@ -271,7 +270,7 @@ namespace OpenSim.Data.MySQL
"SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname", "SELECT TABLE_NAME, TABLE_COMMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA=?dbname",
dbcon); dbcon);
tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database); tablesCmd.Parameters.AddWithValue("?dbname", dbcon.Database);
CheckConnection(); CheckConnection();
using (MySqlDataReader tables = tablesCmd.ExecuteReader()) using (MySqlDataReader tables = tablesCmd.ExecuteReader())
{ {
@ -465,7 +464,7 @@ namespace OpenSim.Data.MySQL
lock (m_dataSet) lock (m_dataSet)
{ {
CheckConnection(); CheckConnection();
DataRow[] primsForRegion = prims.Select(byRegion, orderByParent); DataRow[] primsForRegion = prims.Select(byRegion, orderByParent);
m_log.Info("[REGION DB]: " + m_log.Info("[REGION DB]: " +
"Loaded " + primsForRegion.Length + " prims for region: " + regionUUID); "Loaded " + primsForRegion.Length + " prims for region: " + regionUUID);
@ -587,10 +586,10 @@ namespace OpenSim.Data.MySQL
using (cmd) using (cmd)
{ {
delete.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); delete.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
CheckConnection(); CheckConnection();
delete.ExecuteNonQuery(); delete.ExecuteNonQuery();
cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID))); cmd.Parameters.Add(new MySqlParameter("?RegionUUID", Util.ToRawUuidString(regionID)));
cmd.Parameters.Add(new MySqlParameter("?Revision", revision)); cmd.Parameters.Add(new MySqlParameter("?Revision", revision));
cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter))); cmd.Parameters.Add(new MySqlParameter("?Heightfield", serializeTerrain(ter)));
@ -774,7 +773,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="regionUUID"></param> /// <param name="regionUUID"></param>
/// <returns></returns> /// <returns></returns>
@ -805,7 +804,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void Commit() public void Commit()
{ {
@ -845,7 +844,7 @@ namespace OpenSim.Data.MySQL
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="dt"></param> /// <param name="dt"></param>
/// <param name="name"></param> /// <param name="name"></param>
@ -1139,7 +1138,7 @@ namespace OpenSim.Data.MySQL
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1315,7 +1314,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1374,14 +1373,14 @@ namespace OpenSim.Data.MySQL
newData.UserLookAt = LLVector3.Zero; newData.UserLookAt = LLVector3.Zero;
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name); m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
} }
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>(); newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
return newData; return newData;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1395,7 +1394,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="val"></param> /// <param name="val"></param>
/// <returns></returns> /// <returns></returns>
@ -1419,7 +1418,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="prim"></param> /// <param name="prim"></param>
@ -1502,7 +1501,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="taskItem"></param> /// <param name="taskItem"></param>
@ -1532,7 +1531,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private static void fillRegionSettingsRow(DataRow row, RegionSettings settings) private static void fillRegionSettingsRow(DataRow row, RegionSettings settings)
{ {
@ -1573,7 +1572,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="land"></param> /// <param name="land"></param>
@ -1618,7 +1617,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="entry"></param> /// <param name="entry"></param>
@ -1631,7 +1630,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1694,7 +1693,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="prim"></param> /// <param name="prim"></param>
@ -1731,7 +1730,7 @@ namespace OpenSim.Data.MySQL
row["ProfileHollow"] = s.ProfileHollow; row["ProfileHollow"] = s.ProfileHollow;
row["Texture"] = s.TextureEntry; row["Texture"] = s.TextureEntry;
row["ExtraParams"] = s.ExtraParams; row["ExtraParams"] = s.ExtraParams;
try try
{ {
row["State"] = s.State; row["State"] = s.State;
@ -1754,7 +1753,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="prim"></param> /// <param name="prim"></param>
/// <param name="sceneGroupID"></param> /// <param name="sceneGroupID"></param>
@ -1911,7 +1910,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="dt"></param> /// <param name="dt"></param>
/// <returns></returns> /// <returns></returns>
@ -1973,7 +1972,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1994,7 +1993,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -2027,7 +2026,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -2038,7 +2037,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -2052,7 +2051,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -2063,7 +2062,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -2082,7 +2081,7 @@ namespace OpenSim.Data.MySQL
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn">MySQL connection handler</param> /// <param name="conn">MySQL connection handler</param>
// private static void InitDB(MySqlConnection conn) // private static void InitDB(MySqlConnection conn)
@ -2174,7 +2173,7 @@ namespace OpenSim.Data.MySQL
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
/// <param name="m"></param> /// <param name="m"></param>

View File

@ -72,7 +72,7 @@ namespace OpenSim.Data.NHibernate
public object NullSafeGet(IDataReader rs, string[] names, object owner) public object NullSafeGet(IDataReader rs, string[] names, object owner)
{ {
object quat = null; object quat = null;
int x = rs.GetOrdinal(names[0]); int x = rs.GetOrdinal(names[0]);
int y = rs.GetOrdinal(names[1]); int y = rs.GetOrdinal(names[1]);
int z = rs.GetOrdinal(names[2]); int z = rs.GetOrdinal(names[2]);
@ -105,10 +105,10 @@ namespace OpenSim.Data.NHibernate
public SqlType[] SqlTypes public SqlType[] SqlTypes
{ {
get { return new SqlType [] { get { return new SqlType [] {
NHibernateUtil.Single.SqlType, NHibernateUtil.Single.SqlType,
NHibernateUtil.Single.SqlType, NHibernateUtil.Single.SqlType,
NHibernateUtil.Single.SqlType, NHibernateUtil.Single.SqlType,
NHibernateUtil.Single.SqlType NHibernateUtil.Single.SqlType
}; } }; }
} }

View File

@ -70,7 +70,7 @@ namespace OpenSim.Data.NHibernate
public object NullSafeGet(IDataReader rs, string[] names, object owner) public object NullSafeGet(IDataReader rs, string[] names, object owner)
{ {
object vector = null; object vector = null;
int x = rs.GetOrdinal(names[0]); int x = rs.GetOrdinal(names[0]);
int y = rs.GetOrdinal(names[1]); int y = rs.GetOrdinal(names[1]);
int z = rs.GetOrdinal(names[2]); int z = rs.GetOrdinal(names[2]);

View File

@ -93,7 +93,7 @@ namespace OpenSim.Data.NHibernate
factory = cfg.BuildSessionFactory(); factory = cfg.BuildSessionFactory();
session = factory.OpenSession(); session = factory.OpenSession();
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore"); Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "AssetStore");
@ -111,7 +111,7 @@ namespace OpenSim.Data.NHibernate
{ {
m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid); m_log.ErrorFormat("[NHIBERNATE] no such asset {0}", uuid);
return null; return null;
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[NHIBERNATE] unexpected exception: ", e); m_log.Error("[NHIBERNATE] unexpected exception: ", e);
@ -121,7 +121,7 @@ namespace OpenSim.Data.NHibernate
private void Save(AssetBase asset) private void Save(AssetBase asset)
{ {
try try
{ {
// a is not used anywhere? // a is not used anywhere?
// AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase; // AssetBase a = session.Load(typeof(AssetBase), asset.FullID) as AssetBase;

View File

@ -51,7 +51,7 @@ namespace OpenSim.Data.NHibernate
// "NHibernate.Driver.SqliteClientDriver"; // "NHibernate.Driver.SqliteClientDriver";
// cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] = // cfg.Properties[NHibernate.Cfg.Environment.ConnectionString] =
// "URI=file:opensim-nh.db,version=3"; // "URI=file:opensim-nh.db,version=3";
// factory = cfg.BuildSessionFactory(); // factory = cfg.BuildSessionFactory();
} }

View File

@ -89,10 +89,10 @@ namespace OpenSim.Data.NHibernate
using (MemoryStream stream = using (MemoryStream stream =
HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly())) HbmSerializer.Default.Serialize(Assembly.GetExecutingAssembly()))
cfg.AddInputStream(stream); cfg.AddInputStream(stream);
factory = cfg.BuildSessionFactory(); factory = cfg.BuildSessionFactory();
session = factory.OpenSession(); session = factory.OpenSession();
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore"); Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "RegionStore");
@ -113,7 +113,7 @@ namespace OpenSim.Data.NHibernate
{ {
return null; return null;
} }
// This looks inefficient, but it turns out that it isn't // This looks inefficient, but it turns out that it isn't
// based on trial runs with nhibernate 1.2 // based on trial runs with nhibernate 1.2
private void SaveOrUpdate(SceneObjectPart p) private void SaveOrUpdate(SceneObjectPart p)
@ -164,7 +164,7 @@ namespace OpenSim.Data.NHibernate
/// <param name="regionUUID">the region UUID</param> /// <param name="regionUUID">the region UUID</param>
public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID) public void StoreObject(SceneObjectGroup obj, LLUUID regionUUID)
{ {
try try
{ {
foreach (SceneObjectPart part in obj.Children.Values) foreach (SceneObjectPart part in obj.Children.Values)
{ {
@ -173,7 +173,7 @@ namespace OpenSim.Data.NHibernate
} }
session.Flush(); session.Flush();
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("Can't save: ", e); m_log.Error("Can't save: ", e);
} }
@ -196,7 +196,7 @@ namespace OpenSim.Data.NHibernate
group.AddPart(p); group.AddPart(p);
group.RootPart = p; group.RootPart = p;
} }
else else
{ {
group.AddPart(p); group.AddPart(p);
} }
@ -232,7 +232,7 @@ namespace OpenSim.Data.NHibernate
{ {
Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>(); Dictionary<LLUUID, SceneObjectGroup> SOG = new Dictionary<LLUUID, SceneObjectGroup>();
List<SceneObjectGroup> ret = new List<SceneObjectGroup>(); List<SceneObjectGroup> ret = new List<SceneObjectGroup>();
ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart)); ICriteria criteria = session.CreateCriteria(typeof(SceneObjectPart));
criteria.Add(Expression.Eq("RegionID", regionUUID)); criteria.Add(Expression.Eq("RegionID", regionUUID));
criteria.AddOrder( Order.Asc("ParentID") ); criteria.AddOrder( Order.Asc("ParentID") );
@ -246,12 +246,12 @@ namespace OpenSim.Data.NHibernate
group.RootPart = p; group.RootPart = p;
SOG.Add(p.ParentUUID, group); SOG.Add(p.ParentUUID, group);
} }
else else
{ {
SOG[p.ParentUUID].AddPart(p); SOG[p.ParentUUID].AddPart(p);
} }
// get the inventory // get the inventory
ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem)); ICriteria InvCriteria = session.CreateCriteria(typeof(TaskInventoryItem));
InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID)); InvCriteria.Add(Expression.Eq("ParentPartID", p.UUID));
IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>(); IList<TaskInventoryItem> inventory = new List<TaskInventoryItem>();
@ -263,7 +263,7 @@ namespace OpenSim.Data.NHibernate
if (inventory.Count > 0) if (inventory.Count > 0)
p.RestoreInventoryItems(inventory); p.RestoreInventoryItems(inventory);
} }
foreach (SceneObjectGroup g in SOG.Values) foreach (SceneObjectGroup g in SOG.Values)
{ {
ret.Add(g); ret.Add(g);
} }
@ -304,7 +304,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="globalID"></param> /// <param name="globalID"></param>
public void RemoveLandObject(LLUUID globalID) public void RemoveLandObject(LLUUID globalID)
@ -313,7 +313,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="parcel"></param> /// <param name="parcel"></param>
public void StoreLandObject(ILandObject parcel) public void StoreLandObject(ILandObject parcel)
@ -322,7 +322,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="regionUUID"></param> /// <param name="regionUUID"></param>
/// <returns></returns> /// <returns></returns>
@ -341,7 +341,7 @@ namespace OpenSim.Data.NHibernate
{ {
session.Flush(); session.Flush();
} }
/// <summary> /// <summary>
/// Load a region banlist /// Load a region banlist
/// </summary> /// </summary>
@ -373,7 +373,7 @@ namespace OpenSim.Data.NHibernate
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="val"></param> /// <param name="val"></param>
/// <returns></returns> /// <returns></returns>
@ -399,17 +399,17 @@ namespace OpenSim.Data.NHibernate
{ {
ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem)); ICriteria criteria = session.CreateCriteria(typeof(TaskInventoryItem));
criteria.Add(Expression.Eq("ParentPartID", primID)); criteria.Add(Expression.Eq("ParentPartID", primID));
try try
{ {
foreach (TaskInventoryItem i in criteria.List()) foreach (TaskInventoryItem i in criteria.List())
{ {
session.Delete(i); session.Delete(i);
} }
foreach (TaskInventoryItem i in items) foreach (TaskInventoryItem i in items)
{ {
session.Save(i); session.Save(i);
} }
session.Flush(); session.Flush();
} }

View File

@ -53,8 +53,8 @@ namespace OpenSim.Data.NHibernate
private ISessionFactory factory; private ISessionFactory factory;
private ISession session; private ISession session;
public override void Initialise() public override void Initialise()
{ {
m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!"); m_log.Info("[NHibernateUserData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -83,7 +83,7 @@ namespace OpenSim.Data.NHibernate
factory = cfg.BuildSessionFactory(); factory = cfg.BuildSessionFactory();
session = factory.OpenSession(); session = factory.OpenSession();
// This actually does the roll forward assembly stuff // This actually does the roll forward assembly stuff
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore"); Migration m = new Migration((System.Data.Common.DbConnection)factory.ConnectionProvider.GetConnection(), assem, dialect, "UserStore");
@ -97,7 +97,7 @@ namespace OpenSim.Data.NHibernate
{ {
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
} }
catch (ObjectNotFoundException) catch (ObjectNotFoundException)
{ {
user = null; user = null;
} }
@ -109,12 +109,12 @@ namespace OpenSim.Data.NHibernate
{ {
UserProfileData user; UserProfileData user;
// TODO: I'm sure I'll have to do something silly here // TODO: I'm sure I'll have to do something silly here
try try
{ {
user = session.Load(typeof(UserProfileData), uuid) as UserProfileData; user = session.Load(typeof(UserProfileData), uuid) as UserProfileData;
user.CurrentAgent = GetAgentByUUID(uuid); user.CurrentAgent = GetAgentByUUID(uuid);
} }
catch (ObjectNotFoundException) catch (ObjectNotFoundException)
{ {
user = null; user = null;
} }
@ -144,12 +144,12 @@ namespace OpenSim.Data.NHibernate
} }
else else
{ {
try try
{ {
UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData; UserAgentData old = session.Load(typeof(UserAgentData), uuid) as UserAgentData;
session.Delete(old); session.Delete(old);
} }
catch (ObjectNotFoundException) catch (ObjectNotFoundException)
{ {
} }
session.Save(agent); session.Save(agent);
@ -174,12 +174,12 @@ namespace OpenSim.Data.NHibernate
override public void AddNewUserAgent(UserAgentData agent) override public void AddNewUserAgent(UserAgentData agent)
{ {
try try
{ {
UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData; UserAgentData old = session.Load(typeof(UserAgentData), agent.ProfileID) as UserAgentData;
session.Delete(old); session.Delete(old);
} }
catch (ObjectNotFoundException) catch (ObjectNotFoundException)
{ {
} }
session.Save(agent); session.Save(agent);
@ -287,9 +287,9 @@ namespace OpenSim.Data.NHibernate
public override void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance) public override void UpdateUserAppearance(LLUUID user, AvatarAppearance appearance)
{ {
if (appearance == null) if (appearance == null)
return; return;
appearance.Owner = user; appearance.Owner = user;
bool exists = ExistsAppearance(user); bool exists = ExistsAppearance(user);

View File

@ -32,21 +32,21 @@ using OpenSim.Framework;
using log4net; using log4net;
using libsecondlife; using libsecondlife;
namespace OpenSim.Data.NHibernate namespace OpenSim.Data.NHibernate
{ {
public class Terrain public class Terrain
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private double[,] map; private double[,] map;
private LLUUID regionID; private LLUUID regionID;
public Terrain(LLUUID Region, double[,] array) public Terrain(LLUUID Region, double[,] array)
{ {
map = array; map = array;
regionID = Region; regionID = Region;
} }
public Terrain() public Terrain()
{ {
map = new double[Constants.RegionSize, Constants.RegionSize]; map = new double[Constants.RegionSize, Constants.RegionSize];
@ -65,7 +65,7 @@ namespace OpenSim.Data.NHibernate
get { return serializeTerrain(map); } get { return serializeTerrain(map); }
set { map = parseTerrain(value); } set { map = parseTerrain(value); }
} }
public double[,] Doubles public double[,] Doubles
{ {
get {return map;} get {return map;}
@ -76,7 +76,7 @@ namespace OpenSim.Data.NHibernate
{ {
double[,] terret = new double[256,256]; double[,] terret = new double[256,256];
terret.Initialize(); terret.Initialize();
MemoryStream str = new MemoryStream(data); MemoryStream str = new MemoryStream(data);
BinaryReader br = new BinaryReader(str); BinaryReader br = new BinaryReader(str);
try { try {
@ -87,7 +87,7 @@ namespace OpenSim.Data.NHibernate
terret[x, y] = br.ReadDouble(); terret[x, y] = br.ReadDouble();
} }
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("Issue parsing Map", e); m_log.Error("Issue parsing Map", e);
@ -99,7 +99,7 @@ namespace OpenSim.Data.NHibernate
{ {
MemoryStream str = new MemoryStream((int)(65536 * sizeof (double))); MemoryStream str = new MemoryStream((int)(65536 * sizeof (double)));
BinaryWriter bw = new BinaryWriter(str); BinaryWriter bw = new BinaryWriter(str);
// TODO: COMPATIBILITY - Add byte-order conversions // TODO: COMPATIBILITY - Add byte-order conversions
for (int x = 0; x < 256; x++) for (int x = 0; x < 256; x++)
{ {
@ -108,11 +108,11 @@ namespace OpenSim.Data.NHibernate
double height = val[x, y]; double height = val[x, y];
if (height <= 0.0) if (height <= 0.0)
height = double.Epsilon; height = double.Epsilon;
bw.Write(height); bw.Write(height);
} }
} }
return str.ToArray(); return str.ToArray();
} }
} }
} }

View File

@ -141,7 +141,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -155,7 +155,7 @@ namespace OpenSim.Data.SQLite
override public void UpdateAsset(AssetBase asset) override public void UpdateAsset(AssetBase asset)
{ {
LogAssetLoad(asset); LogAssetLoad(asset);
lock (this) lock (this)
{ {
using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn))
@ -167,7 +167,7 @@ namespace OpenSim.Data.SQLite
cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local));
cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary));
cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data));
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
} }
} }
@ -269,7 +269,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -301,7 +301,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
// private static void InitDB(SqliteConnection conn) // private static void InitDB(SqliteConnection conn)
@ -312,7 +312,7 @@ namespace OpenSim.Data.SQLite
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
/// <param name="m"></param> /// <param name="m"></param>
@ -331,10 +331,10 @@ namespace OpenSim.Data.SQLite
m_log.Info("[ASSET DB]: SQLite Database doesn't exist... creating"); m_log.Info("[ASSET DB]: SQLite Database doesn't exist... creating");
return false; return false;
} }
// if the tables are here, and we don't have a migration, // if the tables are here, and we don't have a migration,
// set it to 1, as we're migrating off of legacy bits // set it to 1, as we're migrating off of legacy bits
if (m.Version == 0) if (m.Version == 0)
m.Version = 1; m.Version = 1;
return true; return true;
@ -343,7 +343,7 @@ namespace OpenSim.Data.SQLite
#region IPlugin interface #region IPlugin interface
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
override public string Version override public string Version
{ {

View File

@ -55,12 +55,12 @@ namespace OpenSim.Data.SQLite
public void Initialise(string connectionString) public void Initialise(string connectionString)
{ {
m_connectionString = connectionString; m_connectionString = connectionString;
m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString); m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString);
m_connection = new SqliteConnection(m_connectionString); m_connection = new SqliteConnection(m_connectionString);
m_connection.Open(); m_connection.Open();
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration(m_connection, assem, "EstateStore"); Migration m = new Migration(m_connection, assem, "EstateStore");
m.Update(); m.Update();
@ -77,7 +77,7 @@ namespace OpenSim.Data.SQLite
if (f.Name.Substring(0, 2) == "m_") if (f.Name.Substring(0, 2) == "m_")
m_FieldMap[f.Name.Substring(2)] = f; m_FieldMap[f.Name.Substring(2)] = f;
} }
private string[] FieldList private string[] FieldList
{ {
get { return new List<string>(m_FieldMap.Keys).ToArray(); } get { return new List<string>(m_FieldMap.Keys).ToArray(); }
@ -134,7 +134,7 @@ namespace OpenSim.Data.SQLite
names.Remove("EstateID"); names.Remove("EstateID");
sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")"; sql = "insert into estate_settings ("+String.Join(",", names.ToArray())+") values ( :"+String.Join(", :", names.ToArray())+")";
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.Parameters.Clear(); cmd.Parameters.Clear();
@ -272,16 +272,16 @@ namespace OpenSim.Data.SQLite
private void SaveBanList(EstateSettings es) private void SaveBanList(EstateSettings es)
{ {
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from estateban where EstateID = :EstateID"; cmd.CommandText = "delete from estateban where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )"; cmd.CommandText = "insert into estateban (EstateID, bannedUUID, bannedIp, bannedIpHostMask, bannedNameMask) values ( :EstateID, :bannedUUID, '', '', '' )";
foreach (EstateBan b in es.EstateBans) foreach (EstateBan b in es.EstateBans)
{ {
cmd.Parameters.Add(":EstateID", es.EstateID.ToString()); cmd.Parameters.Add(":EstateID", es.EstateID.ToString());
@ -295,16 +295,16 @@ namespace OpenSim.Data.SQLite
void SaveUUIDList(uint EstateID, string table, LLUUID[] data) void SaveUUIDList(uint EstateID, string table, LLUUID[] data)
{ {
SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand(); SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand();
cmd.CommandText = "delete from "+table+" where EstateID = :EstateID"; cmd.CommandText = "delete from "+table+" where EstateID = :EstateID";
cmd.Parameters.Add(":EstateID", EstateID.ToString()); cmd.Parameters.Add(":EstateID", EstateID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
cmd.Parameters.Clear(); cmd.Parameters.Clear();
cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )"; cmd.CommandText = "insert into "+table+" (EstateID, uuid) values ( :EstateID, :uuid )";
foreach (LLUUID uuid in data) foreach (LLUUID uuid in data)
{ {
cmd.Parameters.Add(":EstateID", EstateID.ToString()); cmd.Parameters.Add(":EstateID", EstateID.ToString());
@ -336,7 +336,7 @@ namespace OpenSim.Data.SQLite
uuids.Add(uuid); uuids.Add(uuid);
} }
r.Close(); r.Close();
return uuids.ToArray(); return uuids.ToArray();
} }
} }

View File

@ -50,8 +50,8 @@ namespace OpenSim.Data.SQLite
private SqliteDataAdapter invItemsDa; private SqliteDataAdapter invItemsDa;
private SqliteDataAdapter invFoldersDa; private SqliteDataAdapter invFoldersDa;
public void Initialise() public void Initialise()
{ {
m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!"); m_log.Info("[SQLiteInventoryData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -105,7 +105,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -150,7 +150,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="item"></param> /// <param name="item"></param>
@ -302,7 +302,7 @@ namespace OpenSim.Data.SQLite
/// <returns>A string containing the DB provider version</returns> /// <returns>A string containing the DB provider version</returns>
public string Version public string Version
{ {
get get
{ {
Module module = GetType().Module; Module module = GetType().Module;
// string dllName = module.Assembly.ManifestModule.Name; // string dllName = module.Assembly.ManifestModule.Name;
@ -419,10 +419,10 @@ namespace OpenSim.Data.SQLite
* - We will only need to hit the database twice instead of n times. * - We will only need to hit the database twice instead of n times.
* - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned * - We assume the database is well-formed - no stranded/dangling folders, all folders in heirarchy owned
* by the same person, each user only has 1 inventory heirarchy * by the same person, each user only has 1 inventory heirarchy
* - The returned list is not ordered, instead of breadth-first ordered * - The returned list is not ordered, instead of breadth-first ordered
There are basically 2 usage cases for getFolderHeirarchy: There are basically 2 usage cases for getFolderHeirarchy:
1) Getting the user's entire inventory heirarchy when they log in 1) Getting the user's entire inventory heirarchy when they log in
2) Finding a subfolder heirarchy to delete when emptying the trash. 2) Finding a subfolder heirarchy to delete when emptying the trash.
This implementation will pull all inventory folders from the database, and then prune away any folder that This implementation will pull all inventory folders from the database, and then prune away any folder that
is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the is not part of the requested sub-heirarchy. The theory is that it is cheaper to make 1 request from the
database than to make n requests. This pays off only if requested heirarchy is large. database than to make n requests. This pays off only if requested heirarchy is large.
@ -449,17 +449,17 @@ namespace OpenSim.Data.SQLite
folderRows = inventoryFolderTable.Select(selectExp); folderRows = inventoryFolderTable.Select(selectExp);
} }
if ( folderRows!=null && folderRows.GetLength(0)>=1 ) // No result means parent folder does not exist if (folderRows != null && folderRows.GetLength(0) >= 1) // No result means parent folder does not exist
{ // or has no children { // or has no children
/* if we're querying the root folder, just return an unordered list of all folders in the user's /* if we're querying the root folder, just return an unordered list of all folders in the user's
* inventory * inventory
*/ */
if (parentFolder.ParentID == LLUUID.Zero) if (parentFolder.ParentID == LLUUID.Zero)
{ {
foreach (DataRow row in folderRows) foreach (DataRow row in folderRows)
{ {
InventoryFolderBase curFolder = buildFolder(row); InventoryFolderBase curFolder = buildFolder(row);
if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy if (curFolder.ID != parentID) // Return all folders except the parent folder of heirarchy
folders.Add(buildFolder(row)); folders.Add(buildFolder(row));
} }
} // If requesting root folder } // If requesting root folder
@ -481,16 +481,16 @@ namespace OpenSim.Data.SQLite
InventoryFolderBase curFolder = buildFolder(row); InventoryFolderBase curFolder = buildFolder(row);
if (curFolder.ParentID != LLUUID.Zero) // Discard root of tree - not needed if (curFolder.ParentID != LLUUID.Zero) // Discard root of tree - not needed
{ {
if ( hashtable.ContainsKey(curFolder.ParentID ) ) if (hashtable.ContainsKey(curFolder.ParentID))
{ {
// Current folder already has a sibling - append to sibling list // Current folder already has a sibling - append to sibling list
hashtable[curFolder.ParentID].Add( curFolder ); hashtable[curFolder.ParentID].Add(curFolder);
} }
else { else {
List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>(); List<InventoryFolderBase> siblingList = new List<InventoryFolderBase>();
siblingList.Add( curFolder ); siblingList.Add(curFolder);
// Current folder has no known (yet) siblings // Current folder has no known (yet) siblings
hashtable.Add( curFolder.ParentID, siblingList ); hashtable.Add(curFolder.ParentID, siblingList);
} }
} }
} // For all inventory folders } // For all inventory folders
@ -498,12 +498,12 @@ namespace OpenSim.Data.SQLite
// Note: Could release the ds lock here - we don't access folderRows or the database anymore. // Note: Could release the ds lock here - we don't access folderRows or the database anymore.
// This is somewhat of a moot point as the callers of this function usually lock db anyways. // This is somewhat of a moot point as the callers of this function usually lock db anyways.
if ( hashtable.ContainsKey( parentID ) ) // if requested folder does have children if (hashtable.ContainsKey(parentID)) // if requested folder does have children
folders.AddRange( hashtable[parentID] ); folders.AddRange(hashtable[parentID]);
// BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static // BreadthFirstSearch build inventory tree **Note: folders.Count is *not* static
for ( int i = 0; i < folders.Count; i++ ) for (int i = 0; i < folders.Count; i++)
if (hashtable.ContainsKey(folders[i].ID)) if (hashtable.ContainsKey(folders[i].ID))
folders.AddRange(hashtable[folders[i].ID]); folders.AddRange(hashtable[folders[i].ID]);
} // if requesting a subfolder heirarchy } // if requesting a subfolder heirarchy
@ -601,7 +601,7 @@ namespace OpenSim.Data.SQLite
/// Delete all items in the specified folder /// Delete all items in the specified folder
/// </summary> /// </summary>
/// <param name="folderId">id of the folder, whose item content should be deleted</param> /// <param name="folderId">id of the folder, whose item content should be deleted</param>
/// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo> /// <todo>this is horribly inefficient, but I don't want to ruin the overall structure of this implementation</todo>
private void deleteItemsInFolder(LLUUID folderId) private void deleteItemsInFolder(LLUUID folderId)
{ {
List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId)); List<InventoryItemBase> items = getInventoryInFolder(Util.ToRawUuidString(folderId));
@ -743,7 +743,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -765,7 +765,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -787,7 +787,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -804,7 +804,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="folder"></param> /// <param name="folder"></param>
@ -819,7 +819,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="folder"></param> /// <param name="folder"></param>
@ -836,7 +836,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
// private static void InitDB(SqliteConnection conn) // private static void InitDB(SqliteConnection conn)
@ -852,7 +852,7 @@ namespace OpenSim.Data.SQLite
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
/// <param name="m"></param> /// <param name="m"></param>

View File

@ -501,7 +501,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="globalID"></param> /// <param name="globalID"></param>
public void RemoveLandObject(LLUUID globalID) public void RemoveLandObject(LLUUID globalID)
@ -523,7 +523,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="parcel"></param> /// <param name="parcel"></param>
public void StoreLandObject(ILandObject parcel) public void StoreLandObject(ILandObject parcel)
@ -564,7 +564,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="regionUUID"></param> /// <param name="regionUUID"></param>
/// <returns></returns> /// <returns></returns>
@ -594,7 +594,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public void Commit() public void Commit()
{ {
@ -629,7 +629,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="dt"></param> /// <param name="dt"></param>
/// <param name="name"></param> /// <param name="name"></param>
@ -877,7 +877,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1071,7 +1071,7 @@ namespace OpenSim.Data.SQLite
newData.UserLookAt = newData.UserLookAt =
new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]), new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
Convert.ToSingle(row["UserLookAtZ"])); Convert.ToSingle(row["UserLookAtZ"]));
} }
catch (InvalidCastException) catch (InvalidCastException)
{ {
@ -1132,7 +1132,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="val"></param> /// <param name="val"></param>
/// <returns></returns> /// <returns></returns>
@ -1166,7 +1166,7 @@ namespace OpenSim.Data.SQLite
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="prim"></param> /// <param name="prim"></param>
@ -1233,7 +1233,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="taskItem"></param> /// <param name="taskItem"></param>
@ -1263,7 +1263,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="land"></param> /// <param name="land"></param>
@ -1308,7 +1308,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="entry"></param> /// <param name="entry"></param>
@ -1321,7 +1321,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -1376,7 +1376,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="prim"></param> /// <param name="prim"></param>
@ -1418,7 +1418,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="prim"></param> /// <param name="prim"></param>
/// <param name="sceneGroupID"></param> /// <param name="sceneGroupID"></param>
@ -1574,7 +1574,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="dt">Data Table</param> /// <param name="dt">Data Table</param>
/// <returns></returns> /// <returns></returns>
@ -1631,7 +1631,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1650,7 +1650,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1669,7 +1669,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1680,7 +1680,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1694,7 +1694,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1705,7 +1705,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -1799,7 +1799,7 @@ namespace OpenSim.Data.SQLite
// } // }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
/// <param name="m"></param> /// <param name="m"></param>
@ -1845,8 +1845,8 @@ namespace OpenSim.Data.SQLite
// if we've gotten this far, and our version is still 0, // if we've gotten this far, and our version is still 0,
// it's because the migration was never done, so // it's because the migration was never done, so
// initialize to 1 just to sync up to where we should be. // initialize to 1 just to sync up to where we should be.
if (m.Version == 0) if (m.Version == 0)
m.Version = 1; m.Version = 1;
// pDa.Fill(tmpDS, "prims"); // pDa.Fill(tmpDS, "prims");

View File

@ -65,8 +65,8 @@ namespace OpenSim.Data.SQLite
private SqliteDataAdapter daf; private SqliteDataAdapter daf;
SqliteConnection g_conn; SqliteConnection g_conn;
public override void Initialise() public override void Initialise()
{ {
m_log.Info("[SQLiteUserData]: " + Name + " cannot be default-initialized!"); m_log.Info("[SQLiteUserData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -93,7 +93,7 @@ namespace OpenSim.Data.SQLite
Assembly assem = GetType().Assembly; Assembly assem = GetType().Assembly;
Migration m = new Migration(g_conn, assem, "UserStore"); Migration m = new Migration(g_conn, assem, "UserStore");
// TODO: remove this after rev 6000 // TODO: remove this after rev 6000
TestTables(conn, m); TestTables(conn, m);
@ -130,7 +130,7 @@ namespace OpenSim.Data.SQLite
return; return;
} }
public override void Dispose () {} public override void Dispose () {}
/// <summary> /// <summary>
/// see IUserDataPlugin, /// see IUserDataPlugin,
@ -308,7 +308,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="queryID"></param> /// <param name="queryID"></param>
/// <param name="query"></param> /// <param name="query"></param>
@ -570,7 +570,7 @@ namespace OpenSim.Data.SQLite
} }
return aa; return aa;
} }
/// <summary> /// <summary>
/// Update a user appearence /// Update a user appearence
/// </summary> /// </summary>
@ -802,7 +802,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="user"></param> /// <param name="user"></param>
@ -853,7 +853,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <returns></returns> /// <returns></returns>
@ -881,7 +881,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="row"></param> /// <param name="row"></param>
/// <param name="ua"></param> /// <param name="ua"></param>
@ -914,7 +914,7 @@ namespace OpenSim.Data.SQLite
**********************************************************************/ **********************************************************************/
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="da"></param> /// <param name="da"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -933,7 +933,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="daf"></param> /// <param name="daf"></param>
/// <param name="conn"></param> /// <param name="conn"></param>
@ -954,7 +954,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
private static void InitDB(SqliteConnection conn) private static void InitDB(SqliteConnection conn)
@ -990,7 +990,7 @@ namespace OpenSim.Data.SQLite
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="conn"></param> /// <param name="conn"></param>
/// <param name="m"></param> /// <param name="m"></param>
@ -1016,7 +1016,7 @@ namespace OpenSim.Data.SQLite
return false; return false;
} }
if (m.Version == 0) if (m.Version == 0)
m.Version = 1; m.Version = 1;
return true; return true;

View File

@ -75,7 +75,7 @@ namespace OpenSim.Data
public abstract void AddAttachment(LLUUID user, LLUUID item); public abstract void AddAttachment(LLUUID user, LLUUID item);
public abstract void RemoveAttachment(LLUUID user, LLUUID item); public abstract void RemoveAttachment(LLUUID user, LLUUID item);
public abstract List<LLUUID> GetAttachments(LLUUID user); public abstract List<LLUUID> GetAttachments(LLUUID user);
public abstract string Version {get;} public abstract string Version {get;}
public abstract string Name {get;} public abstract string Name {get;}
public abstract void Initialise(string connect); public abstract void Initialise(string connect);

View File

@ -371,7 +371,7 @@ namespace OpenSim.Framework
VisualParams = (byte[])h["visual_params"]; VisualParams = (byte[])h["visual_params"];
Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length); Texture = new LLObject.TextureEntry((byte[])h["texture"], 0, ((byte[])h["texture"]).Length);
AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]); AvatarHeight = (float)Convert.ToDouble((string)h["avatar_height"]);
m_wearables = new AvatarWearable[MAX_WEARABLES]; m_wearables = new AvatarWearable[MAX_WEARABLES];
for (int i = 0; i < MAX_WEARABLES; i++) for (int i = 0; i < MAX_WEARABLES; i++)
{ {

View File

@ -380,7 +380,7 @@ namespace Opensim.Framework
default: default:
return; return;
} }
Store(index, data, container); Store(index, data, container);
} }
@ -403,7 +403,7 @@ namespace Opensim.Framework
if ((m_Flags & CacheFlags.AllowUpdate) != 0) if ((m_Flags & CacheFlags.AllowUpdate) != 0)
{ {
item = GetItem(index); item = GetItem(index);
item.hits++; item.hits++;
item.lastUsed = DateTime.Now; item.lastUsed = DateTime.Now;
if (m_DefaultTTL.Ticks != 0) if (m_DefaultTTL.Ticks != 0)

View File

@ -143,10 +143,10 @@ namespace OpenSim.Framework.Communications.Cache
public void Clear() public void Clear()
{ {
m_log.Info("[ASSET CACHE]: Clearing Asset cache"); m_log.Info("[ASSET CACHE]: Clearing Asset cache");
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
StatsManager.SimExtraStats.ClearAssetCacheStatistics(); StatsManager.SimExtraStats.ClearAssetCacheStatistics();
Initialize(); Initialize();
} }
@ -365,9 +365,9 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
else else
{ {
if (!Assets.ContainsKey(asset.FullID)) if (!Assets.ContainsKey(asset.FullID))
{ {
AssetInfo assetInf = new AssetInfo(asset); AssetInfo assetInf = new AssetInfo(asset);
Assets.Add(assetInf.FullID, assetInf); Assets.Add(assetInf.FullID, assetInf);
@ -382,7 +382,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
/// <summary> /// <summary>
/// Allows you to clear a specific asset by uuid out /// Allows you to clear a specific asset by uuid out
/// of the asset cache. This is needed because the osdynamic /// of the asset cache. This is needed because the osdynamic
/// texture code grows the asset cache without bounds. The /// texture code grows the asset cache without bounds. The
@ -399,8 +399,8 @@ namespace OpenSim.Framework.Communications.Cache
if (Textures.ContainsKey(uuid)) if (Textures.ContainsKey(uuid))
{ {
Textures.Remove(uuid); Textures.Remove(uuid);
} }
else if (Assets.ContainsKey(uuid)) else if (Assets.ContainsKey(uuid))
{ {
Assets.Remove(uuid); Assets.Remove(uuid);
} }

View File

@ -57,7 +57,7 @@ namespace OpenSim.Framework.Communications.Cache
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="System.Exception"> /// <exception cref="System.Exception">
/// Thrown if the request failed for some other reason than that the /// Thrown if the request failed for some other reason than that the
/// asset cannot be found. /// asset cannot be found.
/// </exception> /// </exception>
protected abstract AssetBase GetAsset(AssetRequest req); protected abstract AssetBase GetAsset(AssetRequest req);
@ -70,7 +70,7 @@ namespace OpenSim.Framework.Communications.Cache
protected virtual void ProcessRequest(AssetRequest req) protected virtual void ProcessRequest(AssetRequest req)
{ {
AssetBase asset; AssetBase asset;
try try
{ {
asset = GetAsset(req); asset = GetAsset(req);
@ -78,12 +78,12 @@ namespace OpenSim.Framework.Communications.Cache
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat("[ASSET]: Asset request for {0} threw exception {1}", req.AssetID, e); m_log.ErrorFormat("[ASSET]: Asset request for {0} threw exception {1}", req.AssetID, e);
if (StatsManager.SimExtraStats != null) if (StatsManager.SimExtraStats != null)
StatsManager.SimExtraStats.AddAssetServiceRequestFailure(); StatsManager.SimExtraStats.AddAssetServiceRequestFailure();
m_receiver.AssetNotFound(req.AssetID, req.IsTexture); m_receiver.AssetNotFound(req.AssetID, req.IsTexture);
return; return;
} }

View File

@ -91,8 +91,8 @@ namespace OpenSim.Framework.Communications.Cache
get { return m_session_id; } get { return m_session_id; }
set { m_session_id = value; } set { m_session_id = value; }
} }
private LLUUID m_session_id = LLUUID.Zero; private LLUUID m_session_id = LLUUID.Zero;
/// <summary> /// <summary>
/// Constructor /// Constructor
/// </summary> /// </summary>
@ -172,7 +172,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
} }
/// <summary> /// <summary>
/// Drop all cached inventory. /// Drop all cached inventory.
/// </summary> /// </summary>

View File

@ -60,7 +60,7 @@ namespace OpenSim.Framework.Communications.Cache
rc.AddQueryParameter("texture"); rc.AddQueryParameter("texture");
rc.RequestMethod = "GET"; rc.RequestMethod = "GET";
Stream s = rc.Request(); Stream s = rc.Request();
if (s.Length > 0) if (s.Length > 0)

View File

@ -37,19 +37,19 @@ namespace OpenSim.Framework.Communications.Cache
public class InventoryFolderImpl : InventoryFolderBase public class InventoryFolderImpl : InventoryFolderBase
{ {
//private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public static readonly string PATH_DELIMITER = "/"; public static readonly string PATH_DELIMITER = "/";
/// <summary> /// <summary>
/// Items that are contained in this folder /// Items that are contained in this folder
/// </summary> /// </summary>
public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>(); public Dictionary<LLUUID, InventoryItemBase> Items = new Dictionary<LLUUID, InventoryItemBase>();
/// <summary> /// <summary>
/// Child folders that are contained in this folder /// Child folders that are contained in this folder
/// </summary> /// </summary>
public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>(); public Dictionary<LLUUID, InventoryFolderImpl> SubFolders = new Dictionary<LLUUID, InventoryFolderImpl>();
// Constructors // Constructors
public InventoryFolderImpl(InventoryFolderBase folderbase) public InventoryFolderImpl(InventoryFolderBase folderbase)
{ {
@ -195,15 +195,15 @@ namespace OpenSim.Framework.Communications.Cache
return null; return null;
} }
/// <summary> /// <summary>
/// Find a folder given a PATH_DELIMITOR delimited path starting from this folder /// Find a folder given a PATH_DELIMITOR delimited path starting from this folder
/// ///
/// This method does not handle paths that contain multiple delimitors /// This method does not handle paths that contain multiple delimitors
/// ///
/// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some /// FIXME: We do not yet handle situations where folders have the same name. We could handle this by some
/// XPath like expression /// XPath like expression
/// ///
/// FIXME: Delimitors which occur in names themselves are not currently escapable. /// FIXME: Delimitors which occur in names themselves are not currently escapable.
/// </summary> /// </summary>
/// <param name="path"> /// <param name="path">
@ -214,7 +214,7 @@ namespace OpenSim.Framework.Communications.Cache
{ {
if (path == string.Empty) if (path == string.Empty)
return this; return this;
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
lock (SubFolders) lock (SubFolders)
@ -228,19 +228,19 @@ namespace OpenSim.Framework.Communications.Cache
return folder; return folder;
} }
} }
// We didn't find a folder with the given name // We didn't find a folder with the given name
return null; return null;
} }
/// <summary> /// <summary>
/// Find an item given a PATH_DELIMITOR delimited path starting from this folder. /// Find an item given a PATH_DELIMITOR delimited path starting from this folder.
/// ///
/// This method does not handle paths that contain multiple delimitors /// This method does not handle paths that contain multiple delimitors
/// ///
/// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some /// FIXME: We do not yet handle situations where folders or items have the same name. We could handle this by some
/// XPath like expression /// XPath like expression
/// ///
/// FIXME: Delimitors which occur in names themselves are not currently escapable. /// FIXME: Delimitors which occur in names themselves are not currently escapable.
/// </summary> /// </summary>
/// <param name="path"> /// <param name="path">
@ -248,7 +248,7 @@ namespace OpenSim.Framework.Communications.Cache
/// </param> /// </param>
/// <returns>null if the item is not found</returns> /// <returns>null if the item is not found</returns>
public InventoryItemBase FindItemByPath(string path) public InventoryItemBase FindItemByPath(string path)
{ {
string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None); string[] components = path.Split(new string[] { PATH_DELIMITER }, 2, StringSplitOptions.None);
if (components.Length == 1) if (components.Length == 1)
@ -263,7 +263,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
else else
{ {
lock (SubFolders) lock (SubFolders)
{ {
foreach (InventoryFolderImpl folder in SubFolders.Values) foreach (InventoryFolderImpl folder in SubFolders.Values)
@ -273,10 +273,10 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
} }
// We didn't find an item or intermediate folder with the given name // We didn't find an item or intermediate folder with the given name
return null; return null;
} }
/// <summary> /// <summary>
/// Return a copy of the list of child items in this folder /// Return a copy of the list of child items in this folder

View File

@ -90,7 +90,7 @@ namespace OpenSim.Framework.Communications.Cache
m_log.WarnFormat( m_log.WarnFormat(
"[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userId); "[USER CACHE]: Tried to remove the profile of user {0}, but this was not in the scene", userId);
return false; return false;
} }

View File

@ -422,7 +422,7 @@ namespace OpenSim.Framework.Communications.Capabilities
mapLayer.Right = 5000; mapLayer.Right = 5000;
mapLayer.Top = 5000; mapLayer.Top = 5000;
mapLayer.ImageID = new LLUUID("00000000-0000-1111-9999-000000000006"); mapLayer.ImageID = new LLUUID("00000000-0000-1111-9999-000000000006");
return mapLayer; return mapLayer;
} }
@ -783,7 +783,7 @@ namespace OpenSim.Framework.Communications.Capabilities
// TODO: probably make this a better set of extensions here // TODO: probably make this a better set of extensions here
string extension = ".jp2"; string extension = ".jp2";
if (m_invType != "image") if (m_invType != "image")
{ {
extension = ".dat"; extension = ".dat";
} }

View File

@ -34,7 +34,7 @@ namespace OpenSim.Framework.Communications.Capabilities
public class LLSDRemoteParcelResponse public class LLSDRemoteParcelResponse
{ {
public LLUUID parcel_id; public LLUUID parcel_id;
public LLSDRemoteParcelResponse() public LLSDRemoteParcelResponse()
{ {
} }

View File

@ -41,26 +41,26 @@ namespace OpenSim.Framework.Communications
public class CommunicationsManager public class CommunicationsManager
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected Dictionary<LLUUID, string[]> m_nameRequestCache = new Dictionary<LLUUID, string[]>(); protected Dictionary<LLUUID, string[]> m_nameRequestCache = new Dictionary<LLUUID, string[]>();
public IUserService UserService public IUserService UserService
{ {
get { return m_userService; } get { return m_userService; }
} }
protected IUserService m_userService; protected IUserService m_userService;
public IGridServices GridService public IGridServices GridService
{ {
get { return m_gridService; } get { return m_gridService; }
} }
protected IGridServices m_gridService; protected IGridServices m_gridService;
public IInterRegionCommunications InterRegion public IInterRegionCommunications InterRegion
{ {
get { return m_interRegion; } get { return m_interRegion; }
} }
protected IInterRegionCommunications m_interRegion; protected IInterRegionCommunications m_interRegion;
public UserProfileCacheService UserProfileCacheService public UserProfileCacheService UserProfileCacheService
{ {
@ -68,36 +68,36 @@ namespace OpenSim.Framework.Communications
} }
protected UserProfileCacheService m_userProfileCacheService; protected UserProfileCacheService m_userProfileCacheService;
// protected AgentAssetTransactionsManager m_transactionsManager; // protected AgentAssetTransactionsManager m_transactionsManager;
// public AgentAssetTransactionsManager TransactionsManager // public AgentAssetTransactionsManager TransactionsManager
// { // {
// get { return m_transactionsManager; } // get { return m_transactionsManager; }
// } // }
public IAvatarService AvatarService public IAvatarService AvatarService
{ {
get { return m_avatarService; } get { return m_avatarService; }
} }
protected IAvatarService m_avatarService; protected IAvatarService m_avatarService;
public AssetCache AssetCache public AssetCache AssetCache
{ {
get { return m_assetCache; } get { return m_assetCache; }
} }
protected AssetCache m_assetCache; protected AssetCache m_assetCache;
public IInterServiceInventoryServices InterServiceInventoryService public IInterServiceInventoryServices InterServiceInventoryService
{ {
get { return m_interServiceInventoryService; } get { return m_interServiceInventoryService; }
} }
protected IInterServiceInventoryServices m_interServiceInventoryService; protected IInterServiceInventoryServices m_interServiceInventoryService;
public NetworkServersInfo NetworkServersInfo public NetworkServersInfo NetworkServersInfo
{ {
get { return m_networkServersInfo; } get { return m_networkServersInfo; }
} }
protected NetworkServersInfo m_networkServersInfo; protected NetworkServersInfo m_networkServersInfo;
/// <summary> /// <summary>
/// Constructor /// Constructor
@ -138,7 +138,7 @@ namespace OpenSim.Framework.Communications
return null; return null;
} }
} }
public IInventoryServices InventoryService public IInventoryServices InventoryService
{ {
get get

View File

@ -33,7 +33,7 @@ namespace OpenSim.Framework.Communications
public interface IGridServices public interface IGridServices
{ {
string gdebugRegionName { get; set; } string gdebugRegionName { get; set; }
/// <summary> /// <summary>
/// Register a region with the grid service. /// Register a region with the grid service.
/// </summary> /// </summary>
@ -41,7 +41,7 @@ namespace OpenSim.Framework.Communications
/// <returns></returns> /// <returns></returns>
/// <exception cref="System.Exception">Thrown if region registration failed</exception> /// <exception cref="System.Exception">Thrown if region registration failed</exception>
RegionCommsListener RegisterRegion(RegionInfo regionInfos); RegionCommsListener RegisterRegion(RegionInfo regionInfos);
bool DeregisterRegion(RegionInfo regionInfo); bool DeregisterRegion(RegionInfo regionInfo);
/// <summary> /// <summary>
@ -51,7 +51,7 @@ namespace OpenSim.Framework.Communications
/// <param name="y"></param> /// <param name="y"></param>
/// <returns></returns> /// <returns></returns>
List<SimpleRegionInfo> RequestNeighbours(uint x, uint y); List<SimpleRegionInfo> RequestNeighbours(uint x, uint y);
RegionInfo RequestNeighbourInfo(ulong regionHandle); RegionInfo RequestNeighbourInfo(ulong regionHandle);
RegionInfo RequestNeighbourInfo(LLUUID regionID); RegionInfo RequestNeighbourInfo(LLUUID regionID);
RegionInfo RequestClosestRegion(string regionName); RegionInfo RequestClosestRegion(string regionName);

View File

@ -32,22 +32,22 @@ namespace OpenSim.Framework.Communications
{ {
/// <summary> /// <summary>
/// Inventory operations used between grid services. /// Inventory operations used between grid services.
/// </summary> /// </summary>
public interface IInterServiceInventoryServices public interface IInterServiceInventoryServices
{ {
/// <summary> /// <summary>
/// Create a new inventory for the given user. /// Create a new inventory for the given user.
/// </summary> /// </summary>
/// <param name="user"></param> /// <param name="user"></param>
/// <returns>true if the inventory was successfully created, false otherwise</returns> /// <returns>true if the inventory was successfully created, false otherwise</returns>
bool CreateNewUserInventory(LLUUID user); bool CreateNewUserInventory(LLUUID user);
/// <summary> /// <summary>
/// Returns a list of all the folders in a given user's inventory. /// Returns a list of all the folders in a given user's inventory.
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <returns>A flat list of the user's inventory folder tree, /// <returns>A flat list of the user's inventory folder tree,
/// null if there is no inventory for this user</returns> /// null if there is no inventory for this user</returns>
List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId); List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId);
} }
} }

View File

@ -41,12 +41,12 @@ namespace OpenSim.Framework.Communications
/// Defines all the operations one can perform on a user's inventory. /// Defines all the operations one can perform on a user's inventory.
/// </summary> /// </summary>
public interface IInventoryServices public interface IInventoryServices
{ {
string Host string Host
{ {
get; get;
} }
/// <summary> /// <summary>
/// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
/// inventory has been received /// inventory has been received

View File

@ -40,7 +40,7 @@ namespace OpenSim.Framework.Communications
{ {
get; get;
} }
/// <summary> /// <summary>
/// Request the inventory for a user. This is an asynchronous operation that will call the callback when the /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
/// inventory has been received /// inventory has been received
@ -102,14 +102,14 @@ namespace OpenSim.Framework.Communications
/// Does the given user have an inventory structure? /// Does the given user have an inventory structure?
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns></returns>
bool HasInventoryForUser(LLUUID userID); bool HasInventoryForUser(LLUUID userID);
/// <summary> /// <summary>
/// Retrieve the root inventory folder for the given user. /// Retrieve the root inventory folder for the given user.
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns>null if no root folder was found</returns> /// <returns>null if no root folder was found</returns>
InventoryFolderBase RequestRootFolder(LLUUID userID); InventoryFolderBase RequestRootFolder(LLUUID userID);
} }
} }

View File

@ -53,14 +53,14 @@ namespace OpenSim.Framework.Communications
/// <param name="provider">The filename to the user server plugin DLL</param> /// <param name="provider">The filename to the user server plugin DLL</param>
public void AddPlugin(string provider, string connect) public void AddPlugin(string provider, string connect)
{ {
PluginLoader<IInventoryDataPlugin> loader = PluginLoader<IInventoryDataPlugin> loader =
new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser (connect)); new PluginLoader<IInventoryDataPlugin> (new InventoryDataInitialiser (connect));
// loader will try to load all providers (MySQL, MSSQL, etc) // loader will try to load all providers (MySQL, MSSQL, etc)
// unless it is constrainted to the correct "Provider" entry in the addin.xml // unless it is constrainted to the correct "Provider" entry in the addin.xml
loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter (provider)); loader.Add ("/OpenSim/InventoryData", new PluginProviderFilter (provider));
loader.Load(); loader.Load();
m_plugins = loader.Plugins; m_plugins = loader.Plugins;
} }

View File

@ -79,7 +79,7 @@ namespace OpenSim.Framework.Communications
/// <param name="response">The existing response</param> /// <param name="response">The existing response</param>
/// <param name="theUser">The user profile</param> /// <param name="theUser">The user profile</param>
public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest); public abstract void CustomiseResponse(LoginResponse response, UserProfileData theUser, string startLocationRequest);
/// <summary> /// <summary>
/// If the user is already logged in, try to notify the region that the user they've got is dead. /// If the user is already logged in, try to notify the region that the user they've got is dead.
/// </summary> /// </summary>
@ -206,12 +206,11 @@ namespace OpenSim.Framework.Communications
userProfile.CurrentAgent.AgentOnline = false; userProfile.CurrentAgent.AgentOnline = false;
m_userManager.CommitAgent(ref userProfile); m_userManager.CommitAgent(ref userProfile);
// try to tell the region that their user is dead. // try to tell the region that their user is dead.
LogOffUser(userProfile, " XMLRPC You were logged off because you logged in from another location"); LogOffUser(userProfile, " XMLRPC You were logged off because you logged in from another location");
// Reject the login // Reject the login
m_log.InfoFormat( m_log.InfoFormat(
"[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in", "[LOGIN END]: XMLRPC Notifying user {0} {1} that they are already logged in",
@ -293,7 +292,7 @@ namespace OpenSim.Framework.Communications
//return logResponse.ToXmlRpcResponse(); //return logResponse.ToXmlRpcResponse();
} }
userProfile.LastLogin = userProfile.CurrentAgent.LoginTime; userProfile.LastLogin = userProfile.CurrentAgent.LoginTime;
CommitAgent(ref userProfile); CommitAgent(ref userProfile);
// If we reach this point, then the login has successfully logged onto the grid // If we reach this point, then the login has successfully logged onto the grid

View File

@ -57,11 +57,11 @@ namespace OpenSim.Framework.Communications
PluginLoader<IUserDataPlugin> loader = PluginLoader<IUserDataPlugin> loader =
new PluginLoader<IUserDataPlugin> (new UserDataInitialiser (connect)); new PluginLoader<IUserDataPlugin> (new UserDataInitialiser (connect));
// loader will try to load all providers (MySQL, MSSQL, etc) // loader will try to load all providers (MySQL, MSSQL, etc)
// unless it is constrainted to the correct "Provider" entry in the addin.xml // unless it is constrainted to the correct "Provider" entry in the addin.xml
loader.Add ("/OpenSim/UserData", new PluginProviderFilter (provider)); loader.Add ("/OpenSim/UserData", new PluginProviderFilter (provider));
loader.Load(); loader.Load();
_plugins = loader.Plugins; _plugins = loader.Plugins;
} }

View File

@ -46,7 +46,7 @@ namespace OpenSim.Framework.Configuration.XML
private void LoadDataToClass() private void LoadDataToClass()
{ {
rootNode = doc.SelectSingleNode("Root"); rootNode = doc.SelectSingleNode("Root");
if (null == rootNode) if (null == rootNode)
throw new Exception("Error: Invalid .xml File. Missing <Root>"); throw new Exception("Error: Invalid .xml File. Missing <Root>");
@ -135,4 +135,4 @@ namespace OpenSim.Framework.Configuration.XML
doc = null; doc = null;
} }
} }
} }

View File

@ -42,7 +42,7 @@ namespace OpenSim.Framework.Console
private readonly object m_syncRoot = new object(); private readonly object m_syncRoot = new object();
public conscmd_callback m_cmdParser; public conscmd_callback m_cmdParser;
/// <summary> /// <summary>
/// The default prompt text. /// The default prompt text.
/// </summary> /// </summary>
@ -249,7 +249,7 @@ namespace OpenSim.Framework.Console
{ {
line = System.Console.ReadLine(); line = System.Console.ReadLine();
} }
return line; return line;
} }
catch (Exception e) catch (Exception e)

View File

@ -30,10 +30,10 @@ using System;
namespace OpenSim.Framework.Console namespace OpenSim.Framework.Console
{ {
public delegate void ConsoleCommand(string[] comParams); public delegate void ConsoleCommand(string[] comParams);
/// <summary> /// <summary>
/// Holder object for a new console plugin command /// Holder object for a new console plugin command
/// ///
/// Override the methods like Run and IsHelpfull (but the defaults might work ok.) /// Override the methods like Run and IsHelpfull (but the defaults might work ok.)
/// </summary> /// </summary>
public class ConsolePluginCommand public class ConsolePluginCommand
@ -52,10 +52,10 @@ namespace OpenSim.Framework.Console
private string[] m_cmdText; private string[] m_cmdText;
/// <summary> /// <summary>
/// Construct a new ConsolePluginCommand /// Construct a new ConsolePluginCommand
/// ///
/// for use with OpenSim.RegisterConsolePluginCommand(myCmd); /// for use with OpenSim.RegisterConsolePluginCommand(myCmd);
/// ///
/// </summary> /// </summary>
/// <param name="command">in the form of "showme new commands"</param> /// <param name="command">in the form of "showme new commands"</param>
/// <param name="dlg">ommand delegate used in running</param> /// <param name="dlg">ommand delegate used in running</param>
@ -68,13 +68,13 @@ namespace OpenSim.Framework.Console
} }
/// <summary> /// <summary>
/// Returns the match length this command has upon the 'cmdWithParams' /// Returns the match length this command has upon the 'cmdWithParams'
/// At least a higher number for "show plugin status" then "show" would return /// At least a higher number for "show plugin status" then "show" would return
/// This is used to have multi length command verbs /// This is used to have multi length command verbs
/// ///
/// @see OopenSim.RunPluginCommands /// @see OopenSim.RunPluginCommands
/// It will only run the one with the highest number /// It will only run the one with the highest number
/// ///
/// </summary> /// </summary>
public int matchLength(string cmdWithParams) public int matchLength(string cmdWithParams)
{ {
@ -106,8 +106,8 @@ namespace OpenSim.Framework.Console
} }
currentParam++; currentParam++;
} }
} }
string[] sendCmdParams = cmdParams; string[] sendCmdParams = cmdParams;
if (skipParams > 0) if (skipParams > 0)
{ {

View File

@ -39,7 +39,7 @@ namespace OpenSim.Framework.Console
{ {
override protected void Append(LoggingEvent le) override protected void Append(LoggingEvent le)
{ {
try try
{ {
string loggingMessage = RenderLoggingEvent(le); string loggingMessage = RenderLoggingEvent(le);
@ -47,7 +47,7 @@ namespace OpenSim.Framework.Console
Regex RE = new Regex(regex, RegexOptions.Multiline); Regex RE = new Regex(regex, RegexOptions.Multiline);
MatchCollection matches = RE.Matches(loggingMessage); MatchCollection matches = RE.Matches(loggingMessage);
// Get some direct matches $1 $4 is a // Get some direct matches $1 $4 is a
if (matches.Count == 1) if (matches.Count == 1)
{ {

View File

@ -37,7 +37,7 @@ namespace OpenSim.Framework
bool ExistsAsset(LLUUID uuid); bool ExistsAsset(LLUUID uuid);
void Initialise(string connect); void Initialise(string connect);
} }
public class AssetDataInitialiser : PluginInitialiserBase public class AssetDataInitialiser : PluginInitialiserBase
{ {
private string connect; private string connect;

View File

@ -62,7 +62,7 @@ namespace OpenSim.Framework
public delegate void ModifyTerrain( public delegate void ModifyTerrain(
float height, float seconds, byte size, byte action, float north, float west, float south, float east, float height, float seconds, byte size, byte action, float north, float west, float south, float east,
IClientAPI remoteClient); IClientAPI remoteClient);
public delegate void SetAppearance(byte[] texture, List<byte> visualParamList); public delegate void SetAppearance(byte[] texture, List<byte> visualParamList);
public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID); public delegate void StartAnim(IClientAPI remoteClient, LLUUID animID);
@ -295,7 +295,7 @@ namespace OpenSim.Framework
public delegate void EstateTeleportOneUserHomeRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID prey); public delegate void EstateTeleportOneUserHomeRequest(IClientAPI remoteClient, LLUUID invoice, LLUUID senderID, LLUUID prey);
public delegate void RegionHandleRequest(IClientAPI remoteClient, LLUUID regionID); public delegate void RegionHandleRequest(IClientAPI remoteClient, LLUUID regionID);
public delegate void ParcelInfoRequest(IClientAPI remoteClient, LLUUID parcelID); public delegate void ParcelInfoRequest(IClientAPI remoteClient, LLUUID parcelID);
public delegate void ScriptReset(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); public delegate void ScriptReset(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID);
public delegate void GetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID); public delegate void GetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID);
public delegate void SetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, bool running); public delegate void SetScriptRunning(IClientAPI remoteClient, LLUUID objectID, LLUUID itemID, bool running);
@ -322,9 +322,9 @@ namespace OpenSim.Framework
ulong ActiveGroupPowers { get; } ulong ActiveGroupPowers { get; }
ulong GetGroupPowers(LLUUID groupID); ulong GetGroupPowers(LLUUID groupID);
string FirstName { get; } string FirstName { get; }
string LastName { get; } string LastName { get; }
IScene Scene { get; } IScene Scene { get; }
@ -501,7 +501,7 @@ namespace OpenSim.Framework
event EstateDebugRegionRequest OnEstateDebugRegionRequest; event EstateDebugRegionRequest OnEstateDebugRegionRequest;
event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest; event EstateTeleportOneUserHomeRequest OnEstateTeleportOneUserHomeRequest;
event UUIDNameRequest OnUUIDGroupNameRequest; event UUIDNameRequest OnUUIDGroupNameRequest;
event RegionHandleRequest OnRegionHandleRequest; event RegionHandleRequest OnRegionHandleRequest;
event ParcelInfoRequest OnParcelInfoRequest; event ParcelInfoRequest OnParcelInfoRequest;
@ -724,10 +724,10 @@ namespace OpenSim.Framework
ClientInfo GetClientInfo(); ClientInfo GetClientInfo();
void SetClientInfo(ClientInfo info); void SetClientInfo(ClientInfo info);
void Terminate(); void Terminate();
void SendSetFollowCamProperties(LLUUID objectID, SortedDictionary<int, float> parameters); void SendSetFollowCamProperties(LLUUID objectID, SortedDictionary<int, float> parameters);
void SendClearFollowCamProperties(LLUUID objectID); void SendClearFollowCamProperties(LLUUID objectID);
void SendRegionHandle(LLUUID regoinID, ulong handle); void SendRegionHandle(LLUUID regoinID, ulong handle);
void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y); void SendParcelInfo(RegionInfo info, LandData land, LLUUID parcelID, uint x, uint y);
} }

View File

@ -132,7 +132,7 @@ namespace OpenSim.Framework
/// <param name="folder">The id of the folder</param> /// <param name="folder">The id of the folder</param>
void deleteInventoryFolder(LLUUID folder); void deleteInventoryFolder(LLUUID folder);
} }
public class InventoryDataInitialiser : PluginInitialiserBase public class InventoryDataInitialiser : PluginInitialiserBase
{ {
private string connect; private string connect;

View File

@ -38,7 +38,7 @@ namespace OpenSim.Framework
public PluginNotInitialisedException (string msg) : base(msg) {} public PluginNotInitialisedException (string msg) : base(msg) {}
public PluginNotInitialisedException (string msg, Exception e) : base(msg, e) {} public PluginNotInitialisedException (string msg, Exception e) : base(msg, e) {}
} }
/// <summary> /// <summary>
/// This interface, describes a generic plugin /// This interface, describes a generic plugin
/// </summary> /// </summary>
@ -63,17 +63,17 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Any plugins which need to pass parameters to their initialisers must /// Any plugins which need to pass parameters to their initialisers must
/// inherit this class and use it to set the PluginLoader Initialiser property /// inherit this class and use it to set the PluginLoader Initialiser property
/// </summary> /// </summary>
public class PluginInitialiserBase public class PluginInitialiserBase
{ {
// this would be a lot simpler if C# supported currying or typedefs // this would be a lot simpler if C# supported currying or typedefs
// default initialisation // default initialisation
public virtual void Initialise (IPlugin plugin) public virtual void Initialise (IPlugin plugin)
{ {
plugin.Initialise(); plugin.Initialise();
} }
} }

View File

@ -170,7 +170,7 @@ namespace OpenSim.Framework
void RemoveAttachment(LLUUID user, LLUUID item); void RemoveAttachment(LLUUID user, LLUUID item);
List<LLUUID> GetAttachments(LLUUID user); List<LLUUID> GetAttachments(LLUUID user);
} }
public class UserDataInitialiser : PluginInitialiserBase public class UserDataInitialiser : PluginInitialiserBase
{ {
private string connect; private string connect;

View File

@ -39,7 +39,7 @@ namespace OpenSim.Framework
private uint _auctionID = 0; //Unemplemented. If set to 0, not being auctioned private uint _auctionID = 0; //Unemplemented. If set to 0, not being auctioned
private LLUUID _authBuyerID = LLUUID.Zero; //Unemplemented. Authorized Buyer's UUID private LLUUID _authBuyerID = LLUUID.Zero; //Unemplemented. Authorized Buyer's UUID
private Parcel.ParcelCategory _category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category private Parcel.ParcelCategory _category = new Parcel.ParcelCategory(); //Unemplemented. Parcel's chosen category
private int _claimDate = 0; private int _claimDate = 0;
private int _claimPrice = 0; //Unemplemented private int _claimPrice = 0; //Unemplemented
private LLUUID _globalID = LLUUID.Zero; private LLUUID _globalID = LLUUID.Zero;
private LLUUID _groupID = LLUUID.Zero; //Unemplemented private LLUUID _groupID = LLUUID.Zero; //Unemplemented
@ -77,7 +77,7 @@ namespace OpenSim.Framework
private LLUUID _snapshotID = LLUUID.Zero; private LLUUID _snapshotID = LLUUID.Zero;
private LLVector3 _userLocation = new LLVector3(); private LLVector3 _userLocation = new LLVector3();
private LLVector3 _userLookAt = new LLVector3(); private LLVector3 _userLookAt = new LLVector3();
public LLVector3 AABBMax { public LLVector3 AABBMax {
get { get {
return _AABBMax; return _AABBMax;
@ -459,4 +459,4 @@ namespace OpenSim.Framework
return landData; return landData;
} }
} }
} }

View File

@ -49,6 +49,6 @@ namespace OpenSim.Framework
{ {
} }
} }
} }

View File

@ -47,7 +47,7 @@ namespace OpenSim.Framework
} }
/// <summary> /// <summary>
/// Classes wishing to impose constraints on plugin loading must implement /// Classes wishing to impose constraints on plugin loading must implement
/// this class and pass it to PluginLoader AddConstraint() /// this class and pass it to PluginLoader AddConstraint()
/// </summary> /// </summary>
public interface IPluginConstraint public interface IPluginConstraint
@ -75,46 +75,46 @@ namespace OpenSim.Framework
private List<T> loaded = new List<T>(); private List<T> loaded = new List<T>();
private List<string> extpoints = new List<string>(); private List<string> extpoints = new List<string>();
private PluginInitialiserBase initialiser; private PluginInitialiserBase initialiser;
private Dictionary<string,IPluginConstraint> constraints private Dictionary<string,IPluginConstraint> constraints
= new Dictionary<string,IPluginConstraint>(); = new Dictionary<string,IPluginConstraint>();
private Dictionary<string,IPluginFilter> filters private Dictionary<string,IPluginFilter> filters
= new Dictionary<string,IPluginFilter>(); = new Dictionary<string,IPluginFilter>();
private static readonly ILog log private static readonly ILog log
= LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public PluginInitialiserBase Initialiser public PluginInitialiserBase Initialiser
{ {
set { initialiser = value; } set { initialiser = value; }
get { return initialiser; } get { return initialiser; }
} }
public List<T> Plugins public List<T> Plugins
{ {
get { return loaded; } get { return loaded; }
} }
public T Plugin public T Plugin
{ {
get { return (loaded.Count == 1)? loaded [0] : default (T); } get { return (loaded.Count == 1)? loaded [0] : default (T); }
} }
public PluginLoader () public PluginLoader ()
{ {
Initialiser = new PluginInitialiserBase(); Initialiser = new PluginInitialiserBase();
initialise_plugin_dir_ ("."); initialise_plugin_dir_ (".");
} }
public PluginLoader (PluginInitialiserBase init) public PluginLoader (PluginInitialiserBase init)
{ {
Initialiser = init; Initialiser = init;
initialise_plugin_dir_ ("."); initialise_plugin_dir_ (".");
} }
public PluginLoader (PluginInitialiserBase init, string dir) public PluginLoader (PluginInitialiserBase init, string dir)
{ {
Initialiser = init; Initialiser = init;
initialise_plugin_dir_ (dir); initialise_plugin_dir_ (dir);
} }
@ -123,7 +123,7 @@ namespace OpenSim.Framework
{ {
if (extpoints.Contains (extpoint)) if (extpoints.Contains (extpoint))
return; return;
extpoints.Add (extpoint); extpoints.Add (extpoint);
} }
@ -156,7 +156,7 @@ namespace OpenSim.Framework
} }
public void Load () public void Load ()
{ {
foreach (string ext in extpoints) foreach (string ext in extpoints)
{ {
log.Info("[PLUGINS]: Loading extension point " + ext); log.Info("[PLUGINS]: Loading extension point " + ext);
@ -169,17 +169,17 @@ namespace OpenSim.Framework
} }
IPluginFilter filter = null; IPluginFilter filter = null;
if (filters.ContainsKey (ext)) if (filters.ContainsKey (ext))
filter = filters [ext]; filter = filters [ext];
foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes (ext)) foreach (PluginExtensionNode node in AddinManager.GetExtensionNodes (ext))
{ {
log.Info("[PLUGINS]: Trying plugin " + node.Path); log.Info("[PLUGINS]: Trying plugin " + node.Path);
if ((filter != null) && (filter.Apply (node) == false)) if ((filter != null) && (filter.Apply (node) == false))
continue; continue;
T plugin = (T) node.CreateInstance(); T plugin = (T) node.CreateInstance();
Initialiser.Initialise (plugin); Initialiser.Initialise (plugin);
Plugins.Add (plugin); Plugins.Add (plugin);
@ -219,7 +219,7 @@ namespace OpenSim.Framework
private void on_addinloaderror_(object sender, AddinErrorEventArgs args) private void on_addinloaderror_(object sender, AddinErrorEventArgs args)
{ {
if (args.Exception == null) if (args.Exception == null)
log.Error ("[PLUGINS]: Plugin Error: " log.Error ("[PLUGINS]: Plugin Error: "
+ args.Message); + args.Message);
else else
log.Error ("[PLUGINS]: Plugin Error: " log.Error ("[PLUGINS]: Plugin Error: "
@ -229,7 +229,7 @@ namespace OpenSim.Framework
private void clear_registry_ () private void clear_registry_ ()
{ {
// The Mono addin manager (in Mono.Addins.dll version 0.2.0.0) // The Mono addin manager (in Mono.Addins.dll version 0.2.0.0)
// occasionally seems to corrupt its addin cache // occasionally seems to corrupt its addin cache
// Hence, as a temporary solution we'll remove it before each startup // Hence, as a temporary solution we'll remove it before each startup
try try
@ -252,7 +252,7 @@ namespace OpenSim.Framework
} }
} }
private static TextWriter prev_console_; private static TextWriter prev_console_;
public void suppress_console_output_ (bool save) public void suppress_console_output_ (bool save)
{ {
if (save) if (save)
@ -262,7 +262,7 @@ namespace OpenSim.Framework
} }
else else
{ {
if (prev_console_ != null) if (prev_console_ != null)
System.Console.SetOut(prev_console_); System.Console.SetOut(prev_console_);
} }
} }
@ -283,7 +283,7 @@ namespace OpenSim.Framework
public Type TypeObject public Type TypeObject
{ {
get get
{ {
if (typeobj != null) if (typeobj != null)
return typeobj; return typeobj;
@ -295,9 +295,9 @@ namespace OpenSim.Framework
} }
} }
public object CreateInstance () public object CreateInstance ()
{ {
return Activator.CreateInstance (TypeObject); return Activator.CreateInstance (TypeObject);
} }
} }
@ -305,29 +305,29 @@ namespace OpenSim.Framework
/// Constraint that bounds the number of plugins to be loaded. /// Constraint that bounds the number of plugins to be loaded.
/// </summary> /// </summary>
public class PluginCountConstraint : IPluginConstraint public class PluginCountConstraint : IPluginConstraint
{ {
private int min; private int min;
private int max; private int max;
public PluginCountConstraint (int exact) public PluginCountConstraint (int exact)
{ {
min = exact; min = exact;
max = exact; max = exact;
} }
public PluginCountConstraint (int minimum, int maximum) public PluginCountConstraint (int minimum, int maximum)
{ {
min = minimum; min = minimum;
max = maximum; max = maximum;
} }
public string Message public string Message
{ {
get get
{ {
return "The number of plugins is constrained to the interval [" return "The number of plugins is constrained to the interval ["
+ min + ", " + max + "]"; + min + ", " + max + "]";
} }
} }
public bool Apply (string extpoint) public bool Apply (string extpoint)
@ -340,7 +340,7 @@ namespace OpenSim.Framework
return true; return true;
} }
} }
/// <summary> /// <summary>
/// Filters out which plugin to load based on its "Provider", which is name given by in the addin.xml /// Filters out which plugin to load based on its "Provider", which is name given by in the addin.xml
/// </summary> /// </summary>
@ -348,7 +348,7 @@ namespace OpenSim.Framework
{ {
private string provider; private string provider;
public PluginProviderFilter (string p) public PluginProviderFilter (string p)
{ {
provider = p; provider = p;
} }

View File

@ -128,7 +128,7 @@ namespace OpenSim.Framework
[XmlIgnore] private bool _flexiEntry = false; [XmlIgnore] private bool _flexiEntry = false;
[XmlIgnore] private bool _lightEntry = false; [XmlIgnore] private bool _lightEntry = false;
[XmlIgnore] private bool _sculptEntry = false; [XmlIgnore] private bool _sculptEntry = false;
public byte ProfileCurve public byte ProfileCurve
{ {
get { return (byte)((byte)HollowShape | (byte)ProfileShape); } get { return (byte)((byte)HollowShape | (byte)ProfileShape); }
@ -185,10 +185,10 @@ namespace OpenSim.Framework
[XmlIgnore] [XmlIgnore]
public LLObject.TextureEntry Textures public LLObject.TextureEntry Textures
{ {
get get
{ {
//m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length); //m_log.DebugFormat("[PRIMITIVE BASE SHAPE]: get m_textureEntry length {0}", m_textureEntry.Length);
return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length); return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length);
} }
set { m_textureEntry = value.ToBytes(); } set { m_textureEntry = value.ToBytes(); }
@ -198,12 +198,12 @@ namespace OpenSim.Framework
{ {
get { return m_textureEntry; } get { return m_textureEntry; }
set set
{ {
if (value == null) if (value == null)
m_textureEntry = new byte[1]; m_textureEntry = new byte[1];
else else
m_textureEntry = value; m_textureEntry = value;
} }
} }
@ -302,7 +302,7 @@ namespace OpenSim.Framework
_profileBegin = LLObject.PackBeginCut(profileRange.X); _profileBegin = LLObject.PackBeginCut(profileRange.X);
_profileEnd = LLObject.PackEndCut(profileRange.Y); _profileEnd = LLObject.PackEndCut(profileRange.Y);
} }
public byte[] ExtraParams public byte[] ExtraParams
{ {
get get
@ -941,7 +941,7 @@ namespace OpenSim.Framework
return data; return data;
} }
public void ReadFlexiData(byte[] data, int pos) public void ReadFlexiData(byte[] data, int pos)
{ {
if (data.Length-pos >= 16) if (data.Length-pos >= 16)
@ -972,7 +972,7 @@ namespace OpenSim.Framework
_flexiForceZ = 0f; _flexiForceZ = 0f;
} }
} }
public byte[] GetFlexiBytes() public byte[] GetFlexiBytes()
{ {
byte[] data = new byte[16]; byte[] data = new byte[16];
@ -991,7 +991,7 @@ namespace OpenSim.Framework
return data; return data;
} }
public void ReadLightData(byte[] data, int pos) public void ReadLightData(byte[] data, int pos)
{ {
if (data.Length - pos >= 16) if (data.Length - pos >= 16)
@ -1021,7 +1021,7 @@ namespace OpenSim.Framework
_lightIntensity = 0f; _lightIntensity = 0f;
} }
} }
public byte[] GetLightBytes() public byte[] GetLightBytes()
{ {
byte[] data = new byte[16]; byte[] data = new byte[16];

View File

@ -47,7 +47,7 @@ namespace OpenSim.Framework
private RegionUp handlerRegionUp = null; // OnRegionUp; private RegionUp handlerRegionUp = null; // OnRegionUp;
private LogOffUser handlerLogOffUser = null; private LogOffUser handlerLogOffUser = null;
private GetLandData handlerGetLandData = null; private GetLandData handlerGetLandData = null;
#region IRegionCommsListener Members #region IRegionCommsListener Members
public event ExpectUserDelegate OnExpectUser; public event ExpectUserDelegate OnExpectUser;
@ -228,13 +228,13 @@ namespace OpenSim.Framework
return false; return false;
} }
public LandData TriggerGetLandData(uint x, uint y) public LandData TriggerGetLandData(uint x, uint y)
{ {
handlerGetLandData = OnGetLandData; handlerGetLandData = OnGetLandData;
if (handlerGetLandData != null) if (handlerGetLandData != null)
return handlerGetLandData(x, y); return handlerGetLandData(x, y);
return null; return null;
} }
} }

View File

@ -50,7 +50,7 @@ namespace OpenSim.Framework
set { m_httpPort = value; } set { m_httpPort = value; }
} }
protected uint m_httpPort; protected uint m_httpPort;
/// <summary> /// <summary>
/// A well-formed URI for the host region server (namely "http://" + ExternalHostName) /// A well-formed URI for the host region server (namely "http://" + ExternalHostName)
/// </summary> /// </summary>
@ -58,17 +58,17 @@ namespace OpenSim.Framework
{ {
get { return m_serverURI; } get { return m_serverURI; }
set { m_serverURI = value; } set { m_serverURI = value; }
} }
protected string m_serverURI; protected string m_serverURI;
protected bool Allow_Alternate_Ports; protected bool Allow_Alternate_Ports;
public bool m_allow_alternate_ports; public bool m_allow_alternate_ports;
protected string m_externalHostName; protected string m_externalHostName;
protected IPEndPoint m_internalEndPoint; protected IPEndPoint m_internalEndPoint;
protected uint? m_regionLocX; protected uint? m_regionLocX;
protected uint? m_regionLocY; protected uint? m_regionLocY;
protected uint m_remotingPort; protected uint m_remotingPort;
public LLUUID RegionID = LLUUID.Zero; public LLUUID RegionID = LLUUID.Zero;
public string RemotingAddress; public string RemotingAddress;
@ -404,11 +404,11 @@ namespace OpenSim.Framework
configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING, configMember.addConfigurationOption("master_avatar_pass", ConfigurationOption.ConfigurationTypes.TYPE_STRING,
"(Sandbox Mode Only)Password for Master Avatar account", "(Sandbox Mode Only)Password for Master Avatar account",
MasterAvatarSandboxPassword, true); MasterAvatarSandboxPassword, true);
configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Last Map UUID", lastMapUUID.ToString(), true); "Last Map UUID", lastMapUUID.ToString(), true);
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
} }
public void loadConfigurationOptions() public void loadConfigurationOptions()
@ -454,15 +454,14 @@ namespace OpenSim.Framework
shouldMasterAvatarDetailsBeAsked); shouldMasterAvatarDetailsBeAsked);
configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, configMember.addConfigurationOption("lastmap_uuid", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID,
"Last Map UUID", lastMapUUID.ToString(), true); "Last Map UUID", lastMapUUID.ToString(), true);
configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
"Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
} }
public bool shouldMasterAvatarDetailsBeAsked(string configuration_key) public bool shouldMasterAvatarDetailsBeAsked(string configuration_key)
{ {
if (MasterAvatarAssignedUUID == LLUUID.Zero) return MasterAvatarAssignedUUID == LLUUID.Zero;
{ {
return true; return true;
} }

View File

@ -139,7 +139,7 @@ namespace OpenSim.Framework
{ {
case "region_flags": case "region_flags":
Simulator.RegionFlags flags = (Simulator.RegionFlags)(uint)value; Simulator.RegionFlags flags = (Simulator.RegionFlags)(uint)value;
m_BlockTerraform = m_BlockTerraform =
(flags & Simulator.RegionFlags.BlockTerraform) != 0; (flags & Simulator.RegionFlags.BlockTerraform) != 0;
m_BlockFly = m_BlockFly =
@ -246,7 +246,7 @@ namespace OpenSim.Framework
} }
private bool m_BlockTerraform = false; private bool m_BlockTerraform = false;
public bool BlockTerraform public bool BlockTerraform
{ {
get { return m_BlockTerraform; } get { return m_BlockTerraform; }
@ -254,7 +254,7 @@ namespace OpenSim.Framework
} }
private bool m_BlockFly = false; private bool m_BlockFly = false;
public bool BlockFly public bool BlockFly
{ {
get { return m_BlockFly; } get { return m_BlockFly; }
@ -262,7 +262,7 @@ namespace OpenSim.Framework
} }
private bool m_AllowDamage = false; private bool m_AllowDamage = false;
public bool AllowDamage public bool AllowDamage
{ {
get { return m_AllowDamage; } get { return m_AllowDamage; }
@ -270,7 +270,7 @@ namespace OpenSim.Framework
} }
private bool m_RestrictPushing = false; private bool m_RestrictPushing = false;
public bool RestrictPushing public bool RestrictPushing
{ {
get { return m_RestrictPushing; } get { return m_RestrictPushing; }
@ -278,7 +278,7 @@ namespace OpenSim.Framework
} }
private bool m_AllowLandResell = true; private bool m_AllowLandResell = true;
public bool AllowLandResell public bool AllowLandResell
{ {
get { return m_AllowLandResell; } get { return m_AllowLandResell; }
@ -286,7 +286,7 @@ namespace OpenSim.Framework
} }
private bool m_AllowLandJoinDivide = true; private bool m_AllowLandJoinDivide = true;
public bool AllowLandJoinDivide public bool AllowLandJoinDivide
{ {
get { return m_AllowLandJoinDivide; } get { return m_AllowLandJoinDivide; }
@ -294,7 +294,7 @@ namespace OpenSim.Framework
} }
private bool m_BlockShowInSearch = false; private bool m_BlockShowInSearch = false;
public bool BlockShowInSearch public bool BlockShowInSearch
{ {
get { return m_BlockShowInSearch; } get { return m_BlockShowInSearch; }
@ -302,7 +302,7 @@ namespace OpenSim.Framework
} }
private int m_AgentLimit = 40; private int m_AgentLimit = 40;
public int AgentLimit public int AgentLimit
{ {
get { return m_AgentLimit; } get { return m_AgentLimit; }
@ -310,7 +310,7 @@ namespace OpenSim.Framework
} }
private double m_ObjectBonus = 1.0; private double m_ObjectBonus = 1.0;
public double ObjectBonus public double ObjectBonus
{ {
get { return m_ObjectBonus; } get { return m_ObjectBonus; }
@ -318,7 +318,7 @@ namespace OpenSim.Framework
} }
private int m_Maturity = 1; private int m_Maturity = 1;
public int Maturity public int Maturity
{ {
get { return m_Maturity; } get { return m_Maturity; }
@ -326,7 +326,7 @@ namespace OpenSim.Framework
} }
private bool m_DisableScripts = false; private bool m_DisableScripts = false;
public bool DisableScripts public bool DisableScripts
{ {
get { return m_DisableScripts; } get { return m_DisableScripts; }
@ -334,7 +334,7 @@ namespace OpenSim.Framework
} }
private bool m_DisableCollisions = false; private bool m_DisableCollisions = false;
public bool DisableCollisions public bool DisableCollisions
{ {
get { return m_DisableCollisions; } get { return m_DisableCollisions; }
@ -342,7 +342,7 @@ namespace OpenSim.Framework
} }
private bool m_DisablePhysics = false; private bool m_DisablePhysics = false;
public bool DisablePhysics public bool DisablePhysics
{ {
get { return m_DisablePhysics; } get { return m_DisablePhysics; }
@ -350,7 +350,7 @@ namespace OpenSim.Framework
} }
private LLUUID m_TerrainTexture1 = LLUUID.Zero; private LLUUID m_TerrainTexture1 = LLUUID.Zero;
public LLUUID TerrainTexture1 public LLUUID TerrainTexture1
{ {
get { return m_TerrainTexture1; } get { return m_TerrainTexture1; }
@ -358,7 +358,7 @@ namespace OpenSim.Framework
} }
private LLUUID m_TerrainTexture2 = LLUUID.Zero; private LLUUID m_TerrainTexture2 = LLUUID.Zero;
public LLUUID TerrainTexture2 public LLUUID TerrainTexture2
{ {
get { return m_TerrainTexture2; } get { return m_TerrainTexture2; }
@ -366,7 +366,7 @@ namespace OpenSim.Framework
} }
private LLUUID m_TerrainTexture3 = LLUUID.Zero; private LLUUID m_TerrainTexture3 = LLUUID.Zero;
public LLUUID TerrainTexture3 public LLUUID TerrainTexture3
{ {
get { return m_TerrainTexture3; } get { return m_TerrainTexture3; }
@ -374,7 +374,7 @@ namespace OpenSim.Framework
} }
private LLUUID m_TerrainTexture4 = LLUUID.Zero; private LLUUID m_TerrainTexture4 = LLUUID.Zero;
public LLUUID TerrainTexture4 public LLUUID TerrainTexture4
{ {
get { return m_TerrainTexture4; } get { return m_TerrainTexture4; }
@ -382,7 +382,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation1NW = 10; private double m_Elevation1NW = 10;
public double Elevation1NW public double Elevation1NW
{ {
get { return m_Elevation1NW; } get { return m_Elevation1NW; }
@ -390,7 +390,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation2NW = 60; private double m_Elevation2NW = 60;
public double Elevation2NW public double Elevation2NW
{ {
get { return m_Elevation2NW; } get { return m_Elevation2NW; }
@ -398,7 +398,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation1NE = 10; private double m_Elevation1NE = 10;
public double Elevation1NE public double Elevation1NE
{ {
get { return m_Elevation1NE; } get { return m_Elevation1NE; }
@ -406,7 +406,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation2NE = 60; private double m_Elevation2NE = 60;
public double Elevation2NE public double Elevation2NE
{ {
get { return m_Elevation2NE; } get { return m_Elevation2NE; }
@ -414,7 +414,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation1SE = 10; private double m_Elevation1SE = 10;
public double Elevation1SE public double Elevation1SE
{ {
get { return m_Elevation1SE; } get { return m_Elevation1SE; }
@ -422,7 +422,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation2SE = 60; private double m_Elevation2SE = 60;
public double Elevation2SE public double Elevation2SE
{ {
get { return m_Elevation2SE; } get { return m_Elevation2SE; }
@ -430,7 +430,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation1SW = 10; private double m_Elevation1SW = 10;
public double Elevation1SW public double Elevation1SW
{ {
get { return m_Elevation1SW; } get { return m_Elevation1SW; }
@ -438,7 +438,7 @@ namespace OpenSim.Framework
} }
private double m_Elevation2SW = 60; private double m_Elevation2SW = 60;
public double Elevation2SW public double Elevation2SW
{ {
get { return m_Elevation2SW; } get { return m_Elevation2SW; }
@ -446,7 +446,7 @@ namespace OpenSim.Framework
} }
private double m_WaterHeight = 20; private double m_WaterHeight = 20;
public double WaterHeight public double WaterHeight
{ {
get { return m_WaterHeight; } get { return m_WaterHeight; }
@ -454,7 +454,7 @@ namespace OpenSim.Framework
} }
private double m_TerrainRaiseLimit = 100; private double m_TerrainRaiseLimit = 100;
public double TerrainRaiseLimit public double TerrainRaiseLimit
{ {
get { return m_TerrainRaiseLimit; } get { return m_TerrainRaiseLimit; }
@ -462,7 +462,7 @@ namespace OpenSim.Framework
} }
private double m_TerrainLowerLimit = -100; private double m_TerrainLowerLimit = -100;
public double TerrainLowerLimit public double TerrainLowerLimit
{ {
get { return m_TerrainLowerLimit; } get { return m_TerrainLowerLimit; }
@ -470,7 +470,7 @@ namespace OpenSim.Framework
} }
private bool m_UseEstateSun = true; private bool m_UseEstateSun = true;
public bool UseEstateSun public bool UseEstateSun
{ {
get { return m_UseEstateSun; } get { return m_UseEstateSun; }
@ -478,7 +478,7 @@ namespace OpenSim.Framework
} }
private bool m_Sandbox = false; private bool m_Sandbox = false;
public bool Sandbox public bool Sandbox
{ {
get { return m_Sandbox; } get { return m_Sandbox; }
@ -502,7 +502,7 @@ namespace OpenSim.Framework
} }
private bool m_FixedSun = false; private bool m_FixedSun = false;
public bool FixedSun public bool FixedSun
{ {
get { return m_FixedSun; } get { return m_FixedSun; }
@ -510,7 +510,7 @@ namespace OpenSim.Framework
} }
private double m_SunPosition = 0.0; private double m_SunPosition = 0.0;
public double SunPosition public double SunPosition
{ {
get { return m_SunPosition; } get { return m_SunPosition; }
@ -518,7 +518,7 @@ namespace OpenSim.Framework
} }
private LLUUID m_Covenant = LLUUID.Zero; private LLUUID m_Covenant = LLUUID.Zero;
public LLUUID Covenant public LLUUID Covenant
{ {
get { return m_Covenant; } get { return m_Covenant; }

View File

@ -172,7 +172,7 @@ namespace OpenSim.Framework.Servers
OSHttpResponse response = new OSHttpResponse(context.Response); OSHttpResponse response = new OSHttpResponse(context.Response);
// This is the REST agent interface. We require an agent to properly identify // This is the REST agent interface. We require an agent to properly identify
// itself. If the REST handler recognizes the prefix it will attempt to // itself. If the REST handler recognizes the prefix it will attempt to
// satisfy the request. If it is not recognizable, and no damage has occurred // satisfy the request. If it is not recognizable, and no damage has occurred
// the request can be passed through to the other handlers. This is a low // the request can be passed through to the other handlers. This is a low
// probability event; if a request is matched it is normally expected to be // probability event; if a request is matched it is normally expected to be
@ -650,7 +650,7 @@ namespace OpenSim.Framework.Servers
} }
response.AddHeader("Content-type", contentType); response.AddHeader("Content-type", contentType);
byte[] buffer; byte[] buffer;
if (!contentType.Contains("image")) if (!contentType.Contains("image"))

View File

@ -89,7 +89,7 @@ namespace OpenSim.Framework.Servers
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
m_periodicDiagnosticsTimer.Enabled = true; m_periodicDiagnosticsTimer.Enabled = true;
// Add ourselves to thread monitoring. This thread will go on to become the console listening thread // Add ourselves to thread monitoring. This thread will go on to become the console listening thread
Thread.CurrentThread.Name = "ConsoleThread"; Thread.CurrentThread.Name = "ConsoleThread";
ThreadTracker.Add(Thread.CurrentThread); ThreadTracker.Add(Thread.CurrentThread);
@ -102,15 +102,15 @@ namespace OpenSim.Framework.Servers
{ {
StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n");
sb.Append(GetUptimeReport()); sb.Append(GetUptimeReport());
if (m_stats != null) if (m_stats != null)
{ {
sb.Append(m_stats.Report()); sb.Append(m_stats.Report());
} }
m_log.Debug(sb); m_log.Debug(sb);
} }
/// <summary> /// <summary>
/// Return a report about the uptime of this server /// Return a report about the uptime of this server
/// </summary> /// </summary>
@ -120,10 +120,10 @@ namespace OpenSim.Framework.Servers
StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now)); StringBuilder sb = new StringBuilder(String.Format("Time now is {0}\n", DateTime.Now));
sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime)); sb.Append(String.Format("Server has been running since {0}, {1}\n", m_startuptime.DayOfWeek, m_startuptime));
sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime)); sb.Append(String.Format("That is an elapsed time of {0}\n", DateTime.Now - m_startuptime));
return sb.ToString(); return sb.ToString();
} }
/// <summary> /// <summary>
/// Set the level of log notices being echoed to the console /// Set the level of log notices being echoed to the console
/// </summary> /// </summary>
@ -133,7 +133,7 @@ namespace OpenSim.Framework.Servers
ILoggerRepository repository = LogManager.GetRepository(); ILoggerRepository repository = LogManager.GetRepository();
IAppender[] appenders = repository.GetAppenders(); IAppender[] appenders = repository.GetAppenders();
OpenSimAppender consoleAppender = null; OpenSimAppender consoleAppender = null;
foreach (IAppender appender in appenders) foreach (IAppender appender in appenders)
{ {
if (appender.Name == "Console") if (appender.Name == "Console")
@ -142,13 +142,13 @@ namespace OpenSim.Framework.Servers
break; break;
} }
} }
if (null == consoleAppender) if (null == consoleAppender)
{ {
Notice("No appender named Console found (see the log4net config file for this executable)!"); Notice("No appender named Console found (see the log4net config file for this executable)!");
return; return;
} }
if (setParams.Length > 0) if (setParams.Length > 0)
{ {
Level consoleLevel = repository.LevelMap[setParams[0]]; Level consoleLevel = repository.LevelMap[setParams[0]];
@ -160,12 +160,12 @@ namespace OpenSim.Framework.Servers
"{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF", "{0} is not a valid logging level. Valid logging levels are ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF",
setParams[0])); setParams[0]));
} }
// If there is no threshold set then the threshold is effectively everything. // If there is no threshold set then the threshold is effectively everything.
Level thresholdLevel Level thresholdLevel
= (null != consoleAppender.Threshold ? consoleAppender.Threshold : log4net.Core.Level.All); = (null != consoleAppender.Threshold ? consoleAppender.Threshold : log4net.Core.Level.All);
Notice(String.Format("Console log level is {0}", thresholdLevel)); Notice(String.Format("Console log level is {0}", thresholdLevel));
} }
/// <summary> /// <summary>
@ -203,7 +203,7 @@ namespace OpenSim.Framework.Servers
Notice(""); Notice("");
Notice("quit - equivalent to shutdown."); Notice("quit - equivalent to shutdown.");
Notice("set log level [level] - change the console logging level only. For example, off or debug."); Notice("set log level [level] - change the console logging level only. For example, off or debug.");
Notice("show info - show server information (e.g. startup path)."); Notice("show info - show server information (e.g. startup path).");
if (m_stats != null) if (m_stats != null)
@ -219,7 +219,7 @@ namespace OpenSim.Framework.Servers
case "set": case "set":
Set(cmdparams); Set(cmdparams);
break; break;
case "show": case "show":
if (cmdparams.Length > 0) if (cmdparams.Length > 0)
{ {
@ -232,8 +232,8 @@ namespace OpenSim.Framework.Servers
Shutdown(); Shutdown();
break; break;
} }
} }
/// <summary> /// <summary>
/// Set an OpenSim parameter /// Set an OpenSim parameter
/// </summary> /// </summary>
@ -245,15 +245,15 @@ namespace OpenSim.Framework.Servers
// Temporary while we only have one command which takes at least two parameters // Temporary while we only have one command which takes at least two parameters
if (setArgs.Length < 2) if (setArgs.Length < 2)
return; return;
if (setArgs[0] == "log" && setArgs[1] == "level") if (setArgs[0] == "log" && setArgs[1] == "level")
{ {
string[] setParams = new string[setArgs.Length - 2]; string[] setParams = new string[setArgs.Length - 2];
Array.Copy(setArgs, 2, setParams, 0, setArgs.Length - 2); Array.Copy(setArgs, 2, setParams, 0, setArgs.Length - 2);
SetConsoleLogLevel(setParams); SetConsoleLogLevel(setParams);
} }
} }
/// <summary> /// <summary>
/// Outputs to the console information about the region /// Outputs to the console information about the region
@ -276,7 +276,7 @@ namespace OpenSim.Framework.Servers
Notice(m_stats.Report()); Notice(m_stats.Report());
} }
break; break;
case "threads": case "threads":
List<Thread> threads = ThreadTracker.GetThreads(); List<Thread> threads = ThreadTracker.GetThreads();
if (threads == null) if (threads == null)
@ -291,7 +291,7 @@ namespace OpenSim.Framework.Servers
Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
} }
} }
break; break;
case "uptime": case "uptime":
Notice(GetUptimeReport()); Notice(GetUptimeReport());
@ -301,7 +301,7 @@ namespace OpenSim.Framework.Servers
Notice("Version: " + m_version); Notice("Version: " + m_version);
break; break;
} }
} }
/// <summary> /// <summary>
/// Console output is only possible if a console has been established. /// Console output is only possible if a console has been established.

View File

@ -72,21 +72,21 @@ namespace OpenSim.Framework.Servers
/// Regular expression used to match against method of /// Regular expression used to match against method of
/// the incoming HTTP request. If you want to match any string /// the incoming HTTP request. If you want to match any string
/// either use '.*' or null. To match on the empty string use /// either use '.*' or null. To match on the empty string use
/// '^$'. /// '^$'.
/// </summary> /// </summary>
public virtual Regex Method public virtual Regex Method
{ {
get { return _method; } get { return _method; }
} }
protected Regex _method; protected Regex _method;
/// <summary> /// <summary>
/// Regular expression used to match against path of the /// Regular expression used to match against path of the
/// incoming HTTP request. If you want to match any string /// incoming HTTP request. If you want to match any string
/// either use '.*' or null. To match on the emtpy string use /// either use '.*' or null. To match on the emtpy string use
/// '^$'. /// '^$'.
/// </summary> /// </summary>
public virtual Regex Path public virtual Regex Path
{ {
get { return _path; } get { return _path; }
} }
@ -97,7 +97,7 @@ namespace OpenSim.Framework.Servers
/// allowing us to match on URI query fields. /// allowing us to match on URI query fields.
/// </summary> /// </summary>
public virtual Dictionary<string, Regex> Query public virtual Dictionary<string, Regex> Query
{ {
get { return _query; } get { return _query; }
} }
protected Dictionary<string, Regex> _query; protected Dictionary<string, Regex> _query;
@ -107,7 +107,7 @@ namespace OpenSim.Framework.Servers
/// allowing us to match on HTTP header fields. /// allowing us to match on HTTP header fields.
/// </summary> /// </summary>
public virtual Dictionary<string, Regex> Headers public virtual Dictionary<string, Regex> Headers
{ {
get { return _headers; } get { return _headers; }
} }
protected Dictionary<string, Regex> _headers; protected Dictionary<string, Regex> _headers;
@ -137,7 +137,7 @@ namespace OpenSim.Framework.Servers
/// <param name="contentType">null or content type /// <param name="contentType">null or content type
/// regex</param> /// regex</param>
/// <param name="whitelist">null or IP address regex</param> /// <param name="whitelist">null or IP address regex</param>
public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query, public OSHttpHandler(Regex method, Regex path, Dictionary<string, Regex> query,
Dictionary<string, Regex> headers, Regex contentType, Regex whitelist) Dictionary<string, Regex> headers, Regex contentType, Regex whitelist)
{ {
_method = method; _method = method;
@ -155,7 +155,7 @@ namespace OpenSim.Framework.Servers
/// <summary> /// <summary>
/// Process an incoming OSHttpRequest that matched our /// Process an incoming OSHttpRequest that matched our
/// requirements. /// requirements.
/// </summary> /// </summary>
/// <returns> /// <returns>
/// OSHttpHandlerResult.Pass if we are after all not /// OSHttpHandlerResult.Pass if we are after all not
@ -180,4 +180,4 @@ namespace OpenSim.Framework.Servers
return sw.ToString(); return sw.ToString();
} }
} }
} }

View File

@ -58,7 +58,7 @@ namespace OpenSim.Framework.Servers
/// <param name="headers">null or dictionary with header /// <param name="headers">null or dictionary with header
/// regexs</param> /// regexs</param>
/// <param name="whitelist">null or IP address whitelist</param> /// <param name="whitelist">null or IP address whitelist</param>
public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path, public OSHttpHttpHandler(GenericHTTPMethod handler, Regex method, Regex path,
Dictionary<string, Regex> query, Dictionary<string, Regex> query,
Dictionary<string, Regex> headers, Regex whitelist) Dictionary<string, Regex> headers, Regex whitelist)
: base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled), : base(method, path, query, headers, new Regex(@"^text/html", RegexOptions.IgnoreCase | RegexOptions.Compiled),
@ -71,7 +71,7 @@ namespace OpenSim.Framework.Servers
/// Instantiate an HTTP handler. /// Instantiate an HTTP handler.
/// </summary> /// </summary>
/// <param name="handler">a GenericHTTPMethod</param> /// <param name="handler">a GenericHTTPMethod</param>
public OSHttpHttpHandler(GenericHTTPMethod handler) public OSHttpHttpHandler(GenericHTTPMethod handler)
: this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null) : this(handler, new Regex(@"^GET$", RegexOptions.IgnoreCase | RegexOptions.Compiled), null, null, null, null)
{ {
} }
@ -79,7 +79,7 @@ namespace OpenSim.Framework.Servers
/// <summary> /// <summary>
/// Invoked by OSHttpRequestPump. /// Invoked by OSHttpRequestPump.
/// </summary> /// </summary>
public override OSHttpHandlerResult Process(OSHttpRequest request) public override OSHttpHandlerResult Process(OSHttpRequest request)
{ {
// call handler method // call handler method
Hashtable responseData = _handler(request.Query); Hashtable responseData = _handler(request.Query);
@ -110,7 +110,7 @@ namespace OpenSim.Framework.Servers
} }
response.AddHeader("Content-type", contentType); response.AddHeader("Content-type", contentType);
byte[] buffer; byte[] buffer;
if (!contentType.Contains("image")) if (!contentType.Contains("image"))
@ -142,4 +142,4 @@ namespace OpenSim.Framework.Servers
return OSHttpHandlerResult.Done; return OSHttpHandlerResult.Done;
} }
} }
} }

View File

@ -38,42 +38,35 @@ namespace OpenSim.Framework.Servers
{ {
public class OSHttpRequest public class OSHttpRequest
{ {
public string[] AcceptTypes public string[] AcceptTypes
{ {
get { return _acceptTypes; } get { return _acceptTypes; }
} }
private string[] _acceptTypes; private string[] _acceptTypes;
public Encoding ContentEncoding public Encoding ContentEncoding
{ {
get { return _contentEncoding; } get { return _contentEncoding; }
} }
private Encoding _contentEncoding; private Encoding _contentEncoding;
public long ContentLength public long ContentLength
{ {
get { return _contentLength64; } get { return _contentLength64; }
} }
private long _contentLength64; private long _contentLength64;
public long ContentLength64 public long ContentLength64
{ {
get { return ContentLength; } get { return ContentLength; }
} }
public string ContentType public string ContentType
{ {
get { return _contentType; } get { return _contentType; }
} }
private string _contentType; private string _contentType;
// public CookieCollection Cookies // public CookieCollection Cookies
// { // {
// get { return _cookies; } // get { return _cookies; }
@ -92,63 +85,54 @@ namespace OpenSim.Framework.Servers
} }
private string _httpMethod; private string _httpMethod;
public Stream InputStream public Stream InputStream
{ {
get { return _inputStream; } get { return _inputStream; }
} }
private Stream _inputStream; private Stream _inputStream;
// public bool IsSecureConnection // public bool IsSecureConnection
// { // {
// get { return _isSecureConnection; } // get { return _isSecureConnection; }
// } // }
// private bool _isSecureConnection; // private bool _isSecureConnection;
// public bool IsAuthenticated // public bool IsAuthenticated
// { // {
// get { return _isAuthenticated; } // get { return _isAuthenticated; }
// } // }
// private bool _isAuthenticated; // private bool _isAuthenticated;
public bool HasEntityBody public bool HasEntityBody
{ {
get { return _hasbody; } get { return _hasbody; }
} }
private bool _hasbody; private bool _hasbody;
public bool KeepAlive public bool KeepAlive
{ {
get { return _keepAlive; } get { return _keepAlive; }
} }
private bool _keepAlive; private bool _keepAlive;
public string RawUrl public string RawUrl
{ {
get { return _rawUrl; } get { return _rawUrl; }
} }
private string _rawUrl; private string _rawUrl;
public Uri Url public Uri Url
{ {
get { return _url; } get { return _url; }
} }
private Uri _url; private Uri _url;
public string UserAgent public string UserAgent
{ {
get { return _userAgent; } get { return _userAgent; }
} }
private string _userAgent; private string _userAgent;
public NameValueCollection QueryString public NameValueCollection QueryString
{ {
get { return _queryString; } get { return _queryString; }
@ -161,28 +145,24 @@ namespace OpenSim.Framework.Servers
} }
private Hashtable _query; private Hashtable _query;
public IPEndPoint RemoteIPEndPoint public IPEndPoint RemoteIPEndPoint
{ {
get { return _ipEndPoint; } get { return _ipEndPoint; }
} }
private IPEndPoint _ipEndPoint; private IPEndPoint _ipEndPoint;
internal HttpRequest HttpRequest internal HttpRequest HttpRequest
{ {
get { return _request; } get { return _request; }
} }
private HttpRequest _request; private HttpRequest _request;
internal HttpClientContext HttpClientContext internal HttpClientContext HttpClientContext
{ {
get { return _context; } get { return _context; }
} }
private HttpClientContext _context; private HttpClientContext _context;
/// <summary> /// <summary>
/// Internal whiteboard for handlers to store temporary stuff /// Internal whiteboard for handlers to store temporary stuff
/// into. /// into.
@ -193,12 +173,10 @@ namespace OpenSim.Framework.Servers
} }
private Dictionary<string, object> _whiteboard = new Dictionary<string, object>(); private Dictionary<string, object> _whiteboard = new Dictionary<string, object>();
public OSHttpRequest() public OSHttpRequest()
{ {
} }
public OSHttpRequest(HttpListenerRequest req) public OSHttpRequest(HttpListenerRequest req)
{ {
_acceptTypes = req.AcceptTypes; _acceptTypes = req.AcceptTypes;

View File

@ -39,7 +39,6 @@ using System.Threading;
using log4net; using log4net;
using HttpServer; using HttpServer;
namespace OpenSim.Framework.Servers namespace OpenSim.Framework.Servers
{ {
/// <summary> /// <summary>
@ -58,13 +57,12 @@ namespace OpenSim.Framework.Servers
protected Thread _engine; protected Thread _engine;
private int _id; private int _id;
public string EngineID public string EngineID
{ {
get { return String.Format("{0} pump {1}", _server.EngineID, _id); } get { return String.Format("{0} pump {1}", _server.EngineID, _id); }
} }
public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id) public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id)
{ {
_server = server; _server = server;
@ -77,7 +75,6 @@ namespace OpenSim.Framework.Servers
_engine.Start(); _engine.Start();
ThreadTracker.Add(_engine); ThreadTracker.Add(_engine);
} }
public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize) public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize)
@ -104,21 +101,22 @@ namespace OpenSim.Framework.Servers
public void Engine() public void Engine()
{ {
OSHttpRequest req = null; OSHttpRequest req = null;
while (true) while (true)
{ {
try { try
{
// dequeue an OSHttpRequest from OSHttpServer's // dequeue an OSHttpRequest from OSHttpServer's
// request queue // request queue
req = _queue.Dequeue(); req = _queue.Dequeue();
// get a copy of the list of registered handlers // get a copy of the list of registered handlers
List<OSHttpHandler> handlers = _server.OSHttpHandlers; List<OSHttpHandler> handlers = _server.OSHttpHandlers;
// prune list and have it sorted from most // prune list and have it sorted from most
// specific to least specific // specific to least specific
handlers = MatchHandlers(req, handlers); handlers = MatchHandlers(req, handlers);
// process req: we try each handler in turn until // process req: we try each handler in turn until
// we are either out of handlers or get back a // we are either out of handlers or get back a
// Pass or Done // Pass or Done
@ -126,18 +124,18 @@ namespace OpenSim.Framework.Servers
foreach (OSHttpHandler h in handlers) foreach (OSHttpHandler h in handlers)
{ {
rc = h.Process(req); rc = h.Process(req);
// Pass: handler did not process the request, // Pass: handler did not process the request,
// try next handler // try next handler
if (OSHttpHandlerResult.Pass == rc) continue; if (OSHttpHandlerResult.Pass == rc) continue;
// Handled: handler has processed the request // Handled: handler has processed the request
if (OSHttpHandlerResult.Done == rc) break; if (OSHttpHandlerResult.Done == rc) break;
// hmm, something went wrong // hmm, something went wrong
throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
} }
if (OSHttpHandlerResult.Unprocessed == rc) if (OSHttpHandlerResult.Unprocessed == rc)
{ {
_log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req); _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req);
@ -190,7 +188,7 @@ namespace OpenSim.Framework.Servers
if (null != remote) if (null != remote)
{ {
Match epm = h.IPEndPointWhitelist.Match(remote.ToString()); Match epm = h.IPEndPointWhitelist.Match(remote.ToString());
if (!epm.Success) if (!epm.Success)
{ {
scoredHandlers.Remove(h); scoredHandlers.Remove(h);
continue; continue;
@ -201,7 +199,7 @@ namespace OpenSim.Framework.Servers
if (null != h.Method) if (null != h.Method)
{ {
Match m = h.Method.Match(req.HttpMethod); Match m = h.Method.Match(req.HttpMethod);
if (!m.Success) if (!m.Success)
{ {
scoredHandlers.Remove(h); scoredHandlers.Remove(h);
continue; continue;
@ -213,7 +211,7 @@ namespace OpenSim.Framework.Servers
if (null != h.Path) if (null != h.Path)
{ {
Match m = h.Path.Match(req.RawUrl); Match m = h.Path.Match(req.RawUrl);
if (!m.Success) if (!m.Success)
{ {
scoredHandlers.Remove(h); scoredHandlers.Remove(h);
continue; continue;
@ -272,14 +270,15 @@ namespace OpenSim.Framework.Servers
{ {
return 0; return 0;
} }
// does the content of collection[tag] match // does the content of collection[tag] match
// the supplied regex? // the supplied regex?
Match cm = regexs[tag].Match(collection[tag]); Match cm = regexs[tag].Match(collection[tag]);
if (!cm.Success) { if (!cm.Success)
{
return 0; return 0;
} }
// ok: matches // ok: matches
matched++; matched++;
continue; continue;
@ -288,7 +287,7 @@ namespace OpenSim.Framework.Servers
return matched; return matched;
} }
[ConditionalAttribute("DEBUGGING")] [ConditionalAttribute("DEBUGGING")]
private void LogDumpHandlerList(List<OSHttpHandler> l) private void LogDumpHandlerList(List<OSHttpHandler> l)
{ {
_log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID); _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID);

View File

@ -40,7 +40,7 @@ namespace OpenSim.Framework.Servers
{ {
private object _syncObject = new object(); private object _syncObject = new object();
new public void Enqueue(OSHttpRequest req) new public void Enqueue(OSHttpRequest req)
{ {
lock (_syncObject) lock (_syncObject)
{ {
@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers
Monitor.Pulse(_syncObject); Monitor.Pulse(_syncObject);
} }
} }
new public OSHttpRequest Dequeue() new public OSHttpRequest Dequeue()
{ {
OSHttpRequest req = null; OSHttpRequest req = null;
@ -65,4 +65,4 @@ namespace OpenSim.Framework.Servers
return req; return req;
} }
} }
} }

View File

@ -56,15 +56,15 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Setting this property will also set IsContentTypeSet to /// Setting this property will also set IsContentTypeSet to
/// true. /// true.
/// </remarks> /// </remarks>
public string ContentType public string ContentType
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.ContentType; return _httpResponse.ContentType;
else else
return _httpListenerResponse.ContentType; return _httpListenerResponse.ContentType;
} }
set set
@ -100,11 +100,11 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public long ContentLength public long ContentLength
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.ContentLength; return _httpResponse.ContentLength;
else else
return _httpListenerResponse.ContentLength64; return _httpListenerResponse.ContentLength64;
} }
set set
@ -130,11 +130,11 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public Encoding ContentEncoding public Encoding ContentEncoding
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Encoding; return _httpResponse.Encoding;
else else
return _httpListenerResponse.ContentEncoding; return _httpListenerResponse.ContentEncoding;
} }
@ -142,7 +142,7 @@ namespace OpenSim.Framework.Servers
{ {
if (HttpServer) if (HttpServer)
_httpResponse.Encoding = value; _httpResponse.Encoding = value;
else else
_httpListenerResponse.ContentEncoding = value; _httpListenerResponse.ContentEncoding = value;
} }
} }
@ -152,8 +152,8 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public WebHeaderCollection Headers public WebHeaderCollection Headers
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return null; return null;
else else
@ -166,10 +166,10 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public bool KeepAlive public bool KeepAlive
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Connection == ConnectionType.KeepAlive; return _httpResponse.Connection == ConnectionType.KeepAlive;
else else
return _httpListenerResponse.KeepAlive; return _httpListenerResponse.KeepAlive;
} }
@ -178,7 +178,7 @@ namespace OpenSim.Framework.Servers
{ {
if (HttpServer) if (HttpServer)
_httpResponse.Connection = ConnectionType.KeepAlive; _httpResponse.Connection = ConnectionType.KeepAlive;
else else
_httpListenerResponse.KeepAlive = value; _httpListenerResponse.KeepAlive = value;
} }
} }
@ -191,8 +191,8 @@ namespace OpenSim.Framework.Servers
/// </remarks> /// </remarks>
public Stream OutputStream public Stream OutputStream
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Body; return _httpResponse.Body;
else else
@ -205,10 +205,10 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public Stream Body public Stream Body
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Body; return _httpResponse.Body;
throw new Exception("[OSHttpResponse] mixed .NET and HttpServer access"); throw new Exception("[OSHttpResponse] mixed .NET and HttpServer access");
} }
} }
@ -228,18 +228,18 @@ namespace OpenSim.Framework.Servers
} }
} }
/// <summary> /// <summary>
/// Chunk transfers. /// Chunk transfers.
/// </summary> /// </summary>
public bool SendChunked public bool SendChunked
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Chunked; return _httpResponse.Chunked;
else else
return _httpListenerResponse.SendChunked; return _httpListenerResponse.SendChunked;
} }
set set
@ -256,12 +256,12 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public int StatusCode public int StatusCode
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return (int)_httpResponse.Status; return (int)_httpResponse.Status;
else else
return _httpListenerResponse.StatusCode; return _httpListenerResponse.StatusCode;
} }
set set
@ -279,12 +279,12 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public string StatusDescription public string StatusDescription
{ {
get get
{ {
if (HttpServer) if (HttpServer)
return _httpResponse.Reason; return _httpResponse.Reason;
else else
return _httpListenerResponse.StatusDescription; return _httpListenerResponse.StatusDescription;
} }
set set
@ -331,7 +331,7 @@ namespace OpenSim.Framework.Servers
/// object. /// object.
/// </summary /// </summary
/// <param name="req">Incoming OSHttpRequest to which we are /// <param name="req">Incoming OSHttpRequest to which we are
/// replying</param> /// replying</param>
public OSHttpResponse(OSHttpRequest req) public OSHttpResponse(OSHttpRequest req)
{ {
_httpResponse = new HttpResponse(req.HttpClientContext, req.HttpRequest); _httpResponse = new HttpResponse(req.HttpClientContext, req.HttpRequest);
@ -343,7 +343,7 @@ namespace OpenSim.Framework.Servers
/// <param name="key">string containing the header field /// <param name="key">string containing the header field
/// name</param> /// name</param>
/// <param name="value">string containing the header field /// <param name="value">string containing the header field
/// value</param> /// value</param>
public void AddHeader(string key, string value) public void AddHeader(string key, string value)
{ {
if (HttpServer) if (HttpServer)
@ -361,8 +361,8 @@ namespace OpenSim.Framework.Servers
{ {
_httpResponse.Body.Flush(); _httpResponse.Body.Flush();
_httpResponse.Send(); _httpResponse.Send();
} }
else else
{ {
OutputStream.Close(); OutputStream.Close();
} }

View File

@ -80,7 +80,7 @@ namespace OpenSim.Framework.Servers
get { return _isSecure; } get { return _isSecure; }
} }
public int QueueSize public int QueueSize
{ {
get { return _pumps.Length; } get { return _pumps.Length; }
} }
@ -91,7 +91,7 @@ namespace OpenSim.Framework.Servers
protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>(); protected List<OSHttpHandler> _httpHandlers = new List<OSHttpHandler>();
public List<OSHttpHandler> OSHttpHandlers public List<OSHttpHandler> OSHttpHandlers
{ {
get get
{ {
lock (_httpHandlers) lock (_httpHandlers)
{ {
@ -175,7 +175,7 @@ namespace OpenSim.Framework.Servers
_listener.RequestHandler += OnHttpRequest; _listener.RequestHandler += OnHttpRequest;
_listener.Start(QueueSize); _listener.Start(QueueSize);
_log.InfoFormat("[{0}] HTTP server started", EngineID); _log.InfoFormat("[{0}] HTTP server started", EngineID);
lock (_syncObject) Monitor.Wait(_syncObject); lock (_syncObject) Monitor.Wait(_syncObject);
} }
catch (Exception ex) catch (Exception ex)
@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers
/// and regular expressions to match against header values</param> /// and regular expressions to match against header values</param>
public void AddHandler(OSHttpHandler handler) public void AddHandler(OSHttpHandler handler)
{ {
lock (_httpHandlers) lock (_httpHandlers)
{ {
if (_httpHandlers.Contains(handler)) if (_httpHandlers.Contains(handler))
{ {

View File

@ -54,16 +54,16 @@ namespace OpenSim.Framework.Servers
protected bool XmlRpcMethodMatch(OSHttpRequest req) protected bool XmlRpcMethodMatch(OSHttpRequest req)
{ {
XmlRpcRequest xmlRpcRequest = null; XmlRpcRequest xmlRpcRequest = null;
// check whether req is already reified // check whether req is already reified
// if not: reify (and post to whiteboard) // if not: reify (and post to whiteboard)
try try
{ {
if (req.Whiteboard.ContainsKey("xmlrequest")) if (req.Whiteboard.ContainsKey("xmlrequest"))
{ {
xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest; xmlRpcRequest = req.Whiteboard["xmlrequest"] as XmlRpcRequest;
} }
else else
{ {
StreamReader body = new StreamReader(req.InputStream); StreamReader body = new StreamReader(req.InputStream);
string requestBody = body.ReadToEnd(); string requestBody = body.ReadToEnd();
@ -76,22 +76,22 @@ namespace OpenSim.Framework.Servers
_log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString()); _log.ErrorFormat("[OSHttpXmlRpcHandler] failed to deserialize XmlRpcRequest from {0}", req.ToString());
return false; return false;
} }
// check against methodName // check against methodName
if ((null != xmlRpcRequest) if ((null != xmlRpcRequest)
&& !String.IsNullOrEmpty(xmlRpcRequest.MethodName) && !String.IsNullOrEmpty(xmlRpcRequest.MethodName)
&& xmlRpcRequest.MethodName == _methodName) && xmlRpcRequest.MethodName == _methodName)
{ {
_log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString()); _log.DebugFormat("[OSHttpXmlRpcHandler] located handler {0} for {1}", _methodName, req.ToString());
return true; return true;
} }
return false; return false;
} }
// contains handler for processing XmlRpc Request // contains handler for processing XmlRpc Request
private XmlRpcMethod _handler; private XmlRpcMethod _handler;
// contains XmlRpc method name // contains XmlRpc method name
private string _methodName; private string _methodName;
@ -112,9 +112,9 @@ namespace OpenSim.Framework.Servers
/// can be null, in which case they are not taken into account /// can be null, in which case they are not taken into account
/// when the handler is being looked up. /// when the handler is being looked up.
/// </remarks> /// </remarks>
public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path, public OSHttpXmlRpcHandler(XmlRpcMethod handler, string methodName, Regex path,
Dictionary<string, Regex> headers, Regex whitelist) Dictionary<string, Regex> headers, Regex whitelist)
: base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers, : base(new Regex(@"^POST$", RegexOptions.IgnoreCase | RegexOptions.Compiled), path, null, headers,
new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled), new Regex(@"^(text|application)/xml", RegexOptions.IgnoreCase | RegexOptions.Compiled),
whitelist) whitelist)
{ {
@ -138,7 +138,7 @@ namespace OpenSim.Framework.Servers
/// <summary> /// <summary>
/// Invoked by OSHttpRequestPump. /// Invoked by OSHttpRequestPump.
/// </summary> /// </summary>
public override OSHttpHandlerResult Process(OSHttpRequest request) public override OSHttpHandlerResult Process(OSHttpRequest request)
{ {
XmlRpcResponse xmlRpcResponse; XmlRpcResponse xmlRpcResponse;
string responseString; string responseString;
@ -148,13 +148,13 @@ namespace OpenSim.Framework.Servers
OSHttpResponse resp = new OSHttpResponse(request); OSHttpResponse resp = new OSHttpResponse(request);
try try
{ {
// reified XmlRpcRequest must still be on the whiteboard // reified XmlRpcRequest must still be on the whiteboard
XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest; XmlRpcRequest xmlRpcRequest = request.Whiteboard["xmlrequest"] as XmlRpcRequest;
xmlRpcResponse = _handler(xmlRpcRequest); xmlRpcResponse = _handler(xmlRpcRequest);
responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse);
resp.ContentType = "text/xml"; resp.ContentType = "text/xml";
byte[] buffer = Encoding.UTF8.GetBytes(responseString); byte[] buffer = Encoding.UTF8.GetBytes(responseString);
@ -176,4 +176,4 @@ namespace OpenSim.Framework.Servers
return OSHttpHandlerResult.Done; return OSHttpHandlerResult.Done;
} }
} }
} }

View File

@ -151,7 +151,7 @@ namespace OpenSim.Framework.Servers
private CheckIdentityMethod m_smethod; private CheckIdentityMethod m_smethod;
public RestDeserialiseSecureHandler( public RestDeserialiseSecureHandler(
string httpMethod, string path, string httpMethod, string path,
RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod) RestDeserialiseMethod<TRequest, TResponse> method, CheckIdentityMethod smethod)
: base(httpMethod, path) : base(httpMethod, path)
{ {
@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers
/// <param name="method"></param> /// <param name="method"></param>
/// <param name="tmethod"></param> /// <param name="tmethod"></param>
private RestDeserialiseMethod<TRequest, TResponse> m_method; private RestDeserialiseMethod<TRequest, TResponse> m_method;
/// <summary> /// <summary>
/// The method used to check whether a request is trusted. /// The method used to check whether a request is trusted.
/// </summary> /// </summary>

View File

@ -24,10 +24,10 @@
* (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.Text; using System.Text;
namespace OpenSim.Framework.Statistics namespace OpenSim.Framework.Statistics
{ {
/// <summary> /// <summary>
@ -44,7 +44,7 @@ namespace OpenSim.Framework.Statistics
string.Format( string.Format(
"Allocated to OpenSim : {0} MB" + Environment.NewLine, "Allocated to OpenSim : {0} MB" + Environment.NewLine,
Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
return sb.ToString(); return sb.ToString();
} }
} }

View File

@ -40,7 +40,7 @@ namespace OpenSim.Framework.Statistics
public class SimExtraStatsCollector : BaseStatsCollector public class SimExtraStatsCollector : BaseStatsCollector
{ {
private long abnormalClientThreadTerminations; private long abnormalClientThreadTerminations;
private long assetsInCache; private long assetsInCache;
private long texturesInCache; private long texturesInCache;
private long assetCacheMemoryUsage; private long assetCacheMemoryUsage;
@ -49,7 +49,7 @@ namespace OpenSim.Framework.Statistics
private long assetServiceRequestFailures; private long assetServiceRequestFailures;
private long inventoryServiceRetrievalFailures; private long inventoryServiceRetrievalFailures;
private float timeDilation; private float timeDilation;
private float simFps; private float simFps;
private float physicsFps; private float physicsFps;
@ -70,8 +70,8 @@ namespace OpenSim.Framework.Statistics
private float pendingDownloads; private float pendingDownloads;
private float pendingUploads; private float pendingUploads;
private float activeScripts; private float activeScripts;
private float scriptLinesPerSecond; private float scriptLinesPerSecond;
/// <summary> /// <summary>
/// Number of times that a client thread terminated because of an exception /// Number of times that a client thread terminated because of an exception
/// </summary> /// </summary>
@ -79,7 +79,7 @@ namespace OpenSim.Framework.Statistics
/// <summary> /// <summary>
/// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
/// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
/// haven't yet been implemented... :) /// haven't yet been implemented... :)
/// </summary> /// </summary>
public long AssetsInCache { get { return assetsInCache; } } public long AssetsInCache { get { return assetsInCache; } }
@ -101,19 +101,19 @@ namespace OpenSim.Framework.Statistics
/// as a failure /// as a failure
/// </summary> /// </summary>
public long AssetServiceRequestFailures { get { return assetServiceRequestFailures; } } public long AssetServiceRequestFailures { get { return assetServiceRequestFailures; } }
/// <summary> /// <summary>
/// Number of known failures to retrieve avatar inventory from the inventory service. This does not /// Number of known failures to retrieve avatar inventory from the inventory service. This does not
/// cover situations where the inventory service accepts the request but never returns any data, since /// cover situations where the inventory service accepts the request but never returns any data, since
/// we do not yet timeout this situation. /// we do not yet timeout this situation.
/// </summary> /// </summary>
public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } } public long InventoryServiceRetrievalFailures { get { return inventoryServiceRetrievalFailures; } }
/// <summary> /// <summary>
/// Retrieve the total frame time (in ms) of the last frame /// Retrieve the total frame time (in ms) of the last frame
/// </summary> /// </summary>
//public float TotalFrameTime { get { return totalFrameTime; } } //public float TotalFrameTime { get { return totalFrameTime; } }
/// <summary> /// <summary>
/// Retrieve the physics update component (in ms) of the last frame /// Retrieve the physics update component (in ms) of the last frame
/// </summary> /// </summary>
@ -124,7 +124,7 @@ namespace OpenSim.Framework.Statistics
/// </summary> /// </summary>
private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors private IDictionary<LLUUID, PacketQueueStatsCollector> packetQueueStatsCollectors
= new Dictionary<LLUUID, PacketQueueStatsCollector>(); = new Dictionary<LLUUID, PacketQueueStatsCollector>();
public void AddAbnormalClientThreadTermination() public void AddAbnormalClientThreadTermination()
{ {
abnormalClientThreadTerminations++; abnormalClientThreadTerminations++;
@ -146,7 +146,7 @@ namespace OpenSim.Framework.Statistics
textureCacheMemoryUsage += image.Data.Length; textureCacheMemoryUsage += image.Data.Length;
} }
} }
/// <summary> /// <summary>
/// Signal that the asset cache can be cleared. /// Signal that the asset cache can be cleared.
/// </summary> /// </summary>
@ -167,7 +167,7 @@ namespace OpenSim.Framework.Statistics
{ {
assetServiceRequestFailures++; assetServiceRequestFailures++;
} }
public void AddInventoryServiceRetrievalFailure() public void AddInventoryServiceRetrievalFailure()
{ {
inventoryServiceRetrievalFailures++; inventoryServiceRetrievalFailures++;
@ -199,18 +199,18 @@ namespace OpenSim.Framework.Statistics
packetQueueStatsCollectors.Remove(uuid); packetQueueStatsCollectors.Remove(uuid);
} }
} }
/// <summary> /// <summary>
/// This is the method on which the classic sim stats reporter (which collects stats for /// This is the method on which the classic sim stats reporter (which collects stats for
/// client purposes) sends information to listeners. /// client purposes) sends information to listeners.
/// </summary> /// </summary>
/// <param name="pack"></param> /// <param name="pack"></param>
public void ReceiveClassicSimStatsPacket(SimStatsPacket statsPacket) public void ReceiveClassicSimStatsPacket(SimStatsPacket statsPacket)
{ {
// FIXME: Really shouldn't rely on the probably arbitrary order in which // FIXME: Really shouldn't rely on the probably arbitrary order in which
// stats are packed into the packet // stats are packed into the packet
timeDilation = statsPacket.Stat[0].StatValue; timeDilation = statsPacket.Stat[0].StatValue;
simFps = statsPacket.Stat[1].StatValue; simFps = statsPacket.Stat[1].StatValue;
physicsFps = statsPacket.Stat[2].StatValue; physicsFps = statsPacket.Stat[2].StatValue;
agentUpdates = statsPacket.Stat[3].StatValue; agentUpdates = statsPacket.Stat[3].StatValue;
rootAgents = statsPacket.Stat[4].StatValue; rootAgents = statsPacket.Stat[4].StatValue;
@ -231,7 +231,7 @@ namespace OpenSim.Framework.Statistics
activeScripts = statsPacket.Stat[19].StatValue; activeScripts = statsPacket.Stat[19].StatValue;
scriptLinesPerSecond = statsPacket.Stat[20].StatValue; scriptLinesPerSecond = statsPacket.Stat[20].StatValue;
} }
/// <summary> /// <summary>
/// Report back collected statistical information. /// Report back collected statistical information.
/// </summary> /// </summary>
@ -248,10 +248,10 @@ Texture cache contains {2,6} texture assets using {3,10} K
Blocked client requests for missing textures: {4} Blocked client requests for missing textures: {4}
Asset service request failures: {5}"+ Environment.NewLine, Asset service request failures: {5}"+ Environment.NewLine,
AssetsInCache, Math.Round(AssetCacheMemoryUsage / 1024.0), AssetsInCache, Math.Round(AssetCacheMemoryUsage / 1024.0),
TexturesInCache, Math.Round(TextureCacheMemoryUsage / 1024.0), TexturesInCache, Math.Round(TextureCacheMemoryUsage / 1024.0),
BlockedMissingTextureRequests, BlockedMissingTextureRequests,
AssetServiceRequestFailures)); AssetServiceRequestFailures));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("CONNECTION STATISTICS"); sb.Append("CONNECTION STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
@ -267,7 +267,7 @@ Asset service request failures: {5}"+ Environment.NewLine,
string.Format( string.Format(
"Initial inventory caching failures: {0}" + Environment.NewLine, "Initial inventory caching failures: {0}" + Environment.NewLine,
InventoryServiceRetrievalFailures)); InventoryServiceRetrievalFailures));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append("FRAME STATISTICS"); sb.Append("FRAME STATISTICS");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
@ -278,18 +278,18 @@ Asset service request failures: {5}"+ Environment.NewLine,
"{0,6:0.00} {1,6:0} {2,6:0.0} {3,6:0.0} {4,6:0} {5,6:0} {6,6:0} {7,6:0} {8,6:0} {9,6:0}", "{0,6:0.00} {1,6:0} {2,6:0.0} {3,6:0.0} {4,6:0} {5,6:0} {6,6:0} {7,6:0} {8,6:0} {9,6:0}",
timeDilation, simFps, physicsFps, agentUpdates, rootAgents, timeDilation, simFps, physicsFps, agentUpdates, rootAgents,
childAgents, totalPrims, activePrims, activeScripts, scriptLinesPerSecond)); childAgents, totalPrims, activePrims, activeScripts, scriptLinesPerSecond));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
// There is no script frame time currently because we don't yet collect it // There is no script frame time currently because we don't yet collect it
sb.Append("PktsIn PktOut PendDl PendUl UnackB TotlFt NetFt PhysFt OthrFt AgntFt ImgsFt"); sb.Append("PktsIn PktOut PendDl PendUl UnackB TotlFt NetFt PhysFt OthrFt AgntFt ImgsFt");
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
sb.Append( sb.Append(
string.Format( string.Format(
"{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}", "{0,6:0} {1,6:0} {2,6:0} {3,6:0} {4,6:0} {5,6:0.0} {6,6:0.0} {7,6:0.0} {8,6:0.0} {9,6:0.0} {10,6:0.0}",
inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime, inPacketsPerSecond, outPacketsPerSecond, pendingDownloads, pendingUploads, unackedBytes, totalFrameTime,
netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime)); netFrameTime, physicsFrameTime, otherFrameTime, agentFrameTime, imageFrameTime));
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
/* /*
sb.Append(Environment.NewLine); sb.Append(Environment.NewLine);
@ -311,7 +311,7 @@ Asset service request failures: {5}"+ Environment.NewLine,
*/ */
sb.Append(base.Report()); sb.Append(base.Report());
return sb.ToString(); return sb.ToString();
} }
} }

View File

@ -226,7 +226,7 @@ namespace OpenSim.Framework
private LLUUID _permsGranter; private LLUUID _permsGranter;
private int _permsMask; private int _permsMask;
private int _type = 0; private int _type = 0;
public LLUUID AssetID { public LLUUID AssetID {
get { get {
return _assetID; return _assetID;
@ -437,4 +437,4 @@ namespace OpenSim.Framework
_parentPartID = partID; _parentPartID = partID;
} }
} }
} }

View File

@ -716,7 +716,7 @@ namespace OpenSim.Framework
XmlRpcRequest client = new XmlRpcRequest(methodName, args); XmlRpcRequest client = new XmlRpcRequest(methodName, args);
return client.Send(url, 6000); return client.Send(url, 6000);
} }
// used for RemoteParcelRequest (for "About Landmark") // used for RemoteParcelRequest (for "About Landmark")
public static LLUUID BuildFakeParcelID(ulong regionHandle, uint x, uint y) { public static LLUUID BuildFakeParcelID(ulong regionHandle, uint x, uint y) {
byte[] bytes = { byte[] bytes = {
@ -726,7 +726,7 @@ namespace OpenSim.Framework
(byte)(y >> 24), (byte)(y >> 16), (byte)(y >> 8), (byte)y }; (byte)(y >> 24), (byte)(y >> 16), (byte)(y >> 8), (byte)y };
return new LLUUID(bytes, 0); return new LLUUID(bytes, 0);
} }
public static void ParseFakeParcelID(LLUUID parcelID, out ulong regionHandle, out uint x, out uint y) { public static void ParseFakeParcelID(LLUUID parcelID, out ulong regionHandle, out uint x, out uint y) {
byte[] bytes = parcelID.GetBytes(); byte[] bytes = parcelID.GetBytes();
regionHandle = Helpers.BytesToUInt64(bytes); regionHandle = Helpers.BytesToUInt64(bytes);

View File

@ -83,7 +83,7 @@ namespace OpenSim.Grid.AssetServer
public override void Startup() public override void Startup()
{ {
base.Startup(); base.Startup();
AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml"))); AssetConfig config = new AssetConfig("ASSET SERVER", (Path.Combine(Util.configDir(), "AssetServer_Config.xml")));
m_log.Info("[ASSET]: Setting up asset DB"); m_log.Info("[ASSET]: Setting up asset DB");
@ -115,17 +115,17 @@ namespace OpenSim.Grid.AssetServer
public IAssetProviderPlugin LoadDatabasePlugin(string provider, string connect) public IAssetProviderPlugin LoadDatabasePlugin(string provider, string connect)
{ {
PluginLoader<IAssetProviderPlugin> loader = PluginLoader<IAssetProviderPlugin> loader =
new PluginLoader<IAssetProviderPlugin> (new AssetDataInitialiser (connect)); new PluginLoader<IAssetProviderPlugin> (new AssetDataInitialiser (connect));
// loader will try to load all providers (MySQL, MSSQL, etc) // loader will try to load all providers (MySQL, MSSQL, etc)
// unless it is constrainted to the correct "Provider" entry in the addin.xml // unless it is constrainted to the correct "Provider" entry in the addin.xml
loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider)); loader.Add ("/OpenSim/AssetData", new PluginProviderFilter (provider));
loader.Load(); loader.Load();
return loader.Plugin; return loader.Plugin;
} }
public void setupDB(AssetConfig config) public void setupDB(AssetConfig config)
{ {
try try

View File

@ -40,17 +40,17 @@ namespace OpenSim.Grid.Communications.OGS1
public class OGS1InterServiceInventoryService : IInterServiceInventoryServices public class OGS1InterServiceInventoryService : IInterServiceInventoryServices
{ {
protected Uri m_inventoryServerUrl; protected Uri m_inventoryServerUrl;
public OGS1InterServiceInventoryService(Uri inventoryServerUrl) public OGS1InterServiceInventoryService(Uri inventoryServerUrl)
{ {
m_inventoryServerUrl = inventoryServerUrl; m_inventoryServerUrl = inventoryServerUrl;
} }
/// <summary> /// <summary>
/// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/> /// <see cref="OpenSim.Framework.Communications.IInterServiceInventoryServices"/>
/// </summary> /// </summary>
/// <param name="userId"></param> /// <param name="userId"></param>
/// <returns></returns> /// <returns></returns>
public bool CreateNewUserInventory(LLUUID userId) public bool CreateNewUserInventory(LLUUID userId)
{ {
return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>( return SynchronousRestObjectPoster.BeginPostObject<Guid, bool>(

View File

@ -61,20 +61,20 @@ namespace OpenSim.Grid.GridServer
/// <param name="provider">The name of the grid server plugin DLL</param> /// <param name="provider">The name of the grid server plugin DLL</param>
public void AddPlugin(string provider, string connect) public void AddPlugin(string provider, string connect)
{ {
PluginLoader<IGridDataPlugin> gridloader = PluginLoader<IGridDataPlugin> gridloader =
new PluginLoader<IGridDataPlugin> (new GridDataInitialiser (connect)); new PluginLoader<IGridDataPlugin> (new GridDataInitialiser (connect));
PluginLoader<ILogDataPlugin> logloader = PluginLoader<ILogDataPlugin> logloader =
new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect)); new PluginLoader<ILogDataPlugin> (new LogDataInitialiser (connect));
// loader will try to load all providers (MySQL, MSSQL, etc) // loader will try to load all providers (MySQL, MSSQL, etc)
// unless it is constrainted to the correct "Provider" entry in the addin.xml // unless it is constrainted to the correct "Provider" entry in the addin.xml
gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider)); gridloader.Add ("/OpenSim/GridData", new PluginProviderFilter (provider));
logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider)); logloader.Add ("/OpenSim/LogData", new PluginProviderFilter (provider));
gridloader.Load(); gridloader.Load();
logloader.Load(); logloader.Load();
_plugins = gridloader.Plugins; _plugins = gridloader.Plugins;
_logplugins = logloader.Plugins; _logplugins = logloader.Plugins;
} }
@ -382,7 +382,7 @@ namespace OpenSim.Grid.GridServer
string logMsg = e.Message; string logMsg = e.Message;
if (e.InnerException != null) if (e.InnerException != null)
logMsg += ", " + e.InnerException.Message; logMsg += ", " + e.InnerException.Message;
m_log.WarnFormat("[LOGIN END]: {0}", logMsg); m_log.WarnFormat("[LOGIN END]: {0}", logMsg);
return e.XmlRpcErrorResponse; return e.XmlRpcErrorResponse;

View File

@ -34,7 +34,7 @@ namespace OpenSim.Grid.GridServer
{ {
void Initialise(GridServerBase gridServer); void Initialise(GridServerBase gridServer);
} }
public class GridPluginInitialiser : PluginInitialiserBase public class GridPluginInitialiser : PluginInitialiserBase
{ {
private GridServerBase server; private GridServerBase server;

View File

@ -84,12 +84,12 @@ namespace OpenSim.Grid.InventoryServer
{ {
return true; return true;
} }
} }
m_log.WarnFormat( m_log.WarnFormat(
"[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources",
peer); peer);
return false; return false;
} }
else else
@ -110,7 +110,7 @@ namespace OpenSim.Grid.InventoryServer
if (m_doLookup) if (m_doLookup)
{ {
m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id); m_log.InfoFormat("[GRID AGENT INVENTORY]: checking authed session {0} {1}", session_id, avatar_id);
if (m_session_cache.getCachedSession(session_id, avatar_id) == null) if (m_session_cache.getCachedSession(session_id, avatar_id) == null)
{ {
// cache miss, ask userserver // cache miss, ask userserver
@ -137,7 +137,7 @@ namespace OpenSim.Grid.InventoryServer
m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache"); m_log.Info("[GRID AGENT INVENTORY]: got authed session from cache");
return true; return true;
} }
m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected"); m_log.Warn("[GRID AGENT INVENTORY]: unknown session_id, request rejected");
return false; return false;
} }

View File

@ -65,7 +65,7 @@ namespace OpenSim.Grid.InventoryServer
public override void Startup() public override void Startup()
{ {
base.Startup(); base.Startup();
InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml"))); InventoryConfig config = new InventoryConfig(LogName, (Path.Combine(Util.configDir(), "InventoryServer_Config.xml")));
m_inventoryService = new GridInventoryService(config.UserServerURL); m_inventoryService = new GridInventoryService(config.UserServerURL);

View File

@ -43,10 +43,10 @@ namespace OpenGridServices.Manager
{ {
case Gtk.ResponseType.Ok: case Gtk.ResponseType.Ok:
MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text); MainClass.PendingOperations.Enqueue("connect_to_gridserver " + this.entry1.Text + " " + this.entry2.Text + " " + this.entry3.Text);
break; break;
case Gtk.ResponseType.Cancel: case Gtk.ResponseType.Cancel:
break; break;
} }
this.Hide(); this.Hide();
} }

View File

@ -41,9 +41,9 @@ namespace OpenGridServices.Manager
private string ServerURL; private string ServerURL;
public LLUUID SessionID; public LLUUID SessionID;
public bool connected=false; public bool connected=false;
public RegionBlock[][] WorldMap; public RegionBlock[][] WorldMap;
public bool Connect(string GridServerURL, string username, string password) public bool Connect(string GridServerURL, string username, string password)
{ {
try try
@ -76,14 +76,14 @@ namespace OpenGridServices.Manager
return false; return false;
} }
} }
public void DownloadMap() public void DownloadMap()
{ {
System.Net.WebClient mapdownloader = new WebClient(); System.Net.WebClient mapdownloader = new WebClient();
Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist"); Stream regionliststream = mapdownloader.OpenRead(ServerURL + "/regionlist");
RegionBlock TempRegionData; RegionBlock TempRegionData;
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.Load(regionliststream); doc.Load(regionliststream);
regionliststream.Close(); regionliststream.Close();
@ -105,12 +105,12 @@ namespace OpenGridServices.Manager
} }
} }
} }
public bool RestartServer() public bool RestartServer()
{ {
return true; return true;
} }
public bool ShutdownServer() public bool ShutdownServer()
{ {
try try
@ -137,7 +137,7 @@ namespace OpenGridServices.Manager
return false; return false;
} }
} }
public void DisconnectServer() public void DisconnectServer()
{ {
this.connected=false; this.connected=false;

View File

@ -38,9 +38,9 @@ namespace OpenGridServices.Manager
public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>(); public static BlockingQueue<string> PendingOperations = new BlockingQueue<string>();
private static Thread OperationsRunner; private static Thread OperationsRunner;
private static GridServerConnectionManager gridserverConn; private static GridServerConnectionManager gridserverConn;
private static MainWindow win; private static MainWindow win;
public static void DoMainLoop() public static void DoMainLoop()
@ -79,7 +79,7 @@ namespace OpenGridServices.Manager
win.SetStatus("Could not connect"); win.SetStatus("Could not connect");
} }
break; break;
case "restart_gridserver": case "restart_gridserver":
win.SetStatus("Restarting grid server..."); win.SetStatus("Restarting grid server...");
if (gridserverConn.RestartServer()) if (gridserverConn.RestartServer())
@ -93,7 +93,7 @@ namespace OpenGridServices.Manager
win.SetStatus("Error restarting grid server!!!"); win.SetStatus("Error restarting grid server!!!");
} }
break; break;
case "shutdown_gridserver": case "shutdown_gridserver":
win.SetStatus("Shutting down grid server..."); win.SetStatus("Shutting down grid server...");
if (gridserverConn.ShutdownServer()) if (gridserverConn.ShutdownServer())
@ -108,7 +108,7 @@ namespace OpenGridServices.Manager
win.SetStatus("Could not shutdown grid server!!!"); win.SetStatus("Could not shutdown grid server!!!");
} }
break; break;
case "disconnect_gridserver": case "disconnect_gridserver":
gridserverConn.DisconnectServer(); gridserverConn.DisconnectServer();
win.SetGridServerConnected(false); win.SetGridServerConnected(false);

View File

@ -83,14 +83,12 @@ namespace OpenSim.Grid.MessagingServer
public override void Startup() public override void Startup()
{ {
base.Startup(); base.Startup();
Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml"))); Cfg = new MessageServerConfig("MESSAGING SERVER", (Path.Combine(Util.configDir(), "MessagingServer_Config.xml")));
m_log.Info("[REGION]: Starting HTTP process"); m_log.Info("[REGION]: Starting HTTP process");
m_httpServer = new BaseHttpServer(Cfg.HttpPort); m_httpServer = new BaseHttpServer(Cfg.HttpPort);
msgsvc = new MessageService(Cfg); msgsvc = new MessageService(Cfg);
if (msgsvc.registerWithUserServer()) if (msgsvc.registerWithUserServer())
@ -123,7 +121,6 @@ namespace OpenSim.Grid.MessagingServer
switch (what) switch (what)
{ {
case "user": case "user":
try try
{ {
//userID = //userID =
@ -161,8 +158,6 @@ namespace OpenSim.Grid.MessagingServer
m_console.Notice("Region cache cleared! Cleared " + entries.ToString() + " entries"); m_console.Notice("Region cache cleared! Cleared " + entries.ToString() + " entries");
break; break;
} }
} }
public override void Shutdown() public override void Shutdown()

View File

@ -62,7 +62,7 @@ namespace OpenSim.Grid.MessagingServer
} }
return result; return result;
} }
public int Count public int Count
{ {
get get

View File

@ -45,7 +45,6 @@ namespace OpenSim.Grid.ScriptServer
regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer, regInfo, authen, commsMan, sceneGridService, assetCach, storeManager, httpServer,
moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild, config, "") moduleLoader, dumpAssetsToFile, physicalPrim, sendTasksToChild, config, "")
{ {
} }
// What does a scene have to do? :P // What does a scene have to do? :P

View File

@ -57,7 +57,7 @@ namespace OpenSim.Grid.ScriptServer
internal TCPServer m_TCPServer; internal TCPServer m_TCPServer;
internal TRPC_Remote RPC; internal TRPC_Remote RPC;
public ScriptServerMain() public ScriptServerMain()
{ {
m_console = CreateConsole(); m_console = CreateConsole();
@ -68,7 +68,6 @@ namespace OpenSim.Grid.ScriptServer
Engine = ScriptEngines.LoadEngine("DotNetEngine"); Engine = ScriptEngines.LoadEngine("DotNetEngine");
Engine.InitializeEngine(null, null, false, Engine.GetScriptManager()); Engine.InitializeEngine(null, null, false, Engine.GetScriptManager());
// Set up server // Set up server
//m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine"); //m_RemotingServer = new RemotingServer(listenPort, "DotNetEngine");

View File

@ -90,7 +90,7 @@ namespace OpenSim.Grid.UserServer
public override void Startup() public override void Startup()
{ {
base.Startup(); base.Startup();
Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
m_stats = StatsManager.StartCollectingUserStats(); m_stats = StatsManager.StartCollectingUserStats();
@ -101,11 +101,11 @@ namespace OpenSim.Grid.UserServer
m_gridInfoService = new GridInfoService(); m_gridInfoService = new GridInfoService();
m_interServiceInventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl); m_interServiceInventoryService = new OGS1InterServiceInventoryService(Cfg.InventoryUrl);
m_loginService = new UserLoginService( m_loginService = new UserLoginService(
m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg); m_userManager, m_interServiceInventoryService, new LibraryRootFolder(), Cfg, Cfg.DefaultStartupMsg);
m_messagesService = new MessageServersConnector(); m_messagesService = new MessageServersConnector();
m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation; m_loginService.OnUserLoggedInAtLocation += NotifyMessageServersUserLoggedInToLocation;
@ -151,7 +151,6 @@ namespace OpenSim.Grid.UserServer
m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod)); m_httpServer.AddStreamHandler(new RestStreamHandler("GET", "/get_grid_info", m_gridInfoService.RestGetGridInfoMethod));
m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod); m_httpServer.AddXmlRPCHandler("get_grid_info", m_gridInfoService.XmlRpcGridInfoMethod);
m_httpServer.AddStreamHandler( m_httpServer.AddStreamHandler(
new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod)); new RestStreamHandler("DELETE", "/usersessions/", m_userManager.RestDeleteUserSessionMethod));
@ -188,7 +187,7 @@ namespace OpenSim.Grid.UserServer
tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty); tempMD5Passwd = Util.Md5Hash(Util.Md5Hash(tempMD5Passwd) + ":" + String.Empty);
LLUUID userID = new LLUUID(); LLUUID userID = new LLUUID();
try try
{ {
userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY); userID = m_userManager.AddUserProfile(tempfirstname, templastname, tempMD5Passwd, regX, regY);
@ -199,7 +198,7 @@ namespace OpenSim.Grid.UserServer
} }
try try
{ {
if (!m_interServiceInventoryService.CreateNewUserInventory(userID)) if (!m_interServiceInventoryService.CreateNewUserInventory(userID))
{ {
throw new Exception( throw new Exception(
@ -245,9 +244,9 @@ namespace OpenSim.Grid.UserServer
// requester.ReturnResponseVal = TestResponse; // requester.ReturnResponseVal = TestResponse;
// requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser); // requester.BeginPostObject<LLUUID>(m_userManager._config.InventoryUrl + "RootFolders/", m_lastCreatedUser);
SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>( SynchronousRestObjectPoster.BeginPostObject<LLUUID, List<InventoryFolderBase>>(
"POST", Cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser); "POST", Cfg.InventoryUrl + "RootFolders/", m_lastCreatedUser);
break; break;
case "logoff-user": case "logoff-user":
if (cmdparams.Length >= 3) if (cmdparams.Length >= 3)
@ -279,7 +278,7 @@ namespace OpenSim.Grid.UserServer
m_loginService.LogOffUser(theUser, message); m_loginService.LogOffUser(theUser, message);
theUser.CurrentAgent.AgentOnline = false; theUser.CurrentAgent.AgentOnline = false;
m_loginService.CommitAgent(ref theUser); m_loginService.CommitAgent(ref theUser);
} }
else else

View File

@ -46,7 +46,7 @@ namespace OpenSim.Grid.UserServer
public class UserLoginService : LoginService public class UserLoginService : LoginService
{ {
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected IInterServiceInventoryServices m_inventoryService; protected IInterServiceInventoryServices m_inventoryService;
public event UserLoggedInAtLocation OnUserLoggedInAtLocation; public event UserLoggedInAtLocation OnUserLoggedInAtLocation;
@ -63,7 +63,7 @@ namespace OpenSim.Grid.UserServer
m_config = config; m_config = config;
m_inventoryService = inventoryService; m_inventoryService = inventoryService;
} }
public override void LogOffUser(UserProfileData theUser, string message) public override void LogOffUser(UserProfileData theUser, string message)
{ {
RegionProfileData SimInfo = null; RegionProfileData SimInfo = null;
@ -72,7 +72,7 @@ namespace OpenSim.Grid.UserServer
SimInfo = RegionProfileData.RequestSimProfileData( SimInfo = RegionProfileData.RequestSimProfileData(
theUser.CurrentAgent.Handle, m_config.GridServerURL, theUser.CurrentAgent.Handle, m_config.GridServerURL,
m_config.GridSendKey, m_config.GridRecvKey); m_config.GridSendKey, m_config.GridRecvKey);
if (SimInfo == null) if (SimInfo == null)
{ {
m_log.Error("[GRID]: Region user was in isn't currently logged in"); m_log.Error("[GRID]: Region user was in isn't currently logged in");
@ -84,7 +84,7 @@ namespace OpenSim.Grid.UserServer
m_log.Error("[GRID]: Unable to look up region to log user off"); m_log.Error("[GRID]: Unable to look up region to log user off");
return; return;
} }
// Prepare notification // Prepare notification
Hashtable SimParams = new Hashtable(); Hashtable SimParams = new Hashtable();
SimParams["agent_id"] = theUser.ID.ToString(); SimParams["agent_id"] = theUser.ID.ToString();
@ -101,7 +101,7 @@ namespace OpenSim.Grid.UserServer
m_log.InfoFormat( m_log.InfoFormat(
"[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}", "[ASSUMED CRASH]: Telling region {0} @ {1},{2} ({3}) that their agent is dead: {4}",
SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName); SimInfo.regionName, SimInfo.regionLocX, SimInfo.regionLocY, SimInfo.httpServerURI, theUser.FirstName + " " + theUser.SurName);
try try
{ {
XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams); XmlRpcRequest GridReq = new XmlRpcRequest("logoff_user", SendParams);
@ -306,8 +306,6 @@ namespace OpenSim.Grid.UserServer
theUser.FirstName, theUser.SurName); theUser.FirstName, theUser.SurName);
} }
} }
} }
} }
catch (Exception) catch (Exception)
@ -419,7 +417,7 @@ namespace OpenSim.Grid.UserServer
else else
{ {
response.CreateDeadRegionResponse(); response.CreateDeadRegionResponse();
} }
} }
catch (Exception e) catch (Exception e)
@ -432,11 +430,11 @@ namespace OpenSim.Grid.UserServer
// See LoginService // See LoginService
protected override InventoryData GetInventorySkeleton(LLUUID userID) protected override InventoryData GetInventorySkeleton(LLUUID userID)
{ {
m_log.DebugFormat( m_log.DebugFormat(
"[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}", "[LOGIN]: Contacting inventory service at {0} for inventory skeleton of user {1}",
m_config.InventoryUrl, userID); m_config.InventoryUrl, userID);
List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID); List<InventoryFolderBase> folders = m_inventoryService.GetInventorySkeleton(userID);
if (null == folders || folders.Count == 0) if (null == folders || folders.Count == 0)

Some files were not shown because too many files have changed in this diff Show More